app.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546
  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. mounted: function mounted() {
  1606. var _this = this;
  1607. Echo.channel('asset.' + this.asset.pcid).listen('AssetUpdated', function (e) {
  1608. _this.asset = e.data;
  1609. });
  1610. }
  1611. });
  1612. /***/ }),
  1613. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1614. /*!*****************************************************************************************************************************************************************************!*\
  1615. !*** ./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& ***!
  1616. \*****************************************************************************************************************************************************************************/
  1617. /*! exports provided: default */
  1618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1619. "use strict";
  1620. __webpack_require__.r(__webpack_exports__);
  1621. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1622. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. //
  1668. //
  1669. //
  1670. //
  1671. //
  1672. /* harmony default export */ __webpack_exports__["default"] = ({
  1673. components: {
  1674. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1675. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1676. },
  1677. props: {
  1678. populateWith: {
  1679. type: Object,
  1680. required: true
  1681. },
  1682. modalId: {
  1683. type: String,
  1684. required: true
  1685. }
  1686. },
  1687. data: function data() {
  1688. return {
  1689. // Essentially makes a copy of the object. Otherwise
  1690. // We would have a reference to the exising object causing
  1691. // unwanted mutations in the parent component.
  1692. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1693. assetSaving: false
  1694. };
  1695. },
  1696. methods: {
  1697. updateAsset: function updateAsset() {
  1698. var _this = this;
  1699. this.assetSaving = true;
  1700. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1701. _this.assetSaving = false;
  1702. $("#".concat(_this.modalId)).modal('hide');
  1703. })["catch"](function (error) {
  1704. _this.assetSaving = false;
  1705. });
  1706. }
  1707. }
  1708. });
  1709. /***/ }),
  1710. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1711. /*!*************************************************************************************************************************************************************************************!*\
  1712. !*** ./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& ***!
  1713. \*************************************************************************************************************************************************************************************/
  1714. /*! exports provided: default */
  1715. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1716. "use strict";
  1717. __webpack_require__.r(__webpack_exports__);
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. /* harmony default export */ __webpack_exports__["default"] = ({
  1740. props: {
  1741. value: null,
  1742. // An object with the following format
  1743. // {
  1744. // key: value,
  1745. // key: value,
  1746. // }
  1747. options: {
  1748. type: Object,
  1749. required: true
  1750. },
  1751. allowCustom: {
  1752. type: Boolean,
  1753. "default": false
  1754. }
  1755. },
  1756. data: function data() {
  1757. return {
  1758. searchText: '',
  1759. selectedOption: null,
  1760. open: false,
  1761. // allows for checking whether button was clicked or text was typed.
  1762. // If button was clicked, we show all options without having to clear
  1763. // out any searchText that was autofilled when page loaded.
  1764. isSearching: false
  1765. };
  1766. },
  1767. computed: {
  1768. matches: function matches() {
  1769. var _this = this;
  1770. // If button was clicked, show all options, if typing, filter
  1771. // options based on searchText
  1772. return Object.entries(this.options).filter(function (option) {
  1773. var optionText = option[1].toUpperCase();
  1774. if (_this.isSearching) {
  1775. return optionText.match(_this.searchText.toUpperCase());
  1776. } else {
  1777. return optionText.match('');
  1778. }
  1779. });
  1780. }
  1781. },
  1782. methods: {
  1783. // if button is clicked, show all options
  1784. setOpen: function setOpen(isOpen) {
  1785. this.open = isOpen;
  1786. this.isSearching = false;
  1787. },
  1788. // if typing in the box, start filtering options
  1789. searchChanged: function searchChanged() {
  1790. if (!this.open) {
  1791. this.open = true;
  1792. }
  1793. if (!this.isSearching) {
  1794. this.isSearching = true;
  1795. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1796. if (this.allowCustom) {
  1797. this.$emit('input', {
  1798. 'id': 'custom',
  1799. 'name': this.searchText
  1800. });
  1801. }
  1802. },
  1803. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1804. // a suggestion is selected
  1805. suggestionSelected: function suggestionSelected(suggestion) {
  1806. this.open = false;
  1807. this.searchText = suggestion[1];
  1808. this.$emit('input', {
  1809. 'id': suggestion[0],
  1810. 'name': suggestion[1]
  1811. });
  1812. },
  1813. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1814. if (this.allowCustom) {
  1815. this.searchText = this.value.name;
  1816. } else {
  1817. if (newValue.id > -1) {
  1818. // Find the matching text for the supplied option value
  1819. for (var id in this.options) {
  1820. if (this.options.hasOwnProperty(id)) {
  1821. if (this.options[id] === this.options[newValue.id]) {
  1822. this.searchText = this.options[id];
  1823. }
  1824. }
  1825. }
  1826. }
  1827. }
  1828. }
  1829. },
  1830. mounted: function mounted() {
  1831. this.updateComponentWithValue(this.value);
  1832. },
  1833. watch: {
  1834. value: function value(newValue) {
  1835. this.updateComponentWithValue(newValue);
  1836. }
  1837. }
  1838. });
  1839. /***/ }),
  1840. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1841. /*!************************************************************************************************************************************************************************!*\
  1842. !*** ./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& ***!
  1843. \************************************************************************************************************************************************************************/
  1844. /*! exports provided: default */
  1845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1846. "use strict";
  1847. __webpack_require__.r(__webpack_exports__);
  1848. //
  1849. //
  1850. //
  1851. //
  1852. /* harmony default export */ __webpack_exports__["default"] = ({
  1853. name: 'IntersectingCirclesSpinner',
  1854. props: {
  1855. color: {
  1856. type: String,
  1857. "default": '#fff'
  1858. },
  1859. size: {
  1860. type: String,
  1861. "default": '10'
  1862. }
  1863. }
  1864. });
  1865. /***/ }),
  1866. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1867. /*!*********************************************************************************************************************************************************************!*\
  1868. !*** ./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& ***!
  1869. \*********************************************************************************************************************************************************************/
  1870. /*! exports provided: default */
  1871. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1872. "use strict";
  1873. __webpack_require__.r(__webpack_exports__);
  1874. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1875. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  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. //
  1918. //
  1919. /* harmony default export */ __webpack_exports__["default"] = ({
  1920. components: {
  1921. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1922. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1923. },
  1924. props: {
  1925. credential: {
  1926. type: Object,
  1927. required: true
  1928. },
  1929. descriptions: {
  1930. type: Object,
  1931. required: true
  1932. }
  1933. },
  1934. data: function data() {
  1935. return {
  1936. data: this.credential,
  1937. creddescList: this.descriptions
  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. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1950. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1951. })["catch"](function (error) {
  1952. console.error(error);
  1953. });
  1954. }
  1955. }
  1956. });
  1957. /***/ }),
  1958. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1959. /*!******************************************************************************************************************************************************************************!*\
  1960. !*** ./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& ***!
  1961. \******************************************************************************************************************************************************************************/
  1962. /*! exports provided: default */
  1963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1964. "use strict";
  1965. __webpack_require__.r(__webpack_exports__);
  1966. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1967. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. /* harmony default export */ __webpack_exports__["default"] = ({
  1995. components: {
  1996. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1997. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1998. },
  1999. props: {
  2000. populateWith: {
  2001. type: Object,
  2002. "default": function _default() {
  2003. return {
  2004. creddesc: null,
  2005. creduser: null,
  2006. credpass: null,
  2007. groupid: null,
  2008. pcid: null,
  2009. credtype: null
  2010. };
  2011. }
  2012. },
  2013. modalId: {
  2014. type: String,
  2015. required: true
  2016. },
  2017. descriptions: {
  2018. type: Object,
  2019. required: true
  2020. },
  2021. create: {
  2022. type: Boolean
  2023. },
  2024. pcid: {
  2025. type: Number
  2026. },
  2027. groupid: {
  2028. type: Number
  2029. }
  2030. },
  2031. data: function data() {
  2032. return {
  2033. data: JSON.parse(JSON.stringify(this.populateWith)),
  2034. creddesc: {},
  2035. id: this.modalId,
  2036. errors: []
  2037. };
  2038. },
  2039. mounted: function mounted() {
  2040. this.creddesc = {
  2041. 'id': this.data.credtype,
  2042. 'name': this.data.creddesc
  2043. };
  2044. },
  2045. methods: {
  2046. rndStr: function rndStr(len) {
  2047. var text = "";
  2048. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2049. for (var i = 0; i < len; i++) {
  2050. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2051. }
  2052. return text;
  2053. },
  2054. getRandomPassword: function getRandomPassword(id) {
  2055. this.data.credpass = this.rndStr(16);
  2056. },
  2057. updateCredential: function updateCredential() {
  2058. var _this = this;
  2059. if (this.creddesc.id === "custom") {
  2060. this.data.credtype = 1;
  2061. this.data.creddesc = this.creddesc.name;
  2062. } else {
  2063. this.data.credtype = this.creddesc.id;
  2064. this.data.creddesc = this.creddesc.name;
  2065. }
  2066. if (this.create) {
  2067. if (this.pcid) {
  2068. this.data.pcid = this.pcid;
  2069. }
  2070. if (this.groupid) {
  2071. this.data.groupid = this.groupid;
  2072. }
  2073. axios.post('/api/credentials/', this.data).then(function (response) {
  2074. $('#' + _this.id).modal('hide');
  2075. });
  2076. } else {
  2077. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2078. $('#' + _this.id).modal('hide');
  2079. })["catch"](function (error) {
  2080. console.error(error);
  2081. });
  2082. }
  2083. }
  2084. }
  2085. });
  2086. /***/ }),
  2087. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2088. /*!*************************************************************************************************************************************************************************!*\
  2089. !*** ./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& ***!
  2090. \*************************************************************************************************************************************************************************/
  2091. /*! exports provided: default */
  2092. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2093. "use strict";
  2094. __webpack_require__.r(__webpack_exports__);
  2095. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2096. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2097. //
  2098. //
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. /* harmony default export */ __webpack_exports__["default"] = ({
  2107. components: {
  2108. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2109. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2110. },
  2111. props: {
  2112. credentials: {
  2113. type: Array,
  2114. required: true
  2115. },
  2116. descriptions: {
  2117. type: Array,
  2118. required: true
  2119. },
  2120. pcid: {
  2121. type: Number
  2122. },
  2123. groupid: {
  2124. type: Number
  2125. }
  2126. },
  2127. computed: {
  2128. creddescList: function creddescList() {
  2129. var list = {};
  2130. this.descriptions.map(function (val) {
  2131. list[val.creddescid] = val.credtitle;
  2132. });
  2133. return list;
  2134. }
  2135. },
  2136. methods: {
  2137. deleteCred: function deleteCred(index) {
  2138. this.credentials.splice(index, 1);
  2139. }
  2140. },
  2141. mounted: function mounted() {
  2142. var _this = this;
  2143. if (this.pcid) {
  2144. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2145. var deletedCred = e.credential;
  2146. var index = _this.credentials.findIndex(function (credential) {
  2147. return credential.credid === deletedCred['credid'];
  2148. });
  2149. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2150. _this.deleteCred(index);
  2151. }).listen('CredentialAdded', function (e) {
  2152. _this.credentials.unshift(e.credential);
  2153. });
  2154. }
  2155. if (this.groupid) {
  2156. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2157. var deletedCred = e.credential;
  2158. var index = _this.credentials.findIndex(function (credential) {
  2159. return credential.groupid === deletedCred['groupid'];
  2160. });
  2161. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2162. _this.deleteCred(index);
  2163. }).listen('CredentialAdded', function (e) {
  2164. _this.credentials.unshift(e.credential);
  2165. });
  2166. }
  2167. }
  2168. });
  2169. /***/ }),
  2170. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2171. /*!************************************************************************************************************************************************************************!*\
  2172. !*** ./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& ***!
  2173. \************************************************************************************************************************************************************************/
  2174. /*! exports provided: default */
  2175. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2176. "use strict";
  2177. __webpack_require__.r(__webpack_exports__);
  2178. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. /* harmony default export */ __webpack_exports__["default"] = ({
  2197. components: {
  2198. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2199. },
  2200. props: {
  2201. populateWith: {
  2202. type: Object,
  2203. require: true
  2204. },
  2205. modalId: {
  2206. type: String,
  2207. require: true
  2208. },
  2209. noteType: {
  2210. type: Number
  2211. },
  2212. noteUser: {
  2213. type: String
  2214. },
  2215. woid: {
  2216. type: Number
  2217. }
  2218. },
  2219. data: function data() {
  2220. return {
  2221. note: JSON.parse(JSON.stringify(this.populateWith))
  2222. };
  2223. },
  2224. methods: {
  2225. updateNote: function updateNote(note) {
  2226. var _this = this;
  2227. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2228. _this.hideModal();
  2229. });
  2230. },
  2231. hideModal: function hideModal() {
  2232. $('#' + this.modalId).modal('hide');
  2233. }
  2234. }
  2235. });
  2236. /***/ }),
  2237. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2238. /*!****************************************************************************************************************************************************************!*\
  2239. !*** ./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& ***!
  2240. \****************************************************************************************************************************************************************/
  2241. /*! exports provided: default */
  2242. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2243. "use strict";
  2244. __webpack_require__.r(__webpack_exports__);
  2245. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2246. /* harmony import */ var _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2247. //
  2248. //
  2249. //
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. //
  2266. //
  2267. //
  2268. //
  2269. //
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. /* harmony default export */ __webpack_exports__["default"] = ({
  2286. components: {
  2287. NoteFormModal: _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2288. },
  2289. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2290. props: {
  2291. notes: {
  2292. type: Array,
  2293. "default": []
  2294. },
  2295. authusername: {
  2296. type: String,
  2297. required: true
  2298. },
  2299. noteType: {
  2300. type: Number,
  2301. required: true
  2302. },
  2303. woid: {
  2304. type: String,
  2305. required: true
  2306. }
  2307. },
  2308. data: function data() {
  2309. return {
  2310. newNote: {
  2311. notetype: this.noteType,
  2312. thenote: '',
  2313. noteuser: this.authusername,
  2314. woid: this.woid
  2315. }
  2316. };
  2317. },
  2318. computed: {
  2319. noteOrders: function noteOrders() {
  2320. return this.getNoteOrders(this.notes);
  2321. }
  2322. },
  2323. methods: {
  2324. createNote: function createNote() {
  2325. var _this = this;
  2326. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2327. $('#note' + _this.noteType + 'add').collapse('hide');
  2328. _this.newNote.thenote = '';
  2329. });
  2330. },
  2331. getNoteOrders: function getNoteOrders(notes) {
  2332. var noteOrders = [];
  2333. notes.forEach(function (note, index) {
  2334. if (index === 0) {
  2335. noteOrders[index] = 'order-first';
  2336. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2337. if (noteOrders[index - 1] === 'order-first') {
  2338. noteOrders[index] = 'order-last';
  2339. } else {
  2340. noteOrders[index] = 'order-first';
  2341. }
  2342. } else {
  2343. noteOrders[index] = noteOrders[index - 1];
  2344. }
  2345. });
  2346. return noteOrders;
  2347. }
  2348. }
  2349. });
  2350. /***/ }),
  2351. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2352. /*!**************************************************************************************************************************************************************************!*\
  2353. !*** ./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& ***!
  2354. \**************************************************************************************************************************************************************************/
  2355. /*! exports provided: default */
  2356. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2357. "use strict";
  2358. __webpack_require__.r(__webpack_exports__);
  2359. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  2360. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. //
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. //
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. /* harmony default export */ __webpack_exports__["default"] = ({
  2395. components: {
  2396. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  2397. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  2398. },
  2399. props: {
  2400. populateWith: {
  2401. type: Object,
  2402. required: true
  2403. },
  2404. storeList: {
  2405. type: Object,
  2406. required: true
  2407. },
  2408. modalId: {
  2409. type: String,
  2410. required: true
  2411. }
  2412. },
  2413. data: function data() {
  2414. return {
  2415. // Copies object from prop, so it doesn't mutate the object
  2416. // from the parent component. Parent component will be updated via
  2417. // Websocket if updateWorkOrder is successful.
  2418. data: JSON.parse(JSON.stringify(this.populateWith)),
  2419. id: this.modalId,
  2420. store: {},
  2421. errors: []
  2422. };
  2423. },
  2424. methods: {
  2425. updateWorkOrder: function updateWorkOrder() {
  2426. var _this = this;
  2427. this.data.storeid = this.store.id;
  2428. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2429. $('#workordereditModal').modal('hide');
  2430. })["catch"](function (error) {
  2431. _this.errors = JSON.parse(error.response.request.response).errors;
  2432. });
  2433. }
  2434. },
  2435. mounted: function mounted() {
  2436. this.store = {
  2437. 'id': this.data.storeid,
  2438. 'name': this.storeList[this.data.storeid]
  2439. };
  2440. },
  2441. // This was originally here because the populateWith info would originally
  2442. // not necessarily be loaded when this component was mounted. That is no
  2443. // longer the case as I now don't render the parent component until the
  2444. // ajax request is finised. The watch statements are still here to cover
  2445. // the case where someone else updates the populateWith values while
  2446. // someone is editing, although it probably should be edited so it doesn't
  2447. // immediately overwrite the unsaved edits of the current user.
  2448. watch: {
  2449. populateWith: function populateWith(value) {
  2450. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2451. this.store = {
  2452. 'id': this.data.storeid,
  2453. 'name': this.storeList[this.data.storeid]
  2454. };
  2455. },
  2456. storeList: function storeList(value) {
  2457. this.store = {
  2458. 'id': this.data.storeid,
  2459. 'name': this.storeList[this.data.storeid]
  2460. };
  2461. }
  2462. }
  2463. });
  2464. /***/ }),
  2465. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2466. /*!************************************************************************************************************************************************************************!*\
  2467. !*** ./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& ***!
  2468. \************************************************************************************************************************************************************************/
  2469. /*! exports provided: default */
  2470. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2471. "use strict";
  2472. __webpack_require__.r(__webpack_exports__);
  2473. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2474. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2475. //
  2476. //
  2477. //
  2478. //
  2479. //
  2480. //
  2481. //
  2482. //
  2483. //
  2484. //
  2485. //
  2486. //
  2487. //
  2488. //
  2489. //
  2490. //
  2491. //
  2492. //
  2493. //
  2494. //
  2495. /* harmony default export */ __webpack_exports__["default"] = ({
  2496. components: {
  2497. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2498. },
  2499. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2500. props: ['workOrder', 'stores'],
  2501. computed: {
  2502. storeList: function storeList() {
  2503. var list = {};
  2504. Object.values(this.stores).map(function (val) {
  2505. list[val.storeid] = val.storesname;
  2506. });
  2507. return list;
  2508. }
  2509. }
  2510. });
  2511. /***/ }),
  2512. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2513. /*!*********************************************************************************************************************************************************!*\
  2514. !*** ./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& ***!
  2515. \*********************************************************************************************************************************************************/
  2516. /*! exports provided: default */
  2517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2518. "use strict";
  2519. __webpack_require__.r(__webpack_exports__);
  2520. //
  2521. //
  2522. //
  2523. //
  2524. //
  2525. //
  2526. //
  2527. //
  2528. //
  2529. //
  2530. //
  2531. //
  2532. //
  2533. //
  2534. //
  2535. //
  2536. //
  2537. //
  2538. //
  2539. //
  2540. //
  2541. //
  2542. //
  2543. //
  2544. //
  2545. //
  2546. //
  2547. //
  2548. //
  2549. //
  2550. //
  2551. //
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. //
  2559. //
  2560. //
  2561. //
  2562. //
  2563. //
  2564. //
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. //
  2571. //
  2572. //
  2573. //
  2574. //
  2575. //
  2576. //
  2577. //
  2578. //
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. /* harmony default export */ __webpack_exports__["default"] = ({
  2592. data: function data() {
  2593. return {
  2594. isLoggedIn: null,
  2595. username: null
  2596. };
  2597. },
  2598. mounted: function mounted() {
  2599. this.isLoggedIn = localStorage.getItem('jwt');
  2600. this.username = localStorage.getItem('user');
  2601. }
  2602. });
  2603. /***/ }),
  2604. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2605. /*!***************************************************************************************************************************************************************!*\
  2606. !*** ./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& ***!
  2607. \***************************************************************************************************************************************************************/
  2608. /*! exports provided: default */
  2609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2610. "use strict";
  2611. __webpack_require__.r(__webpack_exports__);
  2612. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2640. components: {
  2641. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2642. },
  2643. data: function data() {
  2644. return {
  2645. workOrders: [],
  2646. isLoading: true
  2647. };
  2648. },
  2649. mounted: function mounted() {
  2650. var _this = this;
  2651. var token = localStorage.getItem('jwt');
  2652. var user = localStorage.getItem('user');
  2653. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2654. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2655. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2656. _this.workOrders = response.data;
  2657. _this.isLoading = false;
  2658. })["catch"](function (error) {
  2659. console.log(error);
  2660. });
  2661. },
  2662. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2663. if (!localStorage.getItem('jwt')) {
  2664. return next('login');
  2665. }
  2666. next();
  2667. }
  2668. });
  2669. /***/ }),
  2670. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2671. /*!***********************************************************************************************************************************************************!*\
  2672. !*** ./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& ***!
  2673. \***********************************************************************************************************************************************************/
  2674. /*! exports provided: default */
  2675. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2676. "use strict";
  2677. __webpack_require__.r(__webpack_exports__);
  2678. //
  2679. //
  2680. //
  2681. //
  2682. //
  2683. //
  2684. //
  2685. //
  2686. //
  2687. //
  2688. //
  2689. //
  2690. //
  2691. //
  2692. //
  2693. //
  2694. //
  2695. //
  2696. //
  2697. //
  2698. //
  2699. //
  2700. //
  2701. //
  2702. //
  2703. //
  2704. //
  2705. //
  2706. //
  2707. //
  2708. //
  2709. //
  2710. //
  2711. //
  2712. //
  2713. //
  2714. //
  2715. //
  2716. //
  2717. /* harmony default export */ __webpack_exports__["default"] = ({
  2718. data: function data() {
  2719. return {
  2720. username: "",
  2721. password: ""
  2722. };
  2723. },
  2724. methods: {
  2725. handleSubmit: function handleSubmit(e) {
  2726. var _this = this;
  2727. e.preventDefault();
  2728. if (this.password.length > 0) {
  2729. axios.post('api/login', {
  2730. username: this.username,
  2731. password: this.password
  2732. }).then(function (response) {
  2733. localStorage.setItem('user', response.data.success.username);
  2734. localStorage.setItem('jwt', response.data.success.token);
  2735. if (localStorage.getItem('jwt') != null) {
  2736. _this.$router.go('/dashboard');
  2737. }
  2738. })["catch"](function (error) {
  2739. console.error(error);
  2740. });
  2741. }
  2742. }
  2743. },
  2744. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2745. if (localStorage.getItem('jwt')) {
  2746. return next('dashboard');
  2747. }
  2748. next();
  2749. }
  2750. });
  2751. /***/ }),
  2752. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2753. /*!*************************************************************************************************************************************************************!*\
  2754. !*** ./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& ***!
  2755. \*************************************************************************************************************************************************************/
  2756. /*! exports provided: default */
  2757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2758. "use strict";
  2759. __webpack_require__.r(__webpack_exports__);
  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. //
  2791. //
  2792. //
  2793. //
  2794. //
  2795. //
  2796. //
  2797. //
  2798. //
  2799. //
  2800. //
  2801. //
  2802. //
  2803. //
  2804. //
  2805. //
  2806. //
  2807. //
  2808. //
  2809. //
  2810. //
  2811. /* harmony default export */ __webpack_exports__["default"] = ({});
  2812. /***/ }),
  2813. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2814. /*!***************************************************************************************************************************************************************!*\
  2815. !*** ./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& ***!
  2816. \***************************************************************************************************************************************************************/
  2817. /*! exports provided: default */
  2818. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2819. "use strict";
  2820. __webpack_require__.r(__webpack_exports__);
  2821. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2822. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2823. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2824. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2825. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  2826. //
  2827. //
  2828. //
  2829. //
  2830. //
  2831. //
  2832. //
  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. //
  2885. //
  2886. //
  2887. //
  2888. //
  2889. //
  2890. //
  2891. //
  2892. //
  2893. //
  2894. //
  2895. //
  2896. //
  2897. //
  2898. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2928. components: {
  2929. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2930. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2931. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2932. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  2933. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  2934. },
  2935. props: {
  2936. id: {
  2937. type: String,
  2938. required: true
  2939. }
  2940. },
  2941. data: function data() {
  2942. return {
  2943. workOrder: {},
  2944. asset: {},
  2945. stores: {},
  2946. credentials: {},
  2947. credentialDescriptions: {},
  2948. workOrderNotes: [],
  2949. woLoading: true,
  2950. assetLoading: true,
  2951. storesLoading: true,
  2952. credentialsLoading: true,
  2953. credentialDescriptionsLoading: true,
  2954. workOrderNotesLoading: true,
  2955. authUser: localStorage.getItem('user')
  2956. };
  2957. },
  2958. computed: {
  2959. publicNotes: function publicNotes() {
  2960. var notes = [];
  2961. notes = this.workOrderNotes.filter(function (note) {
  2962. return note.notetype === 0;
  2963. });
  2964. return notes;
  2965. },
  2966. privateNotes: function privateNotes() {
  2967. var notes = [];
  2968. notes = this.workOrderNotes.filter(function (note) {
  2969. return note.notetype === 1;
  2970. });
  2971. return notes;
  2972. }
  2973. },
  2974. mounted: function mounted() {
  2975. var _this = this;
  2976. // Get authentication info from current user from local storage
  2977. var token = localStorage.getItem('jwt');
  2978. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  2979. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2980. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  2981. axios.get('/api/workorders/' + this.id).then(function (response) {
  2982. _this.workOrder = response.data;
  2983. _this.woLoading = false;
  2984. })["catch"](function (error) {
  2985. console.log(error);
  2986. }); // Get list of stores from API
  2987. axios.get('/api/stores/').then(function (response) {
  2988. _this.stores = response.data;
  2989. _this.storesLoading = false;
  2990. })["catch"](function (error) {
  2991. console.log(error);
  2992. }); // Get Asset from API (will most likely be replaced with list of assets
  2993. // in the future. Current each WO can only have one but that is likely
  2994. // to change)
  2995. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  2996. _this.asset = response.data;
  2997. _this.assetLoading = false; // Get Credentials for this asset. May be relocated to be part of asset
  2998. // Component when WOs can have more than one asset.
  2999. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3000. _this.credentials = response.data;
  3001. _this.credentialsLoading = false;
  3002. })["catch"](function (error) {
  3003. console.log(error);
  3004. }); // Get default list of Credential Descriptions. May be relocated along with
  3005. // the above.
  3006. axios.get('/api/credentials/descriptions').then(function (response) {
  3007. _this.credentialDescriptions = response.data;
  3008. _this.credentialDescriptionsLoading = false;
  3009. })["catch"](function (error) {
  3010. console.log(error);
  3011. });
  3012. })["catch"](function (error) {
  3013. console.log(error);
  3014. });
  3015. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3016. _this.workOrderNotes = response.data;
  3017. _this.workOrderNotesLoading = false;
  3018. })["catch"](function (error) {
  3019. console.log(error);
  3020. });
  3021. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3022. _this.workOrder = e.data;
  3023. });
  3024. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3025. _this.workOrderNotes.push(e.note);
  3026. }).listen('WorkOrderNoteUpdated', function (e) {
  3027. var index = _this.workOrderNotes.findIndex(function (note) {
  3028. return note.noteid === e.note.noteid;
  3029. }); // Note has to be edited this way, or else Vue cannot
  3030. // see it to recompute the computed values.
  3031. _this.workOrderNotes.splice(index, 1, e.note);
  3032. }).listen('WorkOrderNoteDeleted', function (e) {
  3033. var index = _this.notes.findIndex(function (note) {
  3034. return note.noteid === e.noteid;
  3035. });
  3036. _this.notes.splice(index, 1);
  3037. });
  3038. }
  3039. });
  3040. /***/ }),
  3041. /***/ "./node_modules/base64-js/index.js":
  3042. /*!*****************************************!*\
  3043. !*** ./node_modules/base64-js/index.js ***!
  3044. \*****************************************/
  3045. /*! no static exports found */
  3046. /***/ (function(module, exports, __webpack_require__) {
  3047. "use strict";
  3048. exports.byteLength = byteLength
  3049. exports.toByteArray = toByteArray
  3050. exports.fromByteArray = fromByteArray
  3051. var lookup = []
  3052. var revLookup = []
  3053. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3054. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3055. for (var i = 0, len = code.length; i < len; ++i) {
  3056. lookup[i] = code[i]
  3057. revLookup[code.charCodeAt(i)] = i
  3058. }
  3059. // Support decoding URL-safe base64 strings, as Node.js does.
  3060. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3061. revLookup['-'.charCodeAt(0)] = 62
  3062. revLookup['_'.charCodeAt(0)] = 63
  3063. function getLens (b64) {
  3064. var len = b64.length
  3065. if (len % 4 > 0) {
  3066. throw new Error('Invalid string. Length must be a multiple of 4')
  3067. }
  3068. // Trim off extra bytes after placeholder bytes are found
  3069. // See: https://github.com/beatgammit/base64-js/issues/42
  3070. var validLen = b64.indexOf('=')
  3071. if (validLen === -1) validLen = len
  3072. var placeHoldersLen = validLen === len
  3073. ? 0
  3074. : 4 - (validLen % 4)
  3075. return [validLen, placeHoldersLen]
  3076. }
  3077. // base64 is 4/3 + up to two characters of the original data
  3078. function byteLength (b64) {
  3079. var lens = getLens(b64)
  3080. var validLen = lens[0]
  3081. var placeHoldersLen = lens[1]
  3082. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3083. }
  3084. function _byteLength (b64, validLen, placeHoldersLen) {
  3085. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3086. }
  3087. function toByteArray (b64) {
  3088. var tmp
  3089. var lens = getLens(b64)
  3090. var validLen = lens[0]
  3091. var placeHoldersLen = lens[1]
  3092. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3093. var curByte = 0
  3094. // if there are placeholders, only get up to the last complete 4 chars
  3095. var len = placeHoldersLen > 0
  3096. ? validLen - 4
  3097. : validLen
  3098. var i
  3099. for (i = 0; i < len; i += 4) {
  3100. tmp =
  3101. (revLookup[b64.charCodeAt(i)] << 18) |
  3102. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3103. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3104. revLookup[b64.charCodeAt(i + 3)]
  3105. arr[curByte++] = (tmp >> 16) & 0xFF
  3106. arr[curByte++] = (tmp >> 8) & 0xFF
  3107. arr[curByte++] = tmp & 0xFF
  3108. }
  3109. if (placeHoldersLen === 2) {
  3110. tmp =
  3111. (revLookup[b64.charCodeAt(i)] << 2) |
  3112. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3113. arr[curByte++] = tmp & 0xFF
  3114. }
  3115. if (placeHoldersLen === 1) {
  3116. tmp =
  3117. (revLookup[b64.charCodeAt(i)] << 10) |
  3118. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3119. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3120. arr[curByte++] = (tmp >> 8) & 0xFF
  3121. arr[curByte++] = tmp & 0xFF
  3122. }
  3123. return arr
  3124. }
  3125. function tripletToBase64 (num) {
  3126. return lookup[num >> 18 & 0x3F] +
  3127. lookup[num >> 12 & 0x3F] +
  3128. lookup[num >> 6 & 0x3F] +
  3129. lookup[num & 0x3F]
  3130. }
  3131. function encodeChunk (uint8, start, end) {
  3132. var tmp
  3133. var output = []
  3134. for (var i = start; i < end; i += 3) {
  3135. tmp =
  3136. ((uint8[i] << 16) & 0xFF0000) +
  3137. ((uint8[i + 1] << 8) & 0xFF00) +
  3138. (uint8[i + 2] & 0xFF)
  3139. output.push(tripletToBase64(tmp))
  3140. }
  3141. return output.join('')
  3142. }
  3143. function fromByteArray (uint8) {
  3144. var tmp
  3145. var len = uint8.length
  3146. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3147. var parts = []
  3148. var maxChunkLength = 16383 // must be multiple of 3
  3149. // go through the array every three bytes, we'll deal with trailing stuff later
  3150. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3151. parts.push(encodeChunk(
  3152. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3153. ))
  3154. }
  3155. // pad the end with zeros, but make sure to not forget the extra bytes
  3156. if (extraBytes === 1) {
  3157. tmp = uint8[len - 1]
  3158. parts.push(
  3159. lookup[tmp >> 2] +
  3160. lookup[(tmp << 4) & 0x3F] +
  3161. '=='
  3162. )
  3163. } else if (extraBytes === 2) {
  3164. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3165. parts.push(
  3166. lookup[tmp >> 10] +
  3167. lookup[(tmp >> 4) & 0x3F] +
  3168. lookup[(tmp << 2) & 0x3F] +
  3169. '='
  3170. )
  3171. }
  3172. return parts.join('')
  3173. }
  3174. /***/ }),
  3175. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3176. /*!*****************************************************!*\
  3177. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3178. \*****************************************************/
  3179. /*! no static exports found */
  3180. /***/ (function(module, exports, __webpack_require__) {
  3181. /*!
  3182. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3183. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3184. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3185. */
  3186. (function (global, factory) {
  3187. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3188. undefined;
  3189. }(this, (function (exports, $, Popper) { 'use strict';
  3190. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3191. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3192. function _defineProperties(target, props) {
  3193. for (var i = 0; i < props.length; i++) {
  3194. var descriptor = props[i];
  3195. descriptor.enumerable = descriptor.enumerable || false;
  3196. descriptor.configurable = true;
  3197. if ("value" in descriptor) descriptor.writable = true;
  3198. Object.defineProperty(target, descriptor.key, descriptor);
  3199. }
  3200. }
  3201. function _createClass(Constructor, protoProps, staticProps) {
  3202. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3203. if (staticProps) _defineProperties(Constructor, staticProps);
  3204. return Constructor;
  3205. }
  3206. function _defineProperty(obj, key, value) {
  3207. if (key in obj) {
  3208. Object.defineProperty(obj, key, {
  3209. value: value,
  3210. enumerable: true,
  3211. configurable: true,
  3212. writable: true
  3213. });
  3214. } else {
  3215. obj[key] = value;
  3216. }
  3217. return obj;
  3218. }
  3219. function ownKeys(object, enumerableOnly) {
  3220. var keys = Object.keys(object);
  3221. if (Object.getOwnPropertySymbols) {
  3222. var symbols = Object.getOwnPropertySymbols(object);
  3223. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3224. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3225. });
  3226. keys.push.apply(keys, symbols);
  3227. }
  3228. return keys;
  3229. }
  3230. function _objectSpread2(target) {
  3231. for (var i = 1; i < arguments.length; i++) {
  3232. var source = arguments[i] != null ? arguments[i] : {};
  3233. if (i % 2) {
  3234. ownKeys(Object(source), true).forEach(function (key) {
  3235. _defineProperty(target, key, source[key]);
  3236. });
  3237. } else if (Object.getOwnPropertyDescriptors) {
  3238. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3239. } else {
  3240. ownKeys(Object(source)).forEach(function (key) {
  3241. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3242. });
  3243. }
  3244. }
  3245. return target;
  3246. }
  3247. function _inheritsLoose(subClass, superClass) {
  3248. subClass.prototype = Object.create(superClass.prototype);
  3249. subClass.prototype.constructor = subClass;
  3250. subClass.__proto__ = superClass;
  3251. }
  3252. /**
  3253. * --------------------------------------------------------------------------
  3254. * Bootstrap (v4.4.1): util.js
  3255. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3256. * --------------------------------------------------------------------------
  3257. */
  3258. /**
  3259. * ------------------------------------------------------------------------
  3260. * Private TransitionEnd Helpers
  3261. * ------------------------------------------------------------------------
  3262. */
  3263. var TRANSITION_END = 'transitionend';
  3264. var MAX_UID = 1000000;
  3265. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3266. function toType(obj) {
  3267. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3268. }
  3269. function getSpecialTransitionEndEvent() {
  3270. return {
  3271. bindType: TRANSITION_END,
  3272. delegateType: TRANSITION_END,
  3273. handle: function handle(event) {
  3274. if ($(event.target).is(this)) {
  3275. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3276. }
  3277. return undefined; // eslint-disable-line no-undefined
  3278. }
  3279. };
  3280. }
  3281. function transitionEndEmulator(duration) {
  3282. var _this = this;
  3283. var called = false;
  3284. $(this).one(Util.TRANSITION_END, function () {
  3285. called = true;
  3286. });
  3287. setTimeout(function () {
  3288. if (!called) {
  3289. Util.triggerTransitionEnd(_this);
  3290. }
  3291. }, duration);
  3292. return this;
  3293. }
  3294. function setTransitionEndSupport() {
  3295. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3296. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3297. }
  3298. /**
  3299. * --------------------------------------------------------------------------
  3300. * Public Util Api
  3301. * --------------------------------------------------------------------------
  3302. */
  3303. var Util = {
  3304. TRANSITION_END: 'bsTransitionEnd',
  3305. getUID: function getUID(prefix) {
  3306. do {
  3307. // eslint-disable-next-line no-bitwise
  3308. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3309. } while (document.getElementById(prefix));
  3310. return prefix;
  3311. },
  3312. getSelectorFromElement: function getSelectorFromElement(element) {
  3313. var selector = element.getAttribute('data-target');
  3314. if (!selector || selector === '#') {
  3315. var hrefAttr = element.getAttribute('href');
  3316. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3317. }
  3318. try {
  3319. return document.querySelector(selector) ? selector : null;
  3320. } catch (err) {
  3321. return null;
  3322. }
  3323. },
  3324. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3325. if (!element) {
  3326. return 0;
  3327. } // Get transition-duration of the element
  3328. var transitionDuration = $(element).css('transition-duration');
  3329. var transitionDelay = $(element).css('transition-delay');
  3330. var floatTransitionDuration = parseFloat(transitionDuration);
  3331. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3332. if (!floatTransitionDuration && !floatTransitionDelay) {
  3333. return 0;
  3334. } // If multiple durations are defined, take the first
  3335. transitionDuration = transitionDuration.split(',')[0];
  3336. transitionDelay = transitionDelay.split(',')[0];
  3337. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3338. },
  3339. reflow: function reflow(element) {
  3340. return element.offsetHeight;
  3341. },
  3342. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3343. $(element).trigger(TRANSITION_END);
  3344. },
  3345. // TODO: Remove in v5
  3346. supportsTransitionEnd: function supportsTransitionEnd() {
  3347. return Boolean(TRANSITION_END);
  3348. },
  3349. isElement: function isElement(obj) {
  3350. return (obj[0] || obj).nodeType;
  3351. },
  3352. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3353. for (var property in configTypes) {
  3354. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3355. var expectedTypes = configTypes[property];
  3356. var value = config[property];
  3357. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3358. if (!new RegExp(expectedTypes).test(valueType)) {
  3359. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3360. }
  3361. }
  3362. }
  3363. },
  3364. findShadowRoot: function findShadowRoot(element) {
  3365. if (!document.documentElement.attachShadow) {
  3366. return null;
  3367. } // Can find the shadow root otherwise it'll return the document
  3368. if (typeof element.getRootNode === 'function') {
  3369. var root = element.getRootNode();
  3370. return root instanceof ShadowRoot ? root : null;
  3371. }
  3372. if (element instanceof ShadowRoot) {
  3373. return element;
  3374. } // when we don't find a shadow root
  3375. if (!element.parentNode) {
  3376. return null;
  3377. }
  3378. return Util.findShadowRoot(element.parentNode);
  3379. },
  3380. jQueryDetection: function jQueryDetection() {
  3381. if (typeof $ === 'undefined') {
  3382. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3383. }
  3384. var version = $.fn.jquery.split(' ')[0].split('.');
  3385. var minMajor = 1;
  3386. var ltMajor = 2;
  3387. var minMinor = 9;
  3388. var minPatch = 1;
  3389. var maxMajor = 4;
  3390. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3391. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3392. }
  3393. }
  3394. };
  3395. Util.jQueryDetection();
  3396. setTransitionEndSupport();
  3397. /**
  3398. * ------------------------------------------------------------------------
  3399. * Constants
  3400. * ------------------------------------------------------------------------
  3401. */
  3402. var NAME = 'alert';
  3403. var VERSION = '4.4.1';
  3404. var DATA_KEY = 'bs.alert';
  3405. var EVENT_KEY = "." + DATA_KEY;
  3406. var DATA_API_KEY = '.data-api';
  3407. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3408. var Selector = {
  3409. DISMISS: '[data-dismiss="alert"]'
  3410. };
  3411. var Event = {
  3412. CLOSE: "close" + EVENT_KEY,
  3413. CLOSED: "closed" + EVENT_KEY,
  3414. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3415. };
  3416. var ClassName = {
  3417. ALERT: 'alert',
  3418. FADE: 'fade',
  3419. SHOW: 'show'
  3420. };
  3421. /**
  3422. * ------------------------------------------------------------------------
  3423. * Class Definition
  3424. * ------------------------------------------------------------------------
  3425. */
  3426. var Alert =
  3427. /*#__PURE__*/
  3428. function () {
  3429. function Alert(element) {
  3430. this._element = element;
  3431. } // Getters
  3432. var _proto = Alert.prototype;
  3433. // Public
  3434. _proto.close = function close(element) {
  3435. var rootElement = this._element;
  3436. if (element) {
  3437. rootElement = this._getRootElement(element);
  3438. }
  3439. var customEvent = this._triggerCloseEvent(rootElement);
  3440. if (customEvent.isDefaultPrevented()) {
  3441. return;
  3442. }
  3443. this._removeElement(rootElement);
  3444. };
  3445. _proto.dispose = function dispose() {
  3446. $.removeData(this._element, DATA_KEY);
  3447. this._element = null;
  3448. } // Private
  3449. ;
  3450. _proto._getRootElement = function _getRootElement(element) {
  3451. var selector = Util.getSelectorFromElement(element);
  3452. var parent = false;
  3453. if (selector) {
  3454. parent = document.querySelector(selector);
  3455. }
  3456. if (!parent) {
  3457. parent = $(element).closest("." + ClassName.ALERT)[0];
  3458. }
  3459. return parent;
  3460. };
  3461. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3462. var closeEvent = $.Event(Event.CLOSE);
  3463. $(element).trigger(closeEvent);
  3464. return closeEvent;
  3465. };
  3466. _proto._removeElement = function _removeElement(element) {
  3467. var _this = this;
  3468. $(element).removeClass(ClassName.SHOW);
  3469. if (!$(element).hasClass(ClassName.FADE)) {
  3470. this._destroyElement(element);
  3471. return;
  3472. }
  3473. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3474. $(element).one(Util.TRANSITION_END, function (event) {
  3475. return _this._destroyElement(element, event);
  3476. }).emulateTransitionEnd(transitionDuration);
  3477. };
  3478. _proto._destroyElement = function _destroyElement(element) {
  3479. $(element).detach().trigger(Event.CLOSED).remove();
  3480. } // Static
  3481. ;
  3482. Alert._jQueryInterface = function _jQueryInterface(config) {
  3483. return this.each(function () {
  3484. var $element = $(this);
  3485. var data = $element.data(DATA_KEY);
  3486. if (!data) {
  3487. data = new Alert(this);
  3488. $element.data(DATA_KEY, data);
  3489. }
  3490. if (config === 'close') {
  3491. data[config](this);
  3492. }
  3493. });
  3494. };
  3495. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3496. return function (event) {
  3497. if (event) {
  3498. event.preventDefault();
  3499. }
  3500. alertInstance.close(this);
  3501. };
  3502. };
  3503. _createClass(Alert, null, [{
  3504. key: "VERSION",
  3505. get: function get() {
  3506. return VERSION;
  3507. }
  3508. }]);
  3509. return Alert;
  3510. }();
  3511. /**
  3512. * ------------------------------------------------------------------------
  3513. * Data Api implementation
  3514. * ------------------------------------------------------------------------
  3515. */
  3516. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3517. /**
  3518. * ------------------------------------------------------------------------
  3519. * jQuery
  3520. * ------------------------------------------------------------------------
  3521. */
  3522. $.fn[NAME] = Alert._jQueryInterface;
  3523. $.fn[NAME].Constructor = Alert;
  3524. $.fn[NAME].noConflict = function () {
  3525. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3526. return Alert._jQueryInterface;
  3527. };
  3528. /**
  3529. * ------------------------------------------------------------------------
  3530. * Constants
  3531. * ------------------------------------------------------------------------
  3532. */
  3533. var NAME$1 = 'button';
  3534. var VERSION$1 = '4.4.1';
  3535. var DATA_KEY$1 = 'bs.button';
  3536. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3537. var DATA_API_KEY$1 = '.data-api';
  3538. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3539. var ClassName$1 = {
  3540. ACTIVE: 'active',
  3541. BUTTON: 'btn',
  3542. FOCUS: 'focus'
  3543. };
  3544. var Selector$1 = {
  3545. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3546. DATA_TOGGLES: '[data-toggle="buttons"]',
  3547. DATA_TOGGLE: '[data-toggle="button"]',
  3548. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3549. INPUT: 'input:not([type="hidden"])',
  3550. ACTIVE: '.active',
  3551. BUTTON: '.btn'
  3552. };
  3553. var Event$1 = {
  3554. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3555. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3556. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3557. };
  3558. /**
  3559. * ------------------------------------------------------------------------
  3560. * Class Definition
  3561. * ------------------------------------------------------------------------
  3562. */
  3563. var Button =
  3564. /*#__PURE__*/
  3565. function () {
  3566. function Button(element) {
  3567. this._element = element;
  3568. } // Getters
  3569. var _proto = Button.prototype;
  3570. // Public
  3571. _proto.toggle = function toggle() {
  3572. var triggerChangeEvent = true;
  3573. var addAriaPressed = true;
  3574. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3575. if (rootElement) {
  3576. var input = this._element.querySelector(Selector$1.INPUT);
  3577. if (input) {
  3578. if (input.type === 'radio') {
  3579. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3580. triggerChangeEvent = false;
  3581. } else {
  3582. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3583. if (activeElement) {
  3584. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3585. }
  3586. }
  3587. } else if (input.type === 'checkbox') {
  3588. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3589. triggerChangeEvent = false;
  3590. }
  3591. } else {
  3592. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3593. triggerChangeEvent = false;
  3594. }
  3595. if (triggerChangeEvent) {
  3596. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3597. $(input).trigger('change');
  3598. }
  3599. input.focus();
  3600. addAriaPressed = false;
  3601. }
  3602. }
  3603. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3604. if (addAriaPressed) {
  3605. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3606. }
  3607. if (triggerChangeEvent) {
  3608. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3609. }
  3610. }
  3611. };
  3612. _proto.dispose = function dispose() {
  3613. $.removeData(this._element, DATA_KEY$1);
  3614. this._element = null;
  3615. } // Static
  3616. ;
  3617. Button._jQueryInterface = function _jQueryInterface(config) {
  3618. return this.each(function () {
  3619. var data = $(this).data(DATA_KEY$1);
  3620. if (!data) {
  3621. data = new Button(this);
  3622. $(this).data(DATA_KEY$1, data);
  3623. }
  3624. if (config === 'toggle') {
  3625. data[config]();
  3626. }
  3627. });
  3628. };
  3629. _createClass(Button, null, [{
  3630. key: "VERSION",
  3631. get: function get() {
  3632. return VERSION$1;
  3633. }
  3634. }]);
  3635. return Button;
  3636. }();
  3637. /**
  3638. * ------------------------------------------------------------------------
  3639. * Data Api implementation
  3640. * ------------------------------------------------------------------------
  3641. */
  3642. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3643. var button = event.target;
  3644. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3645. button = $(button).closest(Selector$1.BUTTON)[0];
  3646. }
  3647. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3648. event.preventDefault(); // work around Firefox bug #1540995
  3649. } else {
  3650. var inputBtn = button.querySelector(Selector$1.INPUT);
  3651. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3652. event.preventDefault(); // work around Firefox bug #1540995
  3653. return;
  3654. }
  3655. Button._jQueryInterface.call($(button), 'toggle');
  3656. }
  3657. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3658. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3659. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3660. });
  3661. $(window).on(Event$1.LOAD_DATA_API, function () {
  3662. // ensure correct active class is set to match the controls' actual values/states
  3663. // find all checkboxes/readio buttons inside data-toggle groups
  3664. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3665. for (var i = 0, len = buttons.length; i < len; i++) {
  3666. var button = buttons[i];
  3667. var input = button.querySelector(Selector$1.INPUT);
  3668. if (input.checked || input.hasAttribute('checked')) {
  3669. button.classList.add(ClassName$1.ACTIVE);
  3670. } else {
  3671. button.classList.remove(ClassName$1.ACTIVE);
  3672. }
  3673. } // find all button toggles
  3674. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3675. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3676. var _button = buttons[_i];
  3677. if (_button.getAttribute('aria-pressed') === 'true') {
  3678. _button.classList.add(ClassName$1.ACTIVE);
  3679. } else {
  3680. _button.classList.remove(ClassName$1.ACTIVE);
  3681. }
  3682. }
  3683. });
  3684. /**
  3685. * ------------------------------------------------------------------------
  3686. * jQuery
  3687. * ------------------------------------------------------------------------
  3688. */
  3689. $.fn[NAME$1] = Button._jQueryInterface;
  3690. $.fn[NAME$1].Constructor = Button;
  3691. $.fn[NAME$1].noConflict = function () {
  3692. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3693. return Button._jQueryInterface;
  3694. };
  3695. /**
  3696. * ------------------------------------------------------------------------
  3697. * Constants
  3698. * ------------------------------------------------------------------------
  3699. */
  3700. var NAME$2 = 'carousel';
  3701. var VERSION$2 = '4.4.1';
  3702. var DATA_KEY$2 = 'bs.carousel';
  3703. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3704. var DATA_API_KEY$2 = '.data-api';
  3705. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3706. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3707. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3708. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3709. var SWIPE_THRESHOLD = 40;
  3710. var Default = {
  3711. interval: 5000,
  3712. keyboard: true,
  3713. slide: false,
  3714. pause: 'hover',
  3715. wrap: true,
  3716. touch: true
  3717. };
  3718. var DefaultType = {
  3719. interval: '(number|boolean)',
  3720. keyboard: 'boolean',
  3721. slide: '(boolean|string)',
  3722. pause: '(string|boolean)',
  3723. wrap: 'boolean',
  3724. touch: 'boolean'
  3725. };
  3726. var Direction = {
  3727. NEXT: 'next',
  3728. PREV: 'prev',
  3729. LEFT: 'left',
  3730. RIGHT: 'right'
  3731. };
  3732. var Event$2 = {
  3733. SLIDE: "slide" + EVENT_KEY$2,
  3734. SLID: "slid" + EVENT_KEY$2,
  3735. KEYDOWN: "keydown" + EVENT_KEY$2,
  3736. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3737. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3738. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3739. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3740. TOUCHEND: "touchend" + EVENT_KEY$2,
  3741. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3742. POINTERUP: "pointerup" + EVENT_KEY$2,
  3743. DRAG_START: "dragstart" + EVENT_KEY$2,
  3744. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3745. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3746. };
  3747. var ClassName$2 = {
  3748. CAROUSEL: 'carousel',
  3749. ACTIVE: 'active',
  3750. SLIDE: 'slide',
  3751. RIGHT: 'carousel-item-right',
  3752. LEFT: 'carousel-item-left',
  3753. NEXT: 'carousel-item-next',
  3754. PREV: 'carousel-item-prev',
  3755. ITEM: 'carousel-item',
  3756. POINTER_EVENT: 'pointer-event'
  3757. };
  3758. var Selector$2 = {
  3759. ACTIVE: '.active',
  3760. ACTIVE_ITEM: '.active.carousel-item',
  3761. ITEM: '.carousel-item',
  3762. ITEM_IMG: '.carousel-item img',
  3763. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3764. INDICATORS: '.carousel-indicators',
  3765. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3766. DATA_RIDE: '[data-ride="carousel"]'
  3767. };
  3768. var PointerType = {
  3769. TOUCH: 'touch',
  3770. PEN: 'pen'
  3771. };
  3772. /**
  3773. * ------------------------------------------------------------------------
  3774. * Class Definition
  3775. * ------------------------------------------------------------------------
  3776. */
  3777. var Carousel =
  3778. /*#__PURE__*/
  3779. function () {
  3780. function Carousel(element, config) {
  3781. this._items = null;
  3782. this._interval = null;
  3783. this._activeElement = null;
  3784. this._isPaused = false;
  3785. this._isSliding = false;
  3786. this.touchTimeout = null;
  3787. this.touchStartX = 0;
  3788. this.touchDeltaX = 0;
  3789. this._config = this._getConfig(config);
  3790. this._element = element;
  3791. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3792. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3793. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3794. this._addEventListeners();
  3795. } // Getters
  3796. var _proto = Carousel.prototype;
  3797. // Public
  3798. _proto.next = function next() {
  3799. if (!this._isSliding) {
  3800. this._slide(Direction.NEXT);
  3801. }
  3802. };
  3803. _proto.nextWhenVisible = function nextWhenVisible() {
  3804. // Don't call next when the page isn't visible
  3805. // or the carousel or its parent isn't visible
  3806. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3807. this.next();
  3808. }
  3809. };
  3810. _proto.prev = function prev() {
  3811. if (!this._isSliding) {
  3812. this._slide(Direction.PREV);
  3813. }
  3814. };
  3815. _proto.pause = function pause(event) {
  3816. if (!event) {
  3817. this._isPaused = true;
  3818. }
  3819. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3820. Util.triggerTransitionEnd(this._element);
  3821. this.cycle(true);
  3822. }
  3823. clearInterval(this._interval);
  3824. this._interval = null;
  3825. };
  3826. _proto.cycle = function cycle(event) {
  3827. if (!event) {
  3828. this._isPaused = false;
  3829. }
  3830. if (this._interval) {
  3831. clearInterval(this._interval);
  3832. this._interval = null;
  3833. }
  3834. if (this._config.interval && !this._isPaused) {
  3835. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3836. }
  3837. };
  3838. _proto.to = function to(index) {
  3839. var _this = this;
  3840. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3841. var activeIndex = this._getItemIndex(this._activeElement);
  3842. if (index > this._items.length - 1 || index < 0) {
  3843. return;
  3844. }
  3845. if (this._isSliding) {
  3846. $(this._element).one(Event$2.SLID, function () {
  3847. return _this.to(index);
  3848. });
  3849. return;
  3850. }
  3851. if (activeIndex === index) {
  3852. this.pause();
  3853. this.cycle();
  3854. return;
  3855. }
  3856. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3857. this._slide(direction, this._items[index]);
  3858. };
  3859. _proto.dispose = function dispose() {
  3860. $(this._element).off(EVENT_KEY$2);
  3861. $.removeData(this._element, DATA_KEY$2);
  3862. this._items = null;
  3863. this._config = null;
  3864. this._element = null;
  3865. this._interval = null;
  3866. this._isPaused = null;
  3867. this._isSliding = null;
  3868. this._activeElement = null;
  3869. this._indicatorsElement = null;
  3870. } // Private
  3871. ;
  3872. _proto._getConfig = function _getConfig(config) {
  3873. config = _objectSpread2({}, Default, {}, config);
  3874. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3875. return config;
  3876. };
  3877. _proto._handleSwipe = function _handleSwipe() {
  3878. var absDeltax = Math.abs(this.touchDeltaX);
  3879. if (absDeltax <= SWIPE_THRESHOLD) {
  3880. return;
  3881. }
  3882. var direction = absDeltax / this.touchDeltaX;
  3883. this.touchDeltaX = 0; // swipe left
  3884. if (direction > 0) {
  3885. this.prev();
  3886. } // swipe right
  3887. if (direction < 0) {
  3888. this.next();
  3889. }
  3890. };
  3891. _proto._addEventListeners = function _addEventListeners() {
  3892. var _this2 = this;
  3893. if (this._config.keyboard) {
  3894. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3895. return _this2._keydown(event);
  3896. });
  3897. }
  3898. if (this._config.pause === 'hover') {
  3899. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3900. return _this2.pause(event);
  3901. }).on(Event$2.MOUSELEAVE, function (event) {
  3902. return _this2.cycle(event);
  3903. });
  3904. }
  3905. if (this._config.touch) {
  3906. this._addTouchEventListeners();
  3907. }
  3908. };
  3909. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3910. var _this3 = this;
  3911. if (!this._touchSupported) {
  3912. return;
  3913. }
  3914. var start = function start(event) {
  3915. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3916. _this3.touchStartX = event.originalEvent.clientX;
  3917. } else if (!_this3._pointerEvent) {
  3918. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3919. }
  3920. };
  3921. var move = function move(event) {
  3922. // ensure swiping with one touch and not pinching
  3923. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3924. _this3.touchDeltaX = 0;
  3925. } else {
  3926. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3927. }
  3928. };
  3929. var end = function end(event) {
  3930. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3931. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3932. }
  3933. _this3._handleSwipe();
  3934. if (_this3._config.pause === 'hover') {
  3935. // If it's a touch-enabled device, mouseenter/leave are fired as
  3936. // part of the mouse compatibility events on first tap - the carousel
  3937. // would stop cycling until user tapped out of it;
  3938. // here, we listen for touchend, explicitly pause the carousel
  3939. // (as if it's the second time we tap on it, mouseenter compat event
  3940. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3941. // events to fire) we explicitly restart cycling
  3942. _this3.pause();
  3943. if (_this3.touchTimeout) {
  3944. clearTimeout(_this3.touchTimeout);
  3945. }
  3946. _this3.touchTimeout = setTimeout(function (event) {
  3947. return _this3.cycle(event);
  3948. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3949. }
  3950. };
  3951. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3952. return e.preventDefault();
  3953. });
  3954. if (this._pointerEvent) {
  3955. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3956. return start(event);
  3957. });
  3958. $(this._element).on(Event$2.POINTERUP, function (event) {
  3959. return end(event);
  3960. });
  3961. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3962. } else {
  3963. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3964. return start(event);
  3965. });
  3966. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3967. return move(event);
  3968. });
  3969. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3970. return end(event);
  3971. });
  3972. }
  3973. };
  3974. _proto._keydown = function _keydown(event) {
  3975. if (/input|textarea/i.test(event.target.tagName)) {
  3976. return;
  3977. }
  3978. switch (event.which) {
  3979. case ARROW_LEFT_KEYCODE:
  3980. event.preventDefault();
  3981. this.prev();
  3982. break;
  3983. case ARROW_RIGHT_KEYCODE:
  3984. event.preventDefault();
  3985. this.next();
  3986. break;
  3987. }
  3988. };
  3989. _proto._getItemIndex = function _getItemIndex(element) {
  3990. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3991. return this._items.indexOf(element);
  3992. };
  3993. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3994. var isNextDirection = direction === Direction.NEXT;
  3995. var isPrevDirection = direction === Direction.PREV;
  3996. var activeIndex = this._getItemIndex(activeElement);
  3997. var lastItemIndex = this._items.length - 1;
  3998. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3999. if (isGoingToWrap && !this._config.wrap) {
  4000. return activeElement;
  4001. }
  4002. var delta = direction === Direction.PREV ? -1 : 1;
  4003. var itemIndex = (activeIndex + delta) % this._items.length;
  4004. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4005. };
  4006. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4007. var targetIndex = this._getItemIndex(relatedTarget);
  4008. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4009. var slideEvent = $.Event(Event$2.SLIDE, {
  4010. relatedTarget: relatedTarget,
  4011. direction: eventDirectionName,
  4012. from: fromIndex,
  4013. to: targetIndex
  4014. });
  4015. $(this._element).trigger(slideEvent);
  4016. return slideEvent;
  4017. };
  4018. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4019. if (this._indicatorsElement) {
  4020. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4021. $(indicators).removeClass(ClassName$2.ACTIVE);
  4022. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4023. if (nextIndicator) {
  4024. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4025. }
  4026. }
  4027. };
  4028. _proto._slide = function _slide(direction, element) {
  4029. var _this4 = this;
  4030. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4031. var activeElementIndex = this._getItemIndex(activeElement);
  4032. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4033. var nextElementIndex = this._getItemIndex(nextElement);
  4034. var isCycling = Boolean(this._interval);
  4035. var directionalClassName;
  4036. var orderClassName;
  4037. var eventDirectionName;
  4038. if (direction === Direction.NEXT) {
  4039. directionalClassName = ClassName$2.LEFT;
  4040. orderClassName = ClassName$2.NEXT;
  4041. eventDirectionName = Direction.LEFT;
  4042. } else {
  4043. directionalClassName = ClassName$2.RIGHT;
  4044. orderClassName = ClassName$2.PREV;
  4045. eventDirectionName = Direction.RIGHT;
  4046. }
  4047. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4048. this._isSliding = false;
  4049. return;
  4050. }
  4051. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4052. if (slideEvent.isDefaultPrevented()) {
  4053. return;
  4054. }
  4055. if (!activeElement || !nextElement) {
  4056. // Some weirdness is happening, so we bail
  4057. return;
  4058. }
  4059. this._isSliding = true;
  4060. if (isCycling) {
  4061. this.pause();
  4062. }
  4063. this._setActiveIndicatorElement(nextElement);
  4064. var slidEvent = $.Event(Event$2.SLID, {
  4065. relatedTarget: nextElement,
  4066. direction: eventDirectionName,
  4067. from: activeElementIndex,
  4068. to: nextElementIndex
  4069. });
  4070. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4071. $(nextElement).addClass(orderClassName);
  4072. Util.reflow(nextElement);
  4073. $(activeElement).addClass(directionalClassName);
  4074. $(nextElement).addClass(directionalClassName);
  4075. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4076. if (nextElementInterval) {
  4077. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4078. this._config.interval = nextElementInterval;
  4079. } else {
  4080. this._config.interval = this._config.defaultInterval || this._config.interval;
  4081. }
  4082. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4083. $(activeElement).one(Util.TRANSITION_END, function () {
  4084. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4085. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4086. _this4._isSliding = false;
  4087. setTimeout(function () {
  4088. return $(_this4._element).trigger(slidEvent);
  4089. }, 0);
  4090. }).emulateTransitionEnd(transitionDuration);
  4091. } else {
  4092. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4093. $(nextElement).addClass(ClassName$2.ACTIVE);
  4094. this._isSliding = false;
  4095. $(this._element).trigger(slidEvent);
  4096. }
  4097. if (isCycling) {
  4098. this.cycle();
  4099. }
  4100. } // Static
  4101. ;
  4102. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4103. return this.each(function () {
  4104. var data = $(this).data(DATA_KEY$2);
  4105. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4106. if (typeof config === 'object') {
  4107. _config = _objectSpread2({}, _config, {}, config);
  4108. }
  4109. var action = typeof config === 'string' ? config : _config.slide;
  4110. if (!data) {
  4111. data = new Carousel(this, _config);
  4112. $(this).data(DATA_KEY$2, data);
  4113. }
  4114. if (typeof config === 'number') {
  4115. data.to(config);
  4116. } else if (typeof action === 'string') {
  4117. if (typeof data[action] === 'undefined') {
  4118. throw new TypeError("No method named \"" + action + "\"");
  4119. }
  4120. data[action]();
  4121. } else if (_config.interval && _config.ride) {
  4122. data.pause();
  4123. data.cycle();
  4124. }
  4125. });
  4126. };
  4127. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4128. var selector = Util.getSelectorFromElement(this);
  4129. if (!selector) {
  4130. return;
  4131. }
  4132. var target = $(selector)[0];
  4133. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4134. return;
  4135. }
  4136. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4137. var slideIndex = this.getAttribute('data-slide-to');
  4138. if (slideIndex) {
  4139. config.interval = false;
  4140. }
  4141. Carousel._jQueryInterface.call($(target), config);
  4142. if (slideIndex) {
  4143. $(target).data(DATA_KEY$2).to(slideIndex);
  4144. }
  4145. event.preventDefault();
  4146. };
  4147. _createClass(Carousel, null, [{
  4148. key: "VERSION",
  4149. get: function get() {
  4150. return VERSION$2;
  4151. }
  4152. }, {
  4153. key: "Default",
  4154. get: function get() {
  4155. return Default;
  4156. }
  4157. }]);
  4158. return Carousel;
  4159. }();
  4160. /**
  4161. * ------------------------------------------------------------------------
  4162. * Data Api implementation
  4163. * ------------------------------------------------------------------------
  4164. */
  4165. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4166. $(window).on(Event$2.LOAD_DATA_API, function () {
  4167. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4168. for (var i = 0, len = carousels.length; i < len; i++) {
  4169. var $carousel = $(carousels[i]);
  4170. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4171. }
  4172. });
  4173. /**
  4174. * ------------------------------------------------------------------------
  4175. * jQuery
  4176. * ------------------------------------------------------------------------
  4177. */
  4178. $.fn[NAME$2] = Carousel._jQueryInterface;
  4179. $.fn[NAME$2].Constructor = Carousel;
  4180. $.fn[NAME$2].noConflict = function () {
  4181. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4182. return Carousel._jQueryInterface;
  4183. };
  4184. /**
  4185. * ------------------------------------------------------------------------
  4186. * Constants
  4187. * ------------------------------------------------------------------------
  4188. */
  4189. var NAME$3 = 'collapse';
  4190. var VERSION$3 = '4.4.1';
  4191. var DATA_KEY$3 = 'bs.collapse';
  4192. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4193. var DATA_API_KEY$3 = '.data-api';
  4194. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4195. var Default$1 = {
  4196. toggle: true,
  4197. parent: ''
  4198. };
  4199. var DefaultType$1 = {
  4200. toggle: 'boolean',
  4201. parent: '(string|element)'
  4202. };
  4203. var Event$3 = {
  4204. SHOW: "show" + EVENT_KEY$3,
  4205. SHOWN: "shown" + EVENT_KEY$3,
  4206. HIDE: "hide" + EVENT_KEY$3,
  4207. HIDDEN: "hidden" + EVENT_KEY$3,
  4208. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4209. };
  4210. var ClassName$3 = {
  4211. SHOW: 'show',
  4212. COLLAPSE: 'collapse',
  4213. COLLAPSING: 'collapsing',
  4214. COLLAPSED: 'collapsed'
  4215. };
  4216. var Dimension = {
  4217. WIDTH: 'width',
  4218. HEIGHT: 'height'
  4219. };
  4220. var Selector$3 = {
  4221. ACTIVES: '.show, .collapsing',
  4222. DATA_TOGGLE: '[data-toggle="collapse"]'
  4223. };
  4224. /**
  4225. * ------------------------------------------------------------------------
  4226. * Class Definition
  4227. * ------------------------------------------------------------------------
  4228. */
  4229. var Collapse =
  4230. /*#__PURE__*/
  4231. function () {
  4232. function Collapse(element, config) {
  4233. this._isTransitioning = false;
  4234. this._element = element;
  4235. this._config = this._getConfig(config);
  4236. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4237. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4238. for (var i = 0, len = toggleList.length; i < len; i++) {
  4239. var elem = toggleList[i];
  4240. var selector = Util.getSelectorFromElement(elem);
  4241. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4242. return foundElem === element;
  4243. });
  4244. if (selector !== null && filterElement.length > 0) {
  4245. this._selector = selector;
  4246. this._triggerArray.push(elem);
  4247. }
  4248. }
  4249. this._parent = this._config.parent ? this._getParent() : null;
  4250. if (!this._config.parent) {
  4251. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4252. }
  4253. if (this._config.toggle) {
  4254. this.toggle();
  4255. }
  4256. } // Getters
  4257. var _proto = Collapse.prototype;
  4258. // Public
  4259. _proto.toggle = function toggle() {
  4260. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4261. this.hide();
  4262. } else {
  4263. this.show();
  4264. }
  4265. };
  4266. _proto.show = function show() {
  4267. var _this = this;
  4268. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4269. return;
  4270. }
  4271. var actives;
  4272. var activesData;
  4273. if (this._parent) {
  4274. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4275. if (typeof _this._config.parent === 'string') {
  4276. return elem.getAttribute('data-parent') === _this._config.parent;
  4277. }
  4278. return elem.classList.contains(ClassName$3.COLLAPSE);
  4279. });
  4280. if (actives.length === 0) {
  4281. actives = null;
  4282. }
  4283. }
  4284. if (actives) {
  4285. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4286. if (activesData && activesData._isTransitioning) {
  4287. return;
  4288. }
  4289. }
  4290. var startEvent = $.Event(Event$3.SHOW);
  4291. $(this._element).trigger(startEvent);
  4292. if (startEvent.isDefaultPrevented()) {
  4293. return;
  4294. }
  4295. if (actives) {
  4296. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4297. if (!activesData) {
  4298. $(actives).data(DATA_KEY$3, null);
  4299. }
  4300. }
  4301. var dimension = this._getDimension();
  4302. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4303. this._element.style[dimension] = 0;
  4304. if (this._triggerArray.length) {
  4305. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4306. }
  4307. this.setTransitioning(true);
  4308. var complete = function complete() {
  4309. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4310. _this._element.style[dimension] = '';
  4311. _this.setTransitioning(false);
  4312. $(_this._element).trigger(Event$3.SHOWN);
  4313. };
  4314. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4315. var scrollSize = "scroll" + capitalizedDimension;
  4316. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4317. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4318. this._element.style[dimension] = this._element[scrollSize] + "px";
  4319. };
  4320. _proto.hide = function hide() {
  4321. var _this2 = this;
  4322. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4323. return;
  4324. }
  4325. var startEvent = $.Event(Event$3.HIDE);
  4326. $(this._element).trigger(startEvent);
  4327. if (startEvent.isDefaultPrevented()) {
  4328. return;
  4329. }
  4330. var dimension = this._getDimension();
  4331. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4332. Util.reflow(this._element);
  4333. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4334. var triggerArrayLength = this._triggerArray.length;
  4335. if (triggerArrayLength > 0) {
  4336. for (var i = 0; i < triggerArrayLength; i++) {
  4337. var trigger = this._triggerArray[i];
  4338. var selector = Util.getSelectorFromElement(trigger);
  4339. if (selector !== null) {
  4340. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4341. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4342. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4343. }
  4344. }
  4345. }
  4346. }
  4347. this.setTransitioning(true);
  4348. var complete = function complete() {
  4349. _this2.setTransitioning(false);
  4350. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4351. };
  4352. this._element.style[dimension] = '';
  4353. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4354. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4355. };
  4356. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4357. this._isTransitioning = isTransitioning;
  4358. };
  4359. _proto.dispose = function dispose() {
  4360. $.removeData(this._element, DATA_KEY$3);
  4361. this._config = null;
  4362. this._parent = null;
  4363. this._element = null;
  4364. this._triggerArray = null;
  4365. this._isTransitioning = null;
  4366. } // Private
  4367. ;
  4368. _proto._getConfig = function _getConfig(config) {
  4369. config = _objectSpread2({}, Default$1, {}, config);
  4370. config.toggle = Boolean(config.toggle); // Coerce string values
  4371. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4372. return config;
  4373. };
  4374. _proto._getDimension = function _getDimension() {
  4375. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4376. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4377. };
  4378. _proto._getParent = function _getParent() {
  4379. var _this3 = this;
  4380. var parent;
  4381. if (Util.isElement(this._config.parent)) {
  4382. parent = this._config.parent; // It's a jQuery object
  4383. if (typeof this._config.parent.jquery !== 'undefined') {
  4384. parent = this._config.parent[0];
  4385. }
  4386. } else {
  4387. parent = document.querySelector(this._config.parent);
  4388. }
  4389. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4390. var children = [].slice.call(parent.querySelectorAll(selector));
  4391. $(children).each(function (i, element) {
  4392. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4393. });
  4394. return parent;
  4395. };
  4396. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4397. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4398. if (triggerArray.length) {
  4399. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4400. }
  4401. } // Static
  4402. ;
  4403. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4404. var selector = Util.getSelectorFromElement(element);
  4405. return selector ? document.querySelector(selector) : null;
  4406. };
  4407. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4408. return this.each(function () {
  4409. var $this = $(this);
  4410. var data = $this.data(DATA_KEY$3);
  4411. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4412. if (!data && _config.toggle && /show|hide/.test(config)) {
  4413. _config.toggle = false;
  4414. }
  4415. if (!data) {
  4416. data = new Collapse(this, _config);
  4417. $this.data(DATA_KEY$3, data);
  4418. }
  4419. if (typeof config === 'string') {
  4420. if (typeof data[config] === 'undefined') {
  4421. throw new TypeError("No method named \"" + config + "\"");
  4422. }
  4423. data[config]();
  4424. }
  4425. });
  4426. };
  4427. _createClass(Collapse, null, [{
  4428. key: "VERSION",
  4429. get: function get() {
  4430. return VERSION$3;
  4431. }
  4432. }, {
  4433. key: "Default",
  4434. get: function get() {
  4435. return Default$1;
  4436. }
  4437. }]);
  4438. return Collapse;
  4439. }();
  4440. /**
  4441. * ------------------------------------------------------------------------
  4442. * Data Api implementation
  4443. * ------------------------------------------------------------------------
  4444. */
  4445. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4446. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4447. if (event.currentTarget.tagName === 'A') {
  4448. event.preventDefault();
  4449. }
  4450. var $trigger = $(this);
  4451. var selector = Util.getSelectorFromElement(this);
  4452. var selectors = [].slice.call(document.querySelectorAll(selector));
  4453. $(selectors).each(function () {
  4454. var $target = $(this);
  4455. var data = $target.data(DATA_KEY$3);
  4456. var config = data ? 'toggle' : $trigger.data();
  4457. Collapse._jQueryInterface.call($target, config);
  4458. });
  4459. });
  4460. /**
  4461. * ------------------------------------------------------------------------
  4462. * jQuery
  4463. * ------------------------------------------------------------------------
  4464. */
  4465. $.fn[NAME$3] = Collapse._jQueryInterface;
  4466. $.fn[NAME$3].Constructor = Collapse;
  4467. $.fn[NAME$3].noConflict = function () {
  4468. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4469. return Collapse._jQueryInterface;
  4470. };
  4471. /**
  4472. * ------------------------------------------------------------------------
  4473. * Constants
  4474. * ------------------------------------------------------------------------
  4475. */
  4476. var NAME$4 = 'dropdown';
  4477. var VERSION$4 = '4.4.1';
  4478. var DATA_KEY$4 = 'bs.dropdown';
  4479. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4480. var DATA_API_KEY$4 = '.data-api';
  4481. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4482. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4483. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4484. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4485. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4486. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4487. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4488. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4489. var Event$4 = {
  4490. HIDE: "hide" + EVENT_KEY$4,
  4491. HIDDEN: "hidden" + EVENT_KEY$4,
  4492. SHOW: "show" + EVENT_KEY$4,
  4493. SHOWN: "shown" + EVENT_KEY$4,
  4494. CLICK: "click" + EVENT_KEY$4,
  4495. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4496. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4497. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4498. };
  4499. var ClassName$4 = {
  4500. DISABLED: 'disabled',
  4501. SHOW: 'show',
  4502. DROPUP: 'dropup',
  4503. DROPRIGHT: 'dropright',
  4504. DROPLEFT: 'dropleft',
  4505. MENURIGHT: 'dropdown-menu-right',
  4506. MENULEFT: 'dropdown-menu-left',
  4507. POSITION_STATIC: 'position-static'
  4508. };
  4509. var Selector$4 = {
  4510. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4511. FORM_CHILD: '.dropdown form',
  4512. MENU: '.dropdown-menu',
  4513. NAVBAR_NAV: '.navbar-nav',
  4514. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4515. };
  4516. var AttachmentMap = {
  4517. TOP: 'top-start',
  4518. TOPEND: 'top-end',
  4519. BOTTOM: 'bottom-start',
  4520. BOTTOMEND: 'bottom-end',
  4521. RIGHT: 'right-start',
  4522. RIGHTEND: 'right-end',
  4523. LEFT: 'left-start',
  4524. LEFTEND: 'left-end'
  4525. };
  4526. var Default$2 = {
  4527. offset: 0,
  4528. flip: true,
  4529. boundary: 'scrollParent',
  4530. reference: 'toggle',
  4531. display: 'dynamic',
  4532. popperConfig: null
  4533. };
  4534. var DefaultType$2 = {
  4535. offset: '(number|string|function)',
  4536. flip: 'boolean',
  4537. boundary: '(string|element)',
  4538. reference: '(string|element)',
  4539. display: 'string',
  4540. popperConfig: '(null|object)'
  4541. };
  4542. /**
  4543. * ------------------------------------------------------------------------
  4544. * Class Definition
  4545. * ------------------------------------------------------------------------
  4546. */
  4547. var Dropdown =
  4548. /*#__PURE__*/
  4549. function () {
  4550. function Dropdown(element, config) {
  4551. this._element = element;
  4552. this._popper = null;
  4553. this._config = this._getConfig(config);
  4554. this._menu = this._getMenuElement();
  4555. this._inNavbar = this._detectNavbar();
  4556. this._addEventListeners();
  4557. } // Getters
  4558. var _proto = Dropdown.prototype;
  4559. // Public
  4560. _proto.toggle = function toggle() {
  4561. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4562. return;
  4563. }
  4564. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4565. Dropdown._clearMenus();
  4566. if (isActive) {
  4567. return;
  4568. }
  4569. this.show(true);
  4570. };
  4571. _proto.show = function show(usePopper) {
  4572. if (usePopper === void 0) {
  4573. usePopper = false;
  4574. }
  4575. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4576. return;
  4577. }
  4578. var relatedTarget = {
  4579. relatedTarget: this._element
  4580. };
  4581. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4582. var parent = Dropdown._getParentFromElement(this._element);
  4583. $(parent).trigger(showEvent);
  4584. if (showEvent.isDefaultPrevented()) {
  4585. return;
  4586. } // Disable totally Popper.js for Dropdown in Navbar
  4587. if (!this._inNavbar && usePopper) {
  4588. /**
  4589. * Check for Popper dependency
  4590. * Popper - https://popper.js.org
  4591. */
  4592. if (typeof Popper === 'undefined') {
  4593. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4594. }
  4595. var referenceElement = this._element;
  4596. if (this._config.reference === 'parent') {
  4597. referenceElement = parent;
  4598. } else if (Util.isElement(this._config.reference)) {
  4599. referenceElement = this._config.reference; // Check if it's jQuery element
  4600. if (typeof this._config.reference.jquery !== 'undefined') {
  4601. referenceElement = this._config.reference[0];
  4602. }
  4603. } // If boundary is not `scrollParent`, then set position to `static`
  4604. // to allow the menu to "escape" the scroll parent's boundaries
  4605. // https://github.com/twbs/bootstrap/issues/24251
  4606. if (this._config.boundary !== 'scrollParent') {
  4607. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4608. }
  4609. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4610. } // If this is a touch-enabled device we add extra
  4611. // empty mouseover listeners to the body's immediate children;
  4612. // only needed because of broken event delegation on iOS
  4613. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4614. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4615. $(document.body).children().on('mouseover', null, $.noop);
  4616. }
  4617. this._element.focus();
  4618. this._element.setAttribute('aria-expanded', true);
  4619. $(this._menu).toggleClass(ClassName$4.SHOW);
  4620. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4621. };
  4622. _proto.hide = function hide() {
  4623. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4624. return;
  4625. }
  4626. var relatedTarget = {
  4627. relatedTarget: this._element
  4628. };
  4629. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4630. var parent = Dropdown._getParentFromElement(this._element);
  4631. $(parent).trigger(hideEvent);
  4632. if (hideEvent.isDefaultPrevented()) {
  4633. return;
  4634. }
  4635. if (this._popper) {
  4636. this._popper.destroy();
  4637. }
  4638. $(this._menu).toggleClass(ClassName$4.SHOW);
  4639. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4640. };
  4641. _proto.dispose = function dispose() {
  4642. $.removeData(this._element, DATA_KEY$4);
  4643. $(this._element).off(EVENT_KEY$4);
  4644. this._element = null;
  4645. this._menu = null;
  4646. if (this._popper !== null) {
  4647. this._popper.destroy();
  4648. this._popper = null;
  4649. }
  4650. };
  4651. _proto.update = function update() {
  4652. this._inNavbar = this._detectNavbar();
  4653. if (this._popper !== null) {
  4654. this._popper.scheduleUpdate();
  4655. }
  4656. } // Private
  4657. ;
  4658. _proto._addEventListeners = function _addEventListeners() {
  4659. var _this = this;
  4660. $(this._element).on(Event$4.CLICK, function (event) {
  4661. event.preventDefault();
  4662. event.stopPropagation();
  4663. _this.toggle();
  4664. });
  4665. };
  4666. _proto._getConfig = function _getConfig(config) {
  4667. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4668. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4669. return config;
  4670. };
  4671. _proto._getMenuElement = function _getMenuElement() {
  4672. if (!this._menu) {
  4673. var parent = Dropdown._getParentFromElement(this._element);
  4674. if (parent) {
  4675. this._menu = parent.querySelector(Selector$4.MENU);
  4676. }
  4677. }
  4678. return this._menu;
  4679. };
  4680. _proto._getPlacement = function _getPlacement() {
  4681. var $parentDropdown = $(this._element.parentNode);
  4682. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4683. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4684. placement = AttachmentMap.TOP;
  4685. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4686. placement = AttachmentMap.TOPEND;
  4687. }
  4688. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4689. placement = AttachmentMap.RIGHT;
  4690. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4691. placement = AttachmentMap.LEFT;
  4692. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4693. placement = AttachmentMap.BOTTOMEND;
  4694. }
  4695. return placement;
  4696. };
  4697. _proto._detectNavbar = function _detectNavbar() {
  4698. return $(this._element).closest('.navbar').length > 0;
  4699. };
  4700. _proto._getOffset = function _getOffset() {
  4701. var _this2 = this;
  4702. var offset = {};
  4703. if (typeof this._config.offset === 'function') {
  4704. offset.fn = function (data) {
  4705. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4706. return data;
  4707. };
  4708. } else {
  4709. offset.offset = this._config.offset;
  4710. }
  4711. return offset;
  4712. };
  4713. _proto._getPopperConfig = function _getPopperConfig() {
  4714. var popperConfig = {
  4715. placement: this._getPlacement(),
  4716. modifiers: {
  4717. offset: this._getOffset(),
  4718. flip: {
  4719. enabled: this._config.flip
  4720. },
  4721. preventOverflow: {
  4722. boundariesElement: this._config.boundary
  4723. }
  4724. }
  4725. }; // Disable Popper.js if we have a static display
  4726. if (this._config.display === 'static') {
  4727. popperConfig.modifiers.applyStyle = {
  4728. enabled: false
  4729. };
  4730. }
  4731. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4732. } // Static
  4733. ;
  4734. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4735. return this.each(function () {
  4736. var data = $(this).data(DATA_KEY$4);
  4737. var _config = typeof config === 'object' ? config : null;
  4738. if (!data) {
  4739. data = new Dropdown(this, _config);
  4740. $(this).data(DATA_KEY$4, data);
  4741. }
  4742. if (typeof config === 'string') {
  4743. if (typeof data[config] === 'undefined') {
  4744. throw new TypeError("No method named \"" + config + "\"");
  4745. }
  4746. data[config]();
  4747. }
  4748. });
  4749. };
  4750. Dropdown._clearMenus = function _clearMenus(event) {
  4751. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4752. return;
  4753. }
  4754. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4755. for (var i = 0, len = toggles.length; i < len; i++) {
  4756. var parent = Dropdown._getParentFromElement(toggles[i]);
  4757. var context = $(toggles[i]).data(DATA_KEY$4);
  4758. var relatedTarget = {
  4759. relatedTarget: toggles[i]
  4760. };
  4761. if (event && event.type === 'click') {
  4762. relatedTarget.clickEvent = event;
  4763. }
  4764. if (!context) {
  4765. continue;
  4766. }
  4767. var dropdownMenu = context._menu;
  4768. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4769. continue;
  4770. }
  4771. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4772. continue;
  4773. }
  4774. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4775. $(parent).trigger(hideEvent);
  4776. if (hideEvent.isDefaultPrevented()) {
  4777. continue;
  4778. } // If this is a touch-enabled device we remove the extra
  4779. // empty mouseover listeners we added for iOS support
  4780. if ('ontouchstart' in document.documentElement) {
  4781. $(document.body).children().off('mouseover', null, $.noop);
  4782. }
  4783. toggles[i].setAttribute('aria-expanded', 'false');
  4784. if (context._popper) {
  4785. context._popper.destroy();
  4786. }
  4787. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4788. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4789. }
  4790. };
  4791. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4792. var parent;
  4793. var selector = Util.getSelectorFromElement(element);
  4794. if (selector) {
  4795. parent = document.querySelector(selector);
  4796. }
  4797. return parent || element.parentNode;
  4798. } // eslint-disable-next-line complexity
  4799. ;
  4800. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4801. // If not input/textarea:
  4802. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4803. // If input/textarea:
  4804. // - If space key => not a dropdown command
  4805. // - If key is other than escape
  4806. // - If key is not up or down => not a dropdown command
  4807. // - If trigger inside the menu => not a dropdown command
  4808. 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)) {
  4809. return;
  4810. }
  4811. event.preventDefault();
  4812. event.stopPropagation();
  4813. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4814. return;
  4815. }
  4816. var parent = Dropdown._getParentFromElement(this);
  4817. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4818. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4819. return;
  4820. }
  4821. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4822. if (event.which === ESCAPE_KEYCODE) {
  4823. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4824. $(toggle).trigger('focus');
  4825. }
  4826. $(this).trigger('click');
  4827. return;
  4828. }
  4829. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4830. return $(item).is(':visible');
  4831. });
  4832. if (items.length === 0) {
  4833. return;
  4834. }
  4835. var index = items.indexOf(event.target);
  4836. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4837. // Up
  4838. index--;
  4839. }
  4840. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4841. // Down
  4842. index++;
  4843. }
  4844. if (index < 0) {
  4845. index = 0;
  4846. }
  4847. items[index].focus();
  4848. };
  4849. _createClass(Dropdown, null, [{
  4850. key: "VERSION",
  4851. get: function get() {
  4852. return VERSION$4;
  4853. }
  4854. }, {
  4855. key: "Default",
  4856. get: function get() {
  4857. return Default$2;
  4858. }
  4859. }, {
  4860. key: "DefaultType",
  4861. get: function get() {
  4862. return DefaultType$2;
  4863. }
  4864. }]);
  4865. return Dropdown;
  4866. }();
  4867. /**
  4868. * ------------------------------------------------------------------------
  4869. * Data Api implementation
  4870. * ------------------------------------------------------------------------
  4871. */
  4872. $(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) {
  4873. event.preventDefault();
  4874. event.stopPropagation();
  4875. Dropdown._jQueryInterface.call($(this), 'toggle');
  4876. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4877. e.stopPropagation();
  4878. });
  4879. /**
  4880. * ------------------------------------------------------------------------
  4881. * jQuery
  4882. * ------------------------------------------------------------------------
  4883. */
  4884. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4885. $.fn[NAME$4].Constructor = Dropdown;
  4886. $.fn[NAME$4].noConflict = function () {
  4887. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4888. return Dropdown._jQueryInterface;
  4889. };
  4890. /**
  4891. * ------------------------------------------------------------------------
  4892. * Constants
  4893. * ------------------------------------------------------------------------
  4894. */
  4895. var NAME$5 = 'modal';
  4896. var VERSION$5 = '4.4.1';
  4897. var DATA_KEY$5 = 'bs.modal';
  4898. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4899. var DATA_API_KEY$5 = '.data-api';
  4900. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4901. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4902. var Default$3 = {
  4903. backdrop: true,
  4904. keyboard: true,
  4905. focus: true,
  4906. show: true
  4907. };
  4908. var DefaultType$3 = {
  4909. backdrop: '(boolean|string)',
  4910. keyboard: 'boolean',
  4911. focus: 'boolean',
  4912. show: 'boolean'
  4913. };
  4914. var Event$5 = {
  4915. HIDE: "hide" + EVENT_KEY$5,
  4916. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4917. HIDDEN: "hidden" + EVENT_KEY$5,
  4918. SHOW: "show" + EVENT_KEY$5,
  4919. SHOWN: "shown" + EVENT_KEY$5,
  4920. FOCUSIN: "focusin" + EVENT_KEY$5,
  4921. RESIZE: "resize" + EVENT_KEY$5,
  4922. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4923. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4924. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4925. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4926. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4927. };
  4928. var ClassName$5 = {
  4929. SCROLLABLE: 'modal-dialog-scrollable',
  4930. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4931. BACKDROP: 'modal-backdrop',
  4932. OPEN: 'modal-open',
  4933. FADE: 'fade',
  4934. SHOW: 'show',
  4935. STATIC: 'modal-static'
  4936. };
  4937. var Selector$5 = {
  4938. DIALOG: '.modal-dialog',
  4939. MODAL_BODY: '.modal-body',
  4940. DATA_TOGGLE: '[data-toggle="modal"]',
  4941. DATA_DISMISS: '[data-dismiss="modal"]',
  4942. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4943. STICKY_CONTENT: '.sticky-top'
  4944. };
  4945. /**
  4946. * ------------------------------------------------------------------------
  4947. * Class Definition
  4948. * ------------------------------------------------------------------------
  4949. */
  4950. var Modal =
  4951. /*#__PURE__*/
  4952. function () {
  4953. function Modal(element, config) {
  4954. this._config = this._getConfig(config);
  4955. this._element = element;
  4956. this._dialog = element.querySelector(Selector$5.DIALOG);
  4957. this._backdrop = null;
  4958. this._isShown = false;
  4959. this._isBodyOverflowing = false;
  4960. this._ignoreBackdropClick = false;
  4961. this._isTransitioning = false;
  4962. this._scrollbarWidth = 0;
  4963. } // Getters
  4964. var _proto = Modal.prototype;
  4965. // Public
  4966. _proto.toggle = function toggle(relatedTarget) {
  4967. return this._isShown ? this.hide() : this.show(relatedTarget);
  4968. };
  4969. _proto.show = function show(relatedTarget) {
  4970. var _this = this;
  4971. if (this._isShown || this._isTransitioning) {
  4972. return;
  4973. }
  4974. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4975. this._isTransitioning = true;
  4976. }
  4977. var showEvent = $.Event(Event$5.SHOW, {
  4978. relatedTarget: relatedTarget
  4979. });
  4980. $(this._element).trigger(showEvent);
  4981. if (this._isShown || showEvent.isDefaultPrevented()) {
  4982. return;
  4983. }
  4984. this._isShown = true;
  4985. this._checkScrollbar();
  4986. this._setScrollbar();
  4987. this._adjustDialog();
  4988. this._setEscapeEvent();
  4989. this._setResizeEvent();
  4990. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4991. return _this.hide(event);
  4992. });
  4993. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4994. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4995. if ($(event.target).is(_this._element)) {
  4996. _this._ignoreBackdropClick = true;
  4997. }
  4998. });
  4999. });
  5000. this._showBackdrop(function () {
  5001. return _this._showElement(relatedTarget);
  5002. });
  5003. };
  5004. _proto.hide = function hide(event) {
  5005. var _this2 = this;
  5006. if (event) {
  5007. event.preventDefault();
  5008. }
  5009. if (!this._isShown || this._isTransitioning) {
  5010. return;
  5011. }
  5012. var hideEvent = $.Event(Event$5.HIDE);
  5013. $(this._element).trigger(hideEvent);
  5014. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5015. return;
  5016. }
  5017. this._isShown = false;
  5018. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5019. if (transition) {
  5020. this._isTransitioning = true;
  5021. }
  5022. this._setEscapeEvent();
  5023. this._setResizeEvent();
  5024. $(document).off(Event$5.FOCUSIN);
  5025. $(this._element).removeClass(ClassName$5.SHOW);
  5026. $(this._element).off(Event$5.CLICK_DISMISS);
  5027. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5028. if (transition) {
  5029. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5030. $(this._element).one(Util.TRANSITION_END, function (event) {
  5031. return _this2._hideModal(event);
  5032. }).emulateTransitionEnd(transitionDuration);
  5033. } else {
  5034. this._hideModal();
  5035. }
  5036. };
  5037. _proto.dispose = function dispose() {
  5038. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5039. return $(htmlElement).off(EVENT_KEY$5);
  5040. });
  5041. /**
  5042. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5043. * Do not move `document` in `htmlElements` array
  5044. * It will remove `Event.CLICK_DATA_API` event that should remain
  5045. */
  5046. $(document).off(Event$5.FOCUSIN);
  5047. $.removeData(this._element, DATA_KEY$5);
  5048. this._config = null;
  5049. this._element = null;
  5050. this._dialog = null;
  5051. this._backdrop = null;
  5052. this._isShown = null;
  5053. this._isBodyOverflowing = null;
  5054. this._ignoreBackdropClick = null;
  5055. this._isTransitioning = null;
  5056. this._scrollbarWidth = null;
  5057. };
  5058. _proto.handleUpdate = function handleUpdate() {
  5059. this._adjustDialog();
  5060. } // Private
  5061. ;
  5062. _proto._getConfig = function _getConfig(config) {
  5063. config = _objectSpread2({}, Default$3, {}, config);
  5064. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5065. return config;
  5066. };
  5067. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5068. var _this3 = this;
  5069. if (this._config.backdrop === 'static') {
  5070. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5071. $(this._element).trigger(hideEventPrevented);
  5072. if (hideEventPrevented.defaultPrevented) {
  5073. return;
  5074. }
  5075. this._element.classList.add(ClassName$5.STATIC);
  5076. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5077. $(this._element).one(Util.TRANSITION_END, function () {
  5078. _this3._element.classList.remove(ClassName$5.STATIC);
  5079. }).emulateTransitionEnd(modalTransitionDuration);
  5080. this._element.focus();
  5081. } else {
  5082. this.hide();
  5083. }
  5084. };
  5085. _proto._showElement = function _showElement(relatedTarget) {
  5086. var _this4 = this;
  5087. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5088. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5089. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5090. // Don't move modal's DOM position
  5091. document.body.appendChild(this._element);
  5092. }
  5093. this._element.style.display = 'block';
  5094. this._element.removeAttribute('aria-hidden');
  5095. this._element.setAttribute('aria-modal', true);
  5096. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5097. modalBody.scrollTop = 0;
  5098. } else {
  5099. this._element.scrollTop = 0;
  5100. }
  5101. if (transition) {
  5102. Util.reflow(this._element);
  5103. }
  5104. $(this._element).addClass(ClassName$5.SHOW);
  5105. if (this._config.focus) {
  5106. this._enforceFocus();
  5107. }
  5108. var shownEvent = $.Event(Event$5.SHOWN, {
  5109. relatedTarget: relatedTarget
  5110. });
  5111. var transitionComplete = function transitionComplete() {
  5112. if (_this4._config.focus) {
  5113. _this4._element.focus();
  5114. }
  5115. _this4._isTransitioning = false;
  5116. $(_this4._element).trigger(shownEvent);
  5117. };
  5118. if (transition) {
  5119. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5120. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5121. } else {
  5122. transitionComplete();
  5123. }
  5124. };
  5125. _proto._enforceFocus = function _enforceFocus() {
  5126. var _this5 = this;
  5127. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5128. .on(Event$5.FOCUSIN, function (event) {
  5129. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5130. _this5._element.focus();
  5131. }
  5132. });
  5133. };
  5134. _proto._setEscapeEvent = function _setEscapeEvent() {
  5135. var _this6 = this;
  5136. if (this._isShown && this._config.keyboard) {
  5137. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5138. if (event.which === ESCAPE_KEYCODE$1) {
  5139. _this6._triggerBackdropTransition();
  5140. }
  5141. });
  5142. } else if (!this._isShown) {
  5143. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5144. }
  5145. };
  5146. _proto._setResizeEvent = function _setResizeEvent() {
  5147. var _this7 = this;
  5148. if (this._isShown) {
  5149. $(window).on(Event$5.RESIZE, function (event) {
  5150. return _this7.handleUpdate(event);
  5151. });
  5152. } else {
  5153. $(window).off(Event$5.RESIZE);
  5154. }
  5155. };
  5156. _proto._hideModal = function _hideModal() {
  5157. var _this8 = this;
  5158. this._element.style.display = 'none';
  5159. this._element.setAttribute('aria-hidden', true);
  5160. this._element.removeAttribute('aria-modal');
  5161. this._isTransitioning = false;
  5162. this._showBackdrop(function () {
  5163. $(document.body).removeClass(ClassName$5.OPEN);
  5164. _this8._resetAdjustments();
  5165. _this8._resetScrollbar();
  5166. $(_this8._element).trigger(Event$5.HIDDEN);
  5167. });
  5168. };
  5169. _proto._removeBackdrop = function _removeBackdrop() {
  5170. if (this._backdrop) {
  5171. $(this._backdrop).remove();
  5172. this._backdrop = null;
  5173. }
  5174. };
  5175. _proto._showBackdrop = function _showBackdrop(callback) {
  5176. var _this9 = this;
  5177. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5178. if (this._isShown && this._config.backdrop) {
  5179. this._backdrop = document.createElement('div');
  5180. this._backdrop.className = ClassName$5.BACKDROP;
  5181. if (animate) {
  5182. this._backdrop.classList.add(animate);
  5183. }
  5184. $(this._backdrop).appendTo(document.body);
  5185. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5186. if (_this9._ignoreBackdropClick) {
  5187. _this9._ignoreBackdropClick = false;
  5188. return;
  5189. }
  5190. if (event.target !== event.currentTarget) {
  5191. return;
  5192. }
  5193. _this9._triggerBackdropTransition();
  5194. });
  5195. if (animate) {
  5196. Util.reflow(this._backdrop);
  5197. }
  5198. $(this._backdrop).addClass(ClassName$5.SHOW);
  5199. if (!callback) {
  5200. return;
  5201. }
  5202. if (!animate) {
  5203. callback();
  5204. return;
  5205. }
  5206. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5207. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5208. } else if (!this._isShown && this._backdrop) {
  5209. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5210. var callbackRemove = function callbackRemove() {
  5211. _this9._removeBackdrop();
  5212. if (callback) {
  5213. callback();
  5214. }
  5215. };
  5216. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5217. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5218. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5219. } else {
  5220. callbackRemove();
  5221. }
  5222. } else if (callback) {
  5223. callback();
  5224. }
  5225. } // ----------------------------------------------------------------------
  5226. // the following methods are used to handle overflowing modals
  5227. // todo (fat): these should probably be refactored out of modal.js
  5228. // ----------------------------------------------------------------------
  5229. ;
  5230. _proto._adjustDialog = function _adjustDialog() {
  5231. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5232. if (!this._isBodyOverflowing && isModalOverflowing) {
  5233. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5234. }
  5235. if (this._isBodyOverflowing && !isModalOverflowing) {
  5236. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5237. }
  5238. };
  5239. _proto._resetAdjustments = function _resetAdjustments() {
  5240. this._element.style.paddingLeft = '';
  5241. this._element.style.paddingRight = '';
  5242. };
  5243. _proto._checkScrollbar = function _checkScrollbar() {
  5244. var rect = document.body.getBoundingClientRect();
  5245. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5246. this._scrollbarWidth = this._getScrollbarWidth();
  5247. };
  5248. _proto._setScrollbar = function _setScrollbar() {
  5249. var _this10 = this;
  5250. if (this._isBodyOverflowing) {
  5251. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5252. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5253. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5254. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5255. $(fixedContent).each(function (index, element) {
  5256. var actualPadding = element.style.paddingRight;
  5257. var calculatedPadding = $(element).css('padding-right');
  5258. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5259. }); // Adjust sticky content margin
  5260. $(stickyContent).each(function (index, element) {
  5261. var actualMargin = element.style.marginRight;
  5262. var calculatedMargin = $(element).css('margin-right');
  5263. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5264. }); // Adjust body padding
  5265. var actualPadding = document.body.style.paddingRight;
  5266. var calculatedPadding = $(document.body).css('padding-right');
  5267. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5268. }
  5269. $(document.body).addClass(ClassName$5.OPEN);
  5270. };
  5271. _proto._resetScrollbar = function _resetScrollbar() {
  5272. // Restore fixed content padding
  5273. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5274. $(fixedContent).each(function (index, element) {
  5275. var padding = $(element).data('padding-right');
  5276. $(element).removeData('padding-right');
  5277. element.style.paddingRight = padding ? padding : '';
  5278. }); // Restore sticky content
  5279. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5280. $(elements).each(function (index, element) {
  5281. var margin = $(element).data('margin-right');
  5282. if (typeof margin !== 'undefined') {
  5283. $(element).css('margin-right', margin).removeData('margin-right');
  5284. }
  5285. }); // Restore body padding
  5286. var padding = $(document.body).data('padding-right');
  5287. $(document.body).removeData('padding-right');
  5288. document.body.style.paddingRight = padding ? padding : '';
  5289. };
  5290. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5291. // thx d.walsh
  5292. var scrollDiv = document.createElement('div');
  5293. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5294. document.body.appendChild(scrollDiv);
  5295. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5296. document.body.removeChild(scrollDiv);
  5297. return scrollbarWidth;
  5298. } // Static
  5299. ;
  5300. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5301. return this.each(function () {
  5302. var data = $(this).data(DATA_KEY$5);
  5303. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5304. if (!data) {
  5305. data = new Modal(this, _config);
  5306. $(this).data(DATA_KEY$5, data);
  5307. }
  5308. if (typeof config === 'string') {
  5309. if (typeof data[config] === 'undefined') {
  5310. throw new TypeError("No method named \"" + config + "\"");
  5311. }
  5312. data[config](relatedTarget);
  5313. } else if (_config.show) {
  5314. data.show(relatedTarget);
  5315. }
  5316. });
  5317. };
  5318. _createClass(Modal, null, [{
  5319. key: "VERSION",
  5320. get: function get() {
  5321. return VERSION$5;
  5322. }
  5323. }, {
  5324. key: "Default",
  5325. get: function get() {
  5326. return Default$3;
  5327. }
  5328. }]);
  5329. return Modal;
  5330. }();
  5331. /**
  5332. * ------------------------------------------------------------------------
  5333. * Data Api implementation
  5334. * ------------------------------------------------------------------------
  5335. */
  5336. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5337. var _this11 = this;
  5338. var target;
  5339. var selector = Util.getSelectorFromElement(this);
  5340. if (selector) {
  5341. target = document.querySelector(selector);
  5342. }
  5343. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5344. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5345. event.preventDefault();
  5346. }
  5347. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5348. if (showEvent.isDefaultPrevented()) {
  5349. // Only register focus restorer if modal will actually get shown
  5350. return;
  5351. }
  5352. $target.one(Event$5.HIDDEN, function () {
  5353. if ($(_this11).is(':visible')) {
  5354. _this11.focus();
  5355. }
  5356. });
  5357. });
  5358. Modal._jQueryInterface.call($(target), config, this);
  5359. });
  5360. /**
  5361. * ------------------------------------------------------------------------
  5362. * jQuery
  5363. * ------------------------------------------------------------------------
  5364. */
  5365. $.fn[NAME$5] = Modal._jQueryInterface;
  5366. $.fn[NAME$5].Constructor = Modal;
  5367. $.fn[NAME$5].noConflict = function () {
  5368. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5369. return Modal._jQueryInterface;
  5370. };
  5371. /**
  5372. * --------------------------------------------------------------------------
  5373. * Bootstrap (v4.4.1): tools/sanitizer.js
  5374. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5375. * --------------------------------------------------------------------------
  5376. */
  5377. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5378. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5379. var DefaultWhitelist = {
  5380. // Global attributes allowed on any supplied element below.
  5381. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5382. a: ['target', 'href', 'title', 'rel'],
  5383. area: [],
  5384. b: [],
  5385. br: [],
  5386. col: [],
  5387. code: [],
  5388. div: [],
  5389. em: [],
  5390. hr: [],
  5391. h1: [],
  5392. h2: [],
  5393. h3: [],
  5394. h4: [],
  5395. h5: [],
  5396. h6: [],
  5397. i: [],
  5398. img: ['src', 'alt', 'title', 'width', 'height'],
  5399. li: [],
  5400. ol: [],
  5401. p: [],
  5402. pre: [],
  5403. s: [],
  5404. small: [],
  5405. span: [],
  5406. sub: [],
  5407. sup: [],
  5408. strong: [],
  5409. u: [],
  5410. ul: []
  5411. };
  5412. /**
  5413. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5414. *
  5415. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5416. */
  5417. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5418. /**
  5419. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5420. *
  5421. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5422. */
  5423. 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;
  5424. function allowedAttribute(attr, allowedAttributeList) {
  5425. var attrName = attr.nodeName.toLowerCase();
  5426. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5427. if (uriAttrs.indexOf(attrName) !== -1) {
  5428. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5429. }
  5430. return true;
  5431. }
  5432. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5433. return attrRegex instanceof RegExp;
  5434. }); // Check if a regular expression validates the attribute.
  5435. for (var i = 0, l = regExp.length; i < l; i++) {
  5436. if (attrName.match(regExp[i])) {
  5437. return true;
  5438. }
  5439. }
  5440. return false;
  5441. }
  5442. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5443. if (unsafeHtml.length === 0) {
  5444. return unsafeHtml;
  5445. }
  5446. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5447. return sanitizeFn(unsafeHtml);
  5448. }
  5449. var domParser = new window.DOMParser();
  5450. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5451. var whitelistKeys = Object.keys(whiteList);
  5452. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5453. var _loop = function _loop(i, len) {
  5454. var el = elements[i];
  5455. var elName = el.nodeName.toLowerCase();
  5456. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5457. el.parentNode.removeChild(el);
  5458. return "continue";
  5459. }
  5460. var attributeList = [].slice.call(el.attributes);
  5461. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5462. attributeList.forEach(function (attr) {
  5463. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5464. el.removeAttribute(attr.nodeName);
  5465. }
  5466. });
  5467. };
  5468. for (var i = 0, len = elements.length; i < len; i++) {
  5469. var _ret = _loop(i);
  5470. if (_ret === "continue") continue;
  5471. }
  5472. return createdDocument.body.innerHTML;
  5473. }
  5474. /**
  5475. * ------------------------------------------------------------------------
  5476. * Constants
  5477. * ------------------------------------------------------------------------
  5478. */
  5479. var NAME$6 = 'tooltip';
  5480. var VERSION$6 = '4.4.1';
  5481. var DATA_KEY$6 = 'bs.tooltip';
  5482. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5483. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5484. var CLASS_PREFIX = 'bs-tooltip';
  5485. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5486. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5487. var DefaultType$4 = {
  5488. animation: 'boolean',
  5489. template: 'string',
  5490. title: '(string|element|function)',
  5491. trigger: 'string',
  5492. delay: '(number|object)',
  5493. html: 'boolean',
  5494. selector: '(string|boolean)',
  5495. placement: '(string|function)',
  5496. offset: '(number|string|function)',
  5497. container: '(string|element|boolean)',
  5498. fallbackPlacement: '(string|array)',
  5499. boundary: '(string|element)',
  5500. sanitize: 'boolean',
  5501. sanitizeFn: '(null|function)',
  5502. whiteList: 'object',
  5503. popperConfig: '(null|object)'
  5504. };
  5505. var AttachmentMap$1 = {
  5506. AUTO: 'auto',
  5507. TOP: 'top',
  5508. RIGHT: 'right',
  5509. BOTTOM: 'bottom',
  5510. LEFT: 'left'
  5511. };
  5512. var Default$4 = {
  5513. animation: true,
  5514. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5515. trigger: 'hover focus',
  5516. title: '',
  5517. delay: 0,
  5518. html: false,
  5519. selector: false,
  5520. placement: 'top',
  5521. offset: 0,
  5522. container: false,
  5523. fallbackPlacement: 'flip',
  5524. boundary: 'scrollParent',
  5525. sanitize: true,
  5526. sanitizeFn: null,
  5527. whiteList: DefaultWhitelist,
  5528. popperConfig: null
  5529. };
  5530. var HoverState = {
  5531. SHOW: 'show',
  5532. OUT: 'out'
  5533. };
  5534. var Event$6 = {
  5535. HIDE: "hide" + EVENT_KEY$6,
  5536. HIDDEN: "hidden" + EVENT_KEY$6,
  5537. SHOW: "show" + EVENT_KEY$6,
  5538. SHOWN: "shown" + EVENT_KEY$6,
  5539. INSERTED: "inserted" + EVENT_KEY$6,
  5540. CLICK: "click" + EVENT_KEY$6,
  5541. FOCUSIN: "focusin" + EVENT_KEY$6,
  5542. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5543. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5544. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5545. };
  5546. var ClassName$6 = {
  5547. FADE: 'fade',
  5548. SHOW: 'show'
  5549. };
  5550. var Selector$6 = {
  5551. TOOLTIP: '.tooltip',
  5552. TOOLTIP_INNER: '.tooltip-inner',
  5553. ARROW: '.arrow'
  5554. };
  5555. var Trigger = {
  5556. HOVER: 'hover',
  5557. FOCUS: 'focus',
  5558. CLICK: 'click',
  5559. MANUAL: 'manual'
  5560. };
  5561. /**
  5562. * ------------------------------------------------------------------------
  5563. * Class Definition
  5564. * ------------------------------------------------------------------------
  5565. */
  5566. var Tooltip =
  5567. /*#__PURE__*/
  5568. function () {
  5569. function Tooltip(element, config) {
  5570. if (typeof Popper === 'undefined') {
  5571. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5572. } // private
  5573. this._isEnabled = true;
  5574. this._timeout = 0;
  5575. this._hoverState = '';
  5576. this._activeTrigger = {};
  5577. this._popper = null; // Protected
  5578. this.element = element;
  5579. this.config = this._getConfig(config);
  5580. this.tip = null;
  5581. this._setListeners();
  5582. } // Getters
  5583. var _proto = Tooltip.prototype;
  5584. // Public
  5585. _proto.enable = function enable() {
  5586. this._isEnabled = true;
  5587. };
  5588. _proto.disable = function disable() {
  5589. this._isEnabled = false;
  5590. };
  5591. _proto.toggleEnabled = function toggleEnabled() {
  5592. this._isEnabled = !this._isEnabled;
  5593. };
  5594. _proto.toggle = function toggle(event) {
  5595. if (!this._isEnabled) {
  5596. return;
  5597. }
  5598. if (event) {
  5599. var dataKey = this.constructor.DATA_KEY;
  5600. var context = $(event.currentTarget).data(dataKey);
  5601. if (!context) {
  5602. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5603. $(event.currentTarget).data(dataKey, context);
  5604. }
  5605. context._activeTrigger.click = !context._activeTrigger.click;
  5606. if (context._isWithActiveTrigger()) {
  5607. context._enter(null, context);
  5608. } else {
  5609. context._leave(null, context);
  5610. }
  5611. } else {
  5612. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5613. this._leave(null, this);
  5614. return;
  5615. }
  5616. this._enter(null, this);
  5617. }
  5618. };
  5619. _proto.dispose = function dispose() {
  5620. clearTimeout(this._timeout);
  5621. $.removeData(this.element, this.constructor.DATA_KEY);
  5622. $(this.element).off(this.constructor.EVENT_KEY);
  5623. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5624. if (this.tip) {
  5625. $(this.tip).remove();
  5626. }
  5627. this._isEnabled = null;
  5628. this._timeout = null;
  5629. this._hoverState = null;
  5630. this._activeTrigger = null;
  5631. if (this._popper) {
  5632. this._popper.destroy();
  5633. }
  5634. this._popper = null;
  5635. this.element = null;
  5636. this.config = null;
  5637. this.tip = null;
  5638. };
  5639. _proto.show = function show() {
  5640. var _this = this;
  5641. if ($(this.element).css('display') === 'none') {
  5642. throw new Error('Please use show on visible elements');
  5643. }
  5644. var showEvent = $.Event(this.constructor.Event.SHOW);
  5645. if (this.isWithContent() && this._isEnabled) {
  5646. $(this.element).trigger(showEvent);
  5647. var shadowRoot = Util.findShadowRoot(this.element);
  5648. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5649. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5650. return;
  5651. }
  5652. var tip = this.getTipElement();
  5653. var tipId = Util.getUID(this.constructor.NAME);
  5654. tip.setAttribute('id', tipId);
  5655. this.element.setAttribute('aria-describedby', tipId);
  5656. this.setContent();
  5657. if (this.config.animation) {
  5658. $(tip).addClass(ClassName$6.FADE);
  5659. }
  5660. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5661. var attachment = this._getAttachment(placement);
  5662. this.addAttachmentClass(attachment);
  5663. var container = this._getContainer();
  5664. $(tip).data(this.constructor.DATA_KEY, this);
  5665. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5666. $(tip).appendTo(container);
  5667. }
  5668. $(this.element).trigger(this.constructor.Event.INSERTED);
  5669. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5670. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5671. // empty mouseover listeners to the body's immediate children;
  5672. // only needed because of broken event delegation on iOS
  5673. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5674. if ('ontouchstart' in document.documentElement) {
  5675. $(document.body).children().on('mouseover', null, $.noop);
  5676. }
  5677. var complete = function complete() {
  5678. if (_this.config.animation) {
  5679. _this._fixTransition();
  5680. }
  5681. var prevHoverState = _this._hoverState;
  5682. _this._hoverState = null;
  5683. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5684. if (prevHoverState === HoverState.OUT) {
  5685. _this._leave(null, _this);
  5686. }
  5687. };
  5688. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5689. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5690. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5691. } else {
  5692. complete();
  5693. }
  5694. }
  5695. };
  5696. _proto.hide = function hide(callback) {
  5697. var _this2 = this;
  5698. var tip = this.getTipElement();
  5699. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5700. var complete = function complete() {
  5701. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5702. tip.parentNode.removeChild(tip);
  5703. }
  5704. _this2._cleanTipClass();
  5705. _this2.element.removeAttribute('aria-describedby');
  5706. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5707. if (_this2._popper !== null) {
  5708. _this2._popper.destroy();
  5709. }
  5710. if (callback) {
  5711. callback();
  5712. }
  5713. };
  5714. $(this.element).trigger(hideEvent);
  5715. if (hideEvent.isDefaultPrevented()) {
  5716. return;
  5717. }
  5718. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5719. // empty mouseover listeners we added for iOS support
  5720. if ('ontouchstart' in document.documentElement) {
  5721. $(document.body).children().off('mouseover', null, $.noop);
  5722. }
  5723. this._activeTrigger[Trigger.CLICK] = false;
  5724. this._activeTrigger[Trigger.FOCUS] = false;
  5725. this._activeTrigger[Trigger.HOVER] = false;
  5726. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5727. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5728. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5729. } else {
  5730. complete();
  5731. }
  5732. this._hoverState = '';
  5733. };
  5734. _proto.update = function update() {
  5735. if (this._popper !== null) {
  5736. this._popper.scheduleUpdate();
  5737. }
  5738. } // Protected
  5739. ;
  5740. _proto.isWithContent = function isWithContent() {
  5741. return Boolean(this.getTitle());
  5742. };
  5743. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5744. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5745. };
  5746. _proto.getTipElement = function getTipElement() {
  5747. this.tip = this.tip || $(this.config.template)[0];
  5748. return this.tip;
  5749. };
  5750. _proto.setContent = function setContent() {
  5751. var tip = this.getTipElement();
  5752. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5753. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5754. };
  5755. _proto.setElementContent = function setElementContent($element, content) {
  5756. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5757. // Content is a DOM node or a jQuery
  5758. if (this.config.html) {
  5759. if (!$(content).parent().is($element)) {
  5760. $element.empty().append(content);
  5761. }
  5762. } else {
  5763. $element.text($(content).text());
  5764. }
  5765. return;
  5766. }
  5767. if (this.config.html) {
  5768. if (this.config.sanitize) {
  5769. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5770. }
  5771. $element.html(content);
  5772. } else {
  5773. $element.text(content);
  5774. }
  5775. };
  5776. _proto.getTitle = function getTitle() {
  5777. var title = this.element.getAttribute('data-original-title');
  5778. if (!title) {
  5779. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5780. }
  5781. return title;
  5782. } // Private
  5783. ;
  5784. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5785. var _this3 = this;
  5786. var defaultBsConfig = {
  5787. placement: attachment,
  5788. modifiers: {
  5789. offset: this._getOffset(),
  5790. flip: {
  5791. behavior: this.config.fallbackPlacement
  5792. },
  5793. arrow: {
  5794. element: Selector$6.ARROW
  5795. },
  5796. preventOverflow: {
  5797. boundariesElement: this.config.boundary
  5798. }
  5799. },
  5800. onCreate: function onCreate(data) {
  5801. if (data.originalPlacement !== data.placement) {
  5802. _this3._handlePopperPlacementChange(data);
  5803. }
  5804. },
  5805. onUpdate: function onUpdate(data) {
  5806. return _this3._handlePopperPlacementChange(data);
  5807. }
  5808. };
  5809. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5810. };
  5811. _proto._getOffset = function _getOffset() {
  5812. var _this4 = this;
  5813. var offset = {};
  5814. if (typeof this.config.offset === 'function') {
  5815. offset.fn = function (data) {
  5816. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5817. return data;
  5818. };
  5819. } else {
  5820. offset.offset = this.config.offset;
  5821. }
  5822. return offset;
  5823. };
  5824. _proto._getContainer = function _getContainer() {
  5825. if (this.config.container === false) {
  5826. return document.body;
  5827. }
  5828. if (Util.isElement(this.config.container)) {
  5829. return $(this.config.container);
  5830. }
  5831. return $(document).find(this.config.container);
  5832. };
  5833. _proto._getAttachment = function _getAttachment(placement) {
  5834. return AttachmentMap$1[placement.toUpperCase()];
  5835. };
  5836. _proto._setListeners = function _setListeners() {
  5837. var _this5 = this;
  5838. var triggers = this.config.trigger.split(' ');
  5839. triggers.forEach(function (trigger) {
  5840. if (trigger === 'click') {
  5841. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5842. return _this5.toggle(event);
  5843. });
  5844. } else if (trigger !== Trigger.MANUAL) {
  5845. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5846. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5847. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5848. return _this5._enter(event);
  5849. }).on(eventOut, _this5.config.selector, function (event) {
  5850. return _this5._leave(event);
  5851. });
  5852. }
  5853. });
  5854. this._hideModalHandler = function () {
  5855. if (_this5.element) {
  5856. _this5.hide();
  5857. }
  5858. };
  5859. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5860. if (this.config.selector) {
  5861. this.config = _objectSpread2({}, this.config, {
  5862. trigger: 'manual',
  5863. selector: ''
  5864. });
  5865. } else {
  5866. this._fixTitle();
  5867. }
  5868. };
  5869. _proto._fixTitle = function _fixTitle() {
  5870. var titleType = typeof this.element.getAttribute('data-original-title');
  5871. if (this.element.getAttribute('title') || titleType !== 'string') {
  5872. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5873. this.element.setAttribute('title', '');
  5874. }
  5875. };
  5876. _proto._enter = function _enter(event, context) {
  5877. var dataKey = this.constructor.DATA_KEY;
  5878. context = context || $(event.currentTarget).data(dataKey);
  5879. if (!context) {
  5880. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5881. $(event.currentTarget).data(dataKey, context);
  5882. }
  5883. if (event) {
  5884. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5885. }
  5886. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5887. context._hoverState = HoverState.SHOW;
  5888. return;
  5889. }
  5890. clearTimeout(context._timeout);
  5891. context._hoverState = HoverState.SHOW;
  5892. if (!context.config.delay || !context.config.delay.show) {
  5893. context.show();
  5894. return;
  5895. }
  5896. context._timeout = setTimeout(function () {
  5897. if (context._hoverState === HoverState.SHOW) {
  5898. context.show();
  5899. }
  5900. }, context.config.delay.show);
  5901. };
  5902. _proto._leave = function _leave(event, context) {
  5903. var dataKey = this.constructor.DATA_KEY;
  5904. context = context || $(event.currentTarget).data(dataKey);
  5905. if (!context) {
  5906. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5907. $(event.currentTarget).data(dataKey, context);
  5908. }
  5909. if (event) {
  5910. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5911. }
  5912. if (context._isWithActiveTrigger()) {
  5913. return;
  5914. }
  5915. clearTimeout(context._timeout);
  5916. context._hoverState = HoverState.OUT;
  5917. if (!context.config.delay || !context.config.delay.hide) {
  5918. context.hide();
  5919. return;
  5920. }
  5921. context._timeout = setTimeout(function () {
  5922. if (context._hoverState === HoverState.OUT) {
  5923. context.hide();
  5924. }
  5925. }, context.config.delay.hide);
  5926. };
  5927. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5928. for (var trigger in this._activeTrigger) {
  5929. if (this._activeTrigger[trigger]) {
  5930. return true;
  5931. }
  5932. }
  5933. return false;
  5934. };
  5935. _proto._getConfig = function _getConfig(config) {
  5936. var dataAttributes = $(this.element).data();
  5937. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5938. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5939. delete dataAttributes[dataAttr];
  5940. }
  5941. });
  5942. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5943. if (typeof config.delay === 'number') {
  5944. config.delay = {
  5945. show: config.delay,
  5946. hide: config.delay
  5947. };
  5948. }
  5949. if (typeof config.title === 'number') {
  5950. config.title = config.title.toString();
  5951. }
  5952. if (typeof config.content === 'number') {
  5953. config.content = config.content.toString();
  5954. }
  5955. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5956. if (config.sanitize) {
  5957. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5958. }
  5959. return config;
  5960. };
  5961. _proto._getDelegateConfig = function _getDelegateConfig() {
  5962. var config = {};
  5963. if (this.config) {
  5964. for (var key in this.config) {
  5965. if (this.constructor.Default[key] !== this.config[key]) {
  5966. config[key] = this.config[key];
  5967. }
  5968. }
  5969. }
  5970. return config;
  5971. };
  5972. _proto._cleanTipClass = function _cleanTipClass() {
  5973. var $tip = $(this.getTipElement());
  5974. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5975. if (tabClass !== null && tabClass.length) {
  5976. $tip.removeClass(tabClass.join(''));
  5977. }
  5978. };
  5979. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5980. var popperInstance = popperData.instance;
  5981. this.tip = popperInstance.popper;
  5982. this._cleanTipClass();
  5983. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5984. };
  5985. _proto._fixTransition = function _fixTransition() {
  5986. var tip = this.getTipElement();
  5987. var initConfigAnimation = this.config.animation;
  5988. if (tip.getAttribute('x-placement') !== null) {
  5989. return;
  5990. }
  5991. $(tip).removeClass(ClassName$6.FADE);
  5992. this.config.animation = false;
  5993. this.hide();
  5994. this.show();
  5995. this.config.animation = initConfigAnimation;
  5996. } // Static
  5997. ;
  5998. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5999. return this.each(function () {
  6000. var data = $(this).data(DATA_KEY$6);
  6001. var _config = typeof config === 'object' && config;
  6002. if (!data && /dispose|hide/.test(config)) {
  6003. return;
  6004. }
  6005. if (!data) {
  6006. data = new Tooltip(this, _config);
  6007. $(this).data(DATA_KEY$6, data);
  6008. }
  6009. if (typeof config === 'string') {
  6010. if (typeof data[config] === 'undefined') {
  6011. throw new TypeError("No method named \"" + config + "\"");
  6012. }
  6013. data[config]();
  6014. }
  6015. });
  6016. };
  6017. _createClass(Tooltip, null, [{
  6018. key: "VERSION",
  6019. get: function get() {
  6020. return VERSION$6;
  6021. }
  6022. }, {
  6023. key: "Default",
  6024. get: function get() {
  6025. return Default$4;
  6026. }
  6027. }, {
  6028. key: "NAME",
  6029. get: function get() {
  6030. return NAME$6;
  6031. }
  6032. }, {
  6033. key: "DATA_KEY",
  6034. get: function get() {
  6035. return DATA_KEY$6;
  6036. }
  6037. }, {
  6038. key: "Event",
  6039. get: function get() {
  6040. return Event$6;
  6041. }
  6042. }, {
  6043. key: "EVENT_KEY",
  6044. get: function get() {
  6045. return EVENT_KEY$6;
  6046. }
  6047. }, {
  6048. key: "DefaultType",
  6049. get: function get() {
  6050. return DefaultType$4;
  6051. }
  6052. }]);
  6053. return Tooltip;
  6054. }();
  6055. /**
  6056. * ------------------------------------------------------------------------
  6057. * jQuery
  6058. * ------------------------------------------------------------------------
  6059. */
  6060. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6061. $.fn[NAME$6].Constructor = Tooltip;
  6062. $.fn[NAME$6].noConflict = function () {
  6063. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6064. return Tooltip._jQueryInterface;
  6065. };
  6066. /**
  6067. * ------------------------------------------------------------------------
  6068. * Constants
  6069. * ------------------------------------------------------------------------
  6070. */
  6071. var NAME$7 = 'popover';
  6072. var VERSION$7 = '4.4.1';
  6073. var DATA_KEY$7 = 'bs.popover';
  6074. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6075. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6076. var CLASS_PREFIX$1 = 'bs-popover';
  6077. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6078. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6079. placement: 'right',
  6080. trigger: 'click',
  6081. content: '',
  6082. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6083. });
  6084. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6085. content: '(string|element|function)'
  6086. });
  6087. var ClassName$7 = {
  6088. FADE: 'fade',
  6089. SHOW: 'show'
  6090. };
  6091. var Selector$7 = {
  6092. TITLE: '.popover-header',
  6093. CONTENT: '.popover-body'
  6094. };
  6095. var Event$7 = {
  6096. HIDE: "hide" + EVENT_KEY$7,
  6097. HIDDEN: "hidden" + EVENT_KEY$7,
  6098. SHOW: "show" + EVENT_KEY$7,
  6099. SHOWN: "shown" + EVENT_KEY$7,
  6100. INSERTED: "inserted" + EVENT_KEY$7,
  6101. CLICK: "click" + EVENT_KEY$7,
  6102. FOCUSIN: "focusin" + EVENT_KEY$7,
  6103. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6104. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6105. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6106. };
  6107. /**
  6108. * ------------------------------------------------------------------------
  6109. * Class Definition
  6110. * ------------------------------------------------------------------------
  6111. */
  6112. var Popover =
  6113. /*#__PURE__*/
  6114. function (_Tooltip) {
  6115. _inheritsLoose(Popover, _Tooltip);
  6116. function Popover() {
  6117. return _Tooltip.apply(this, arguments) || this;
  6118. }
  6119. var _proto = Popover.prototype;
  6120. // Overrides
  6121. _proto.isWithContent = function isWithContent() {
  6122. return this.getTitle() || this._getContent();
  6123. };
  6124. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6125. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6126. };
  6127. _proto.getTipElement = function getTipElement() {
  6128. this.tip = this.tip || $(this.config.template)[0];
  6129. return this.tip;
  6130. };
  6131. _proto.setContent = function setContent() {
  6132. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6133. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6134. var content = this._getContent();
  6135. if (typeof content === 'function') {
  6136. content = content.call(this.element);
  6137. }
  6138. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6139. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6140. } // Private
  6141. ;
  6142. _proto._getContent = function _getContent() {
  6143. return this.element.getAttribute('data-content') || this.config.content;
  6144. };
  6145. _proto._cleanTipClass = function _cleanTipClass() {
  6146. var $tip = $(this.getTipElement());
  6147. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6148. if (tabClass !== null && tabClass.length > 0) {
  6149. $tip.removeClass(tabClass.join(''));
  6150. }
  6151. } // Static
  6152. ;
  6153. Popover._jQueryInterface = function _jQueryInterface(config) {
  6154. return this.each(function () {
  6155. var data = $(this).data(DATA_KEY$7);
  6156. var _config = typeof config === 'object' ? config : null;
  6157. if (!data && /dispose|hide/.test(config)) {
  6158. return;
  6159. }
  6160. if (!data) {
  6161. data = new Popover(this, _config);
  6162. $(this).data(DATA_KEY$7, data);
  6163. }
  6164. if (typeof config === 'string') {
  6165. if (typeof data[config] === 'undefined') {
  6166. throw new TypeError("No method named \"" + config + "\"");
  6167. }
  6168. data[config]();
  6169. }
  6170. });
  6171. };
  6172. _createClass(Popover, null, [{
  6173. key: "VERSION",
  6174. // Getters
  6175. get: function get() {
  6176. return VERSION$7;
  6177. }
  6178. }, {
  6179. key: "Default",
  6180. get: function get() {
  6181. return Default$5;
  6182. }
  6183. }, {
  6184. key: "NAME",
  6185. get: function get() {
  6186. return NAME$7;
  6187. }
  6188. }, {
  6189. key: "DATA_KEY",
  6190. get: function get() {
  6191. return DATA_KEY$7;
  6192. }
  6193. }, {
  6194. key: "Event",
  6195. get: function get() {
  6196. return Event$7;
  6197. }
  6198. }, {
  6199. key: "EVENT_KEY",
  6200. get: function get() {
  6201. return EVENT_KEY$7;
  6202. }
  6203. }, {
  6204. key: "DefaultType",
  6205. get: function get() {
  6206. return DefaultType$5;
  6207. }
  6208. }]);
  6209. return Popover;
  6210. }(Tooltip);
  6211. /**
  6212. * ------------------------------------------------------------------------
  6213. * jQuery
  6214. * ------------------------------------------------------------------------
  6215. */
  6216. $.fn[NAME$7] = Popover._jQueryInterface;
  6217. $.fn[NAME$7].Constructor = Popover;
  6218. $.fn[NAME$7].noConflict = function () {
  6219. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6220. return Popover._jQueryInterface;
  6221. };
  6222. /**
  6223. * ------------------------------------------------------------------------
  6224. * Constants
  6225. * ------------------------------------------------------------------------
  6226. */
  6227. var NAME$8 = 'scrollspy';
  6228. var VERSION$8 = '4.4.1';
  6229. var DATA_KEY$8 = 'bs.scrollspy';
  6230. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6231. var DATA_API_KEY$6 = '.data-api';
  6232. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6233. var Default$6 = {
  6234. offset: 10,
  6235. method: 'auto',
  6236. target: ''
  6237. };
  6238. var DefaultType$6 = {
  6239. offset: 'number',
  6240. method: 'string',
  6241. target: '(string|element)'
  6242. };
  6243. var Event$8 = {
  6244. ACTIVATE: "activate" + EVENT_KEY$8,
  6245. SCROLL: "scroll" + EVENT_KEY$8,
  6246. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6247. };
  6248. var ClassName$8 = {
  6249. DROPDOWN_ITEM: 'dropdown-item',
  6250. DROPDOWN_MENU: 'dropdown-menu',
  6251. ACTIVE: 'active'
  6252. };
  6253. var Selector$8 = {
  6254. DATA_SPY: '[data-spy="scroll"]',
  6255. ACTIVE: '.active',
  6256. NAV_LIST_GROUP: '.nav, .list-group',
  6257. NAV_LINKS: '.nav-link',
  6258. NAV_ITEMS: '.nav-item',
  6259. LIST_ITEMS: '.list-group-item',
  6260. DROPDOWN: '.dropdown',
  6261. DROPDOWN_ITEMS: '.dropdown-item',
  6262. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6263. };
  6264. var OffsetMethod = {
  6265. OFFSET: 'offset',
  6266. POSITION: 'position'
  6267. };
  6268. /**
  6269. * ------------------------------------------------------------------------
  6270. * Class Definition
  6271. * ------------------------------------------------------------------------
  6272. */
  6273. var ScrollSpy =
  6274. /*#__PURE__*/
  6275. function () {
  6276. function ScrollSpy(element, config) {
  6277. var _this = this;
  6278. this._element = element;
  6279. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6280. this._config = this._getConfig(config);
  6281. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6282. this._offsets = [];
  6283. this._targets = [];
  6284. this._activeTarget = null;
  6285. this._scrollHeight = 0;
  6286. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6287. return _this._process(event);
  6288. });
  6289. this.refresh();
  6290. this._process();
  6291. } // Getters
  6292. var _proto = ScrollSpy.prototype;
  6293. // Public
  6294. _proto.refresh = function refresh() {
  6295. var _this2 = this;
  6296. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6297. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6298. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6299. this._offsets = [];
  6300. this._targets = [];
  6301. this._scrollHeight = this._getScrollHeight();
  6302. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6303. targets.map(function (element) {
  6304. var target;
  6305. var targetSelector = Util.getSelectorFromElement(element);
  6306. if (targetSelector) {
  6307. target = document.querySelector(targetSelector);
  6308. }
  6309. if (target) {
  6310. var targetBCR = target.getBoundingClientRect();
  6311. if (targetBCR.width || targetBCR.height) {
  6312. // TODO (fat): remove sketch reliance on jQuery position/offset
  6313. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6314. }
  6315. }
  6316. return null;
  6317. }).filter(function (item) {
  6318. return item;
  6319. }).sort(function (a, b) {
  6320. return a[0] - b[0];
  6321. }).forEach(function (item) {
  6322. _this2._offsets.push(item[0]);
  6323. _this2._targets.push(item[1]);
  6324. });
  6325. };
  6326. _proto.dispose = function dispose() {
  6327. $.removeData(this._element, DATA_KEY$8);
  6328. $(this._scrollElement).off(EVENT_KEY$8);
  6329. this._element = null;
  6330. this._scrollElement = null;
  6331. this._config = null;
  6332. this._selector = null;
  6333. this._offsets = null;
  6334. this._targets = null;
  6335. this._activeTarget = null;
  6336. this._scrollHeight = null;
  6337. } // Private
  6338. ;
  6339. _proto._getConfig = function _getConfig(config) {
  6340. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6341. if (typeof config.target !== 'string') {
  6342. var id = $(config.target).attr('id');
  6343. if (!id) {
  6344. id = Util.getUID(NAME$8);
  6345. $(config.target).attr('id', id);
  6346. }
  6347. config.target = "#" + id;
  6348. }
  6349. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6350. return config;
  6351. };
  6352. _proto._getScrollTop = function _getScrollTop() {
  6353. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6354. };
  6355. _proto._getScrollHeight = function _getScrollHeight() {
  6356. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6357. };
  6358. _proto._getOffsetHeight = function _getOffsetHeight() {
  6359. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6360. };
  6361. _proto._process = function _process() {
  6362. var scrollTop = this._getScrollTop() + this._config.offset;
  6363. var scrollHeight = this._getScrollHeight();
  6364. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6365. if (this._scrollHeight !== scrollHeight) {
  6366. this.refresh();
  6367. }
  6368. if (scrollTop >= maxScroll) {
  6369. var target = this._targets[this._targets.length - 1];
  6370. if (this._activeTarget !== target) {
  6371. this._activate(target);
  6372. }
  6373. return;
  6374. }
  6375. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6376. this._activeTarget = null;
  6377. this._clear();
  6378. return;
  6379. }
  6380. var offsetLength = this._offsets.length;
  6381. for (var i = offsetLength; i--;) {
  6382. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6383. if (isActiveTarget) {
  6384. this._activate(this._targets[i]);
  6385. }
  6386. }
  6387. };
  6388. _proto._activate = function _activate(target) {
  6389. this._activeTarget = target;
  6390. this._clear();
  6391. var queries = this._selector.split(',').map(function (selector) {
  6392. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6393. });
  6394. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6395. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6396. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6397. $link.addClass(ClassName$8.ACTIVE);
  6398. } else {
  6399. // Set triggered link as active
  6400. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6401. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6402. $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
  6403. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6404. }
  6405. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6406. relatedTarget: target
  6407. });
  6408. };
  6409. _proto._clear = function _clear() {
  6410. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6411. return node.classList.contains(ClassName$8.ACTIVE);
  6412. }).forEach(function (node) {
  6413. return node.classList.remove(ClassName$8.ACTIVE);
  6414. });
  6415. } // Static
  6416. ;
  6417. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6418. return this.each(function () {
  6419. var data = $(this).data(DATA_KEY$8);
  6420. var _config = typeof config === 'object' && config;
  6421. if (!data) {
  6422. data = new ScrollSpy(this, _config);
  6423. $(this).data(DATA_KEY$8, data);
  6424. }
  6425. if (typeof config === 'string') {
  6426. if (typeof data[config] === 'undefined') {
  6427. throw new TypeError("No method named \"" + config + "\"");
  6428. }
  6429. data[config]();
  6430. }
  6431. });
  6432. };
  6433. _createClass(ScrollSpy, null, [{
  6434. key: "VERSION",
  6435. get: function get() {
  6436. return VERSION$8;
  6437. }
  6438. }, {
  6439. key: "Default",
  6440. get: function get() {
  6441. return Default$6;
  6442. }
  6443. }]);
  6444. return ScrollSpy;
  6445. }();
  6446. /**
  6447. * ------------------------------------------------------------------------
  6448. * Data Api implementation
  6449. * ------------------------------------------------------------------------
  6450. */
  6451. $(window).on(Event$8.LOAD_DATA_API, function () {
  6452. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6453. var scrollSpysLength = scrollSpys.length;
  6454. for (var i = scrollSpysLength; i--;) {
  6455. var $spy = $(scrollSpys[i]);
  6456. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6457. }
  6458. });
  6459. /**
  6460. * ------------------------------------------------------------------------
  6461. * jQuery
  6462. * ------------------------------------------------------------------------
  6463. */
  6464. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6465. $.fn[NAME$8].Constructor = ScrollSpy;
  6466. $.fn[NAME$8].noConflict = function () {
  6467. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6468. return ScrollSpy._jQueryInterface;
  6469. };
  6470. /**
  6471. * ------------------------------------------------------------------------
  6472. * Constants
  6473. * ------------------------------------------------------------------------
  6474. */
  6475. var NAME$9 = 'tab';
  6476. var VERSION$9 = '4.4.1';
  6477. var DATA_KEY$9 = 'bs.tab';
  6478. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6479. var DATA_API_KEY$7 = '.data-api';
  6480. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6481. var Event$9 = {
  6482. HIDE: "hide" + EVENT_KEY$9,
  6483. HIDDEN: "hidden" + EVENT_KEY$9,
  6484. SHOW: "show" + EVENT_KEY$9,
  6485. SHOWN: "shown" + EVENT_KEY$9,
  6486. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6487. };
  6488. var ClassName$9 = {
  6489. DROPDOWN_MENU: 'dropdown-menu',
  6490. ACTIVE: 'active',
  6491. DISABLED: 'disabled',
  6492. FADE: 'fade',
  6493. SHOW: 'show'
  6494. };
  6495. var Selector$9 = {
  6496. DROPDOWN: '.dropdown',
  6497. NAV_LIST_GROUP: '.nav, .list-group',
  6498. ACTIVE: '.active',
  6499. ACTIVE_UL: '> li > .active',
  6500. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6501. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6502. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6503. };
  6504. /**
  6505. * ------------------------------------------------------------------------
  6506. * Class Definition
  6507. * ------------------------------------------------------------------------
  6508. */
  6509. var Tab =
  6510. /*#__PURE__*/
  6511. function () {
  6512. function Tab(element) {
  6513. this._element = element;
  6514. } // Getters
  6515. var _proto = Tab.prototype;
  6516. // Public
  6517. _proto.show = function show() {
  6518. var _this = this;
  6519. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6520. return;
  6521. }
  6522. var target;
  6523. var previous;
  6524. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6525. var selector = Util.getSelectorFromElement(this._element);
  6526. if (listElement) {
  6527. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6528. previous = $.makeArray($(listElement).find(itemSelector));
  6529. previous = previous[previous.length - 1];
  6530. }
  6531. var hideEvent = $.Event(Event$9.HIDE, {
  6532. relatedTarget: this._element
  6533. });
  6534. var showEvent = $.Event(Event$9.SHOW, {
  6535. relatedTarget: previous
  6536. });
  6537. if (previous) {
  6538. $(previous).trigger(hideEvent);
  6539. }
  6540. $(this._element).trigger(showEvent);
  6541. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6542. return;
  6543. }
  6544. if (selector) {
  6545. target = document.querySelector(selector);
  6546. }
  6547. this._activate(this._element, listElement);
  6548. var complete = function complete() {
  6549. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6550. relatedTarget: _this._element
  6551. });
  6552. var shownEvent = $.Event(Event$9.SHOWN, {
  6553. relatedTarget: previous
  6554. });
  6555. $(previous).trigger(hiddenEvent);
  6556. $(_this._element).trigger(shownEvent);
  6557. };
  6558. if (target) {
  6559. this._activate(target, target.parentNode, complete);
  6560. } else {
  6561. complete();
  6562. }
  6563. };
  6564. _proto.dispose = function dispose() {
  6565. $.removeData(this._element, DATA_KEY$9);
  6566. this._element = null;
  6567. } // Private
  6568. ;
  6569. _proto._activate = function _activate(element, container, callback) {
  6570. var _this2 = this;
  6571. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6572. var active = activeElements[0];
  6573. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6574. var complete = function complete() {
  6575. return _this2._transitionComplete(element, active, callback);
  6576. };
  6577. if (active && isTransitioning) {
  6578. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6579. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6580. } else {
  6581. complete();
  6582. }
  6583. };
  6584. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6585. if (active) {
  6586. $(active).removeClass(ClassName$9.ACTIVE);
  6587. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6588. if (dropdownChild) {
  6589. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6590. }
  6591. if (active.getAttribute('role') === 'tab') {
  6592. active.setAttribute('aria-selected', false);
  6593. }
  6594. }
  6595. $(element).addClass(ClassName$9.ACTIVE);
  6596. if (element.getAttribute('role') === 'tab') {
  6597. element.setAttribute('aria-selected', true);
  6598. }
  6599. Util.reflow(element);
  6600. if (element.classList.contains(ClassName$9.FADE)) {
  6601. element.classList.add(ClassName$9.SHOW);
  6602. }
  6603. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6604. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6605. if (dropdownElement) {
  6606. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6607. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6608. }
  6609. element.setAttribute('aria-expanded', true);
  6610. }
  6611. if (callback) {
  6612. callback();
  6613. }
  6614. } // Static
  6615. ;
  6616. Tab._jQueryInterface = function _jQueryInterface(config) {
  6617. return this.each(function () {
  6618. var $this = $(this);
  6619. var data = $this.data(DATA_KEY$9);
  6620. if (!data) {
  6621. data = new Tab(this);
  6622. $this.data(DATA_KEY$9, data);
  6623. }
  6624. if (typeof config === 'string') {
  6625. if (typeof data[config] === 'undefined') {
  6626. throw new TypeError("No method named \"" + config + "\"");
  6627. }
  6628. data[config]();
  6629. }
  6630. });
  6631. };
  6632. _createClass(Tab, null, [{
  6633. key: "VERSION",
  6634. get: function get() {
  6635. return VERSION$9;
  6636. }
  6637. }]);
  6638. return Tab;
  6639. }();
  6640. /**
  6641. * ------------------------------------------------------------------------
  6642. * Data Api implementation
  6643. * ------------------------------------------------------------------------
  6644. */
  6645. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6646. event.preventDefault();
  6647. Tab._jQueryInterface.call($(this), 'show');
  6648. });
  6649. /**
  6650. * ------------------------------------------------------------------------
  6651. * jQuery
  6652. * ------------------------------------------------------------------------
  6653. */
  6654. $.fn[NAME$9] = Tab._jQueryInterface;
  6655. $.fn[NAME$9].Constructor = Tab;
  6656. $.fn[NAME$9].noConflict = function () {
  6657. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6658. return Tab._jQueryInterface;
  6659. };
  6660. /**
  6661. * ------------------------------------------------------------------------
  6662. * Constants
  6663. * ------------------------------------------------------------------------
  6664. */
  6665. var NAME$a = 'toast';
  6666. var VERSION$a = '4.4.1';
  6667. var DATA_KEY$a = 'bs.toast';
  6668. var EVENT_KEY$a = "." + DATA_KEY$a;
  6669. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6670. var Event$a = {
  6671. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6672. HIDE: "hide" + EVENT_KEY$a,
  6673. HIDDEN: "hidden" + EVENT_KEY$a,
  6674. SHOW: "show" + EVENT_KEY$a,
  6675. SHOWN: "shown" + EVENT_KEY$a
  6676. };
  6677. var ClassName$a = {
  6678. FADE: 'fade',
  6679. HIDE: 'hide',
  6680. SHOW: 'show',
  6681. SHOWING: 'showing'
  6682. };
  6683. var DefaultType$7 = {
  6684. animation: 'boolean',
  6685. autohide: 'boolean',
  6686. delay: 'number'
  6687. };
  6688. var Default$7 = {
  6689. animation: true,
  6690. autohide: true,
  6691. delay: 500
  6692. };
  6693. var Selector$a = {
  6694. DATA_DISMISS: '[data-dismiss="toast"]'
  6695. };
  6696. /**
  6697. * ------------------------------------------------------------------------
  6698. * Class Definition
  6699. * ------------------------------------------------------------------------
  6700. */
  6701. var Toast =
  6702. /*#__PURE__*/
  6703. function () {
  6704. function Toast(element, config) {
  6705. this._element = element;
  6706. this._config = this._getConfig(config);
  6707. this._timeout = null;
  6708. this._setListeners();
  6709. } // Getters
  6710. var _proto = Toast.prototype;
  6711. // Public
  6712. _proto.show = function show() {
  6713. var _this = this;
  6714. var showEvent = $.Event(Event$a.SHOW);
  6715. $(this._element).trigger(showEvent);
  6716. if (showEvent.isDefaultPrevented()) {
  6717. return;
  6718. }
  6719. if (this._config.animation) {
  6720. this._element.classList.add(ClassName$a.FADE);
  6721. }
  6722. var complete = function complete() {
  6723. _this._element.classList.remove(ClassName$a.SHOWING);
  6724. _this._element.classList.add(ClassName$a.SHOW);
  6725. $(_this._element).trigger(Event$a.SHOWN);
  6726. if (_this._config.autohide) {
  6727. _this._timeout = setTimeout(function () {
  6728. _this.hide();
  6729. }, _this._config.delay);
  6730. }
  6731. };
  6732. this._element.classList.remove(ClassName$a.HIDE);
  6733. Util.reflow(this._element);
  6734. this._element.classList.add(ClassName$a.SHOWING);
  6735. if (this._config.animation) {
  6736. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6737. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6738. } else {
  6739. complete();
  6740. }
  6741. };
  6742. _proto.hide = function hide() {
  6743. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6744. return;
  6745. }
  6746. var hideEvent = $.Event(Event$a.HIDE);
  6747. $(this._element).trigger(hideEvent);
  6748. if (hideEvent.isDefaultPrevented()) {
  6749. return;
  6750. }
  6751. this._close();
  6752. };
  6753. _proto.dispose = function dispose() {
  6754. clearTimeout(this._timeout);
  6755. this._timeout = null;
  6756. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6757. this._element.classList.remove(ClassName$a.SHOW);
  6758. }
  6759. $(this._element).off(Event$a.CLICK_DISMISS);
  6760. $.removeData(this._element, DATA_KEY$a);
  6761. this._element = null;
  6762. this._config = null;
  6763. } // Private
  6764. ;
  6765. _proto._getConfig = function _getConfig(config) {
  6766. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6767. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6768. return config;
  6769. };
  6770. _proto._setListeners = function _setListeners() {
  6771. var _this2 = this;
  6772. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6773. return _this2.hide();
  6774. });
  6775. };
  6776. _proto._close = function _close() {
  6777. var _this3 = this;
  6778. var complete = function complete() {
  6779. _this3._element.classList.add(ClassName$a.HIDE);
  6780. $(_this3._element).trigger(Event$a.HIDDEN);
  6781. };
  6782. this._element.classList.remove(ClassName$a.SHOW);
  6783. if (this._config.animation) {
  6784. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6785. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6786. } else {
  6787. complete();
  6788. }
  6789. } // Static
  6790. ;
  6791. Toast._jQueryInterface = function _jQueryInterface(config) {
  6792. return this.each(function () {
  6793. var $element = $(this);
  6794. var data = $element.data(DATA_KEY$a);
  6795. var _config = typeof config === 'object' && config;
  6796. if (!data) {
  6797. data = new Toast(this, _config);
  6798. $element.data(DATA_KEY$a, data);
  6799. }
  6800. if (typeof config === 'string') {
  6801. if (typeof data[config] === 'undefined') {
  6802. throw new TypeError("No method named \"" + config + "\"");
  6803. }
  6804. data[config](this);
  6805. }
  6806. });
  6807. };
  6808. _createClass(Toast, null, [{
  6809. key: "VERSION",
  6810. get: function get() {
  6811. return VERSION$a;
  6812. }
  6813. }, {
  6814. key: "DefaultType",
  6815. get: function get() {
  6816. return DefaultType$7;
  6817. }
  6818. }, {
  6819. key: "Default",
  6820. get: function get() {
  6821. return Default$7;
  6822. }
  6823. }]);
  6824. return Toast;
  6825. }();
  6826. /**
  6827. * ------------------------------------------------------------------------
  6828. * jQuery
  6829. * ------------------------------------------------------------------------
  6830. */
  6831. $.fn[NAME$a] = Toast._jQueryInterface;
  6832. $.fn[NAME$a].Constructor = Toast;
  6833. $.fn[NAME$a].noConflict = function () {
  6834. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6835. return Toast._jQueryInterface;
  6836. };
  6837. exports.Alert = Alert;
  6838. exports.Button = Button;
  6839. exports.Carousel = Carousel;
  6840. exports.Collapse = Collapse;
  6841. exports.Dropdown = Dropdown;
  6842. exports.Modal = Modal;
  6843. exports.Popover = Popover;
  6844. exports.Scrollspy = ScrollSpy;
  6845. exports.Tab = Tab;
  6846. exports.Toast = Toast;
  6847. exports.Tooltip = Tooltip;
  6848. exports.Util = Util;
  6849. Object.defineProperty(exports, '__esModule', { value: true });
  6850. })));
  6851. //# sourceMappingURL=bootstrap.js.map
  6852. /***/ }),
  6853. /***/ "./node_modules/buffer/index.js":
  6854. /*!**************************************!*\
  6855. !*** ./node_modules/buffer/index.js ***!
  6856. \**************************************/
  6857. /*! no static exports found */
  6858. /***/ (function(module, exports, __webpack_require__) {
  6859. "use strict";
  6860. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6861. * The buffer module from node.js, for the browser.
  6862. *
  6863. * @author Feross Aboukhadijeh <http://feross.org>
  6864. * @license MIT
  6865. */
  6866. /* eslint-disable no-proto */
  6867. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6868. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6869. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6870. exports.Buffer = Buffer
  6871. exports.SlowBuffer = SlowBuffer
  6872. exports.INSPECT_MAX_BYTES = 50
  6873. /**
  6874. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6875. * === true Use Uint8Array implementation (fastest)
  6876. * === false Use Object implementation (most compatible, even IE6)
  6877. *
  6878. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6879. * Opera 11.6+, iOS 4.2+.
  6880. *
  6881. * Due to various browser bugs, sometimes the Object implementation will be used even
  6882. * when the browser supports typed arrays.
  6883. *
  6884. * Note:
  6885. *
  6886. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6887. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6888. *
  6889. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6890. *
  6891. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6892. * incorrect length in some situations.
  6893. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6894. * get the Object implementation, which is slower but behaves correctly.
  6895. */
  6896. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6897. ? global.TYPED_ARRAY_SUPPORT
  6898. : typedArraySupport()
  6899. /*
  6900. * Export kMaxLength after typed array support is determined.
  6901. */
  6902. exports.kMaxLength = kMaxLength()
  6903. function typedArraySupport () {
  6904. try {
  6905. var arr = new Uint8Array(1)
  6906. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6907. return arr.foo() === 42 && // typed array instances can be augmented
  6908. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6909. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6910. } catch (e) {
  6911. return false
  6912. }
  6913. }
  6914. function kMaxLength () {
  6915. return Buffer.TYPED_ARRAY_SUPPORT
  6916. ? 0x7fffffff
  6917. : 0x3fffffff
  6918. }
  6919. function createBuffer (that, length) {
  6920. if (kMaxLength() < length) {
  6921. throw new RangeError('Invalid typed array length')
  6922. }
  6923. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6924. // Return an augmented `Uint8Array` instance, for best performance
  6925. that = new Uint8Array(length)
  6926. that.__proto__ = Buffer.prototype
  6927. } else {
  6928. // Fallback: Return an object instance of the Buffer class
  6929. if (that === null) {
  6930. that = new Buffer(length)
  6931. }
  6932. that.length = length
  6933. }
  6934. return that
  6935. }
  6936. /**
  6937. * The Buffer constructor returns instances of `Uint8Array` that have their
  6938. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6939. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6940. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6941. * returns a single octet.
  6942. *
  6943. * The `Uint8Array` prototype remains unmodified.
  6944. */
  6945. function Buffer (arg, encodingOrOffset, length) {
  6946. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6947. return new Buffer(arg, encodingOrOffset, length)
  6948. }
  6949. // Common case.
  6950. if (typeof arg === 'number') {
  6951. if (typeof encodingOrOffset === 'string') {
  6952. throw new Error(
  6953. 'If encoding is specified then the first argument must be a string'
  6954. )
  6955. }
  6956. return allocUnsafe(this, arg)
  6957. }
  6958. return from(this, arg, encodingOrOffset, length)
  6959. }
  6960. Buffer.poolSize = 8192 // not used by this implementation
  6961. // TODO: Legacy, not needed anymore. Remove in next major version.
  6962. Buffer._augment = function (arr) {
  6963. arr.__proto__ = Buffer.prototype
  6964. return arr
  6965. }
  6966. function from (that, value, encodingOrOffset, length) {
  6967. if (typeof value === 'number') {
  6968. throw new TypeError('"value" argument must not be a number')
  6969. }
  6970. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6971. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6972. }
  6973. if (typeof value === 'string') {
  6974. return fromString(that, value, encodingOrOffset)
  6975. }
  6976. return fromObject(that, value)
  6977. }
  6978. /**
  6979. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6980. * if value is a number.
  6981. * Buffer.from(str[, encoding])
  6982. * Buffer.from(array)
  6983. * Buffer.from(buffer)
  6984. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6985. **/
  6986. Buffer.from = function (value, encodingOrOffset, length) {
  6987. return from(null, value, encodingOrOffset, length)
  6988. }
  6989. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6990. Buffer.prototype.__proto__ = Uint8Array.prototype
  6991. Buffer.__proto__ = Uint8Array
  6992. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6993. Buffer[Symbol.species] === Buffer) {
  6994. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6995. Object.defineProperty(Buffer, Symbol.species, {
  6996. value: null,
  6997. configurable: true
  6998. })
  6999. }
  7000. }
  7001. function assertSize (size) {
  7002. if (typeof size !== 'number') {
  7003. throw new TypeError('"size" argument must be a number')
  7004. } else if (size < 0) {
  7005. throw new RangeError('"size" argument must not be negative')
  7006. }
  7007. }
  7008. function alloc (that, size, fill, encoding) {
  7009. assertSize(size)
  7010. if (size <= 0) {
  7011. return createBuffer(that, size)
  7012. }
  7013. if (fill !== undefined) {
  7014. // Only pay attention to encoding if it's a string. This
  7015. // prevents accidentally sending in a number that would
  7016. // be interpretted as a start offset.
  7017. return typeof encoding === 'string'
  7018. ? createBuffer(that, size).fill(fill, encoding)
  7019. : createBuffer(that, size).fill(fill)
  7020. }
  7021. return createBuffer(that, size)
  7022. }
  7023. /**
  7024. * Creates a new filled Buffer instance.
  7025. * alloc(size[, fill[, encoding]])
  7026. **/
  7027. Buffer.alloc = function (size, fill, encoding) {
  7028. return alloc(null, size, fill, encoding)
  7029. }
  7030. function allocUnsafe (that, size) {
  7031. assertSize(size)
  7032. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7033. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7034. for (var i = 0; i < size; ++i) {
  7035. that[i] = 0
  7036. }
  7037. }
  7038. return that
  7039. }
  7040. /**
  7041. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7042. * */
  7043. Buffer.allocUnsafe = function (size) {
  7044. return allocUnsafe(null, size)
  7045. }
  7046. /**
  7047. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7048. */
  7049. Buffer.allocUnsafeSlow = function (size) {
  7050. return allocUnsafe(null, size)
  7051. }
  7052. function fromString (that, string, encoding) {
  7053. if (typeof encoding !== 'string' || encoding === '') {
  7054. encoding = 'utf8'
  7055. }
  7056. if (!Buffer.isEncoding(encoding)) {
  7057. throw new TypeError('"encoding" must be a valid string encoding')
  7058. }
  7059. var length = byteLength(string, encoding) | 0
  7060. that = createBuffer(that, length)
  7061. var actual = that.write(string, encoding)
  7062. if (actual !== length) {
  7063. // Writing a hex string, for example, that contains invalid characters will
  7064. // cause everything after the first invalid character to be ignored. (e.g.
  7065. // 'abxxcd' will be treated as 'ab')
  7066. that = that.slice(0, actual)
  7067. }
  7068. return that
  7069. }
  7070. function fromArrayLike (that, array) {
  7071. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7072. that = createBuffer(that, length)
  7073. for (var i = 0; i < length; i += 1) {
  7074. that[i] = array[i] & 255
  7075. }
  7076. return that
  7077. }
  7078. function fromArrayBuffer (that, array, byteOffset, length) {
  7079. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7080. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7081. throw new RangeError('\'offset\' is out of bounds')
  7082. }
  7083. if (array.byteLength < byteOffset + (length || 0)) {
  7084. throw new RangeError('\'length\' is out of bounds')
  7085. }
  7086. if (byteOffset === undefined && length === undefined) {
  7087. array = new Uint8Array(array)
  7088. } else if (length === undefined) {
  7089. array = new Uint8Array(array, byteOffset)
  7090. } else {
  7091. array = new Uint8Array(array, byteOffset, length)
  7092. }
  7093. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7094. // Return an augmented `Uint8Array` instance, for best performance
  7095. that = array
  7096. that.__proto__ = Buffer.prototype
  7097. } else {
  7098. // Fallback: Return an object instance of the Buffer class
  7099. that = fromArrayLike(that, array)
  7100. }
  7101. return that
  7102. }
  7103. function fromObject (that, obj) {
  7104. if (Buffer.isBuffer(obj)) {
  7105. var len = checked(obj.length) | 0
  7106. that = createBuffer(that, len)
  7107. if (that.length === 0) {
  7108. return that
  7109. }
  7110. obj.copy(that, 0, 0, len)
  7111. return that
  7112. }
  7113. if (obj) {
  7114. if ((typeof ArrayBuffer !== 'undefined' &&
  7115. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7116. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7117. return createBuffer(that, 0)
  7118. }
  7119. return fromArrayLike(that, obj)
  7120. }
  7121. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7122. return fromArrayLike(that, obj.data)
  7123. }
  7124. }
  7125. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7126. }
  7127. function checked (length) {
  7128. // Note: cannot use `length < kMaxLength()` here because that fails when
  7129. // length is NaN (which is otherwise coerced to zero.)
  7130. if (length >= kMaxLength()) {
  7131. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7132. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7133. }
  7134. return length | 0
  7135. }
  7136. function SlowBuffer (length) {
  7137. if (+length != length) { // eslint-disable-line eqeqeq
  7138. length = 0
  7139. }
  7140. return Buffer.alloc(+length)
  7141. }
  7142. Buffer.isBuffer = function isBuffer (b) {
  7143. return !!(b != null && b._isBuffer)
  7144. }
  7145. Buffer.compare = function compare (a, b) {
  7146. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7147. throw new TypeError('Arguments must be Buffers')
  7148. }
  7149. if (a === b) return 0
  7150. var x = a.length
  7151. var y = b.length
  7152. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7153. if (a[i] !== b[i]) {
  7154. x = a[i]
  7155. y = b[i]
  7156. break
  7157. }
  7158. }
  7159. if (x < y) return -1
  7160. if (y < x) return 1
  7161. return 0
  7162. }
  7163. Buffer.isEncoding = function isEncoding (encoding) {
  7164. switch (String(encoding).toLowerCase()) {
  7165. case 'hex':
  7166. case 'utf8':
  7167. case 'utf-8':
  7168. case 'ascii':
  7169. case 'latin1':
  7170. case 'binary':
  7171. case 'base64':
  7172. case 'ucs2':
  7173. case 'ucs-2':
  7174. case 'utf16le':
  7175. case 'utf-16le':
  7176. return true
  7177. default:
  7178. return false
  7179. }
  7180. }
  7181. Buffer.concat = function concat (list, length) {
  7182. if (!isArray(list)) {
  7183. throw new TypeError('"list" argument must be an Array of Buffers')
  7184. }
  7185. if (list.length === 0) {
  7186. return Buffer.alloc(0)
  7187. }
  7188. var i
  7189. if (length === undefined) {
  7190. length = 0
  7191. for (i = 0; i < list.length; ++i) {
  7192. length += list[i].length
  7193. }
  7194. }
  7195. var buffer = Buffer.allocUnsafe(length)
  7196. var pos = 0
  7197. for (i = 0; i < list.length; ++i) {
  7198. var buf = list[i]
  7199. if (!Buffer.isBuffer(buf)) {
  7200. throw new TypeError('"list" argument must be an Array of Buffers')
  7201. }
  7202. buf.copy(buffer, pos)
  7203. pos += buf.length
  7204. }
  7205. return buffer
  7206. }
  7207. function byteLength (string, encoding) {
  7208. if (Buffer.isBuffer(string)) {
  7209. return string.length
  7210. }
  7211. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7212. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7213. return string.byteLength
  7214. }
  7215. if (typeof string !== 'string') {
  7216. string = '' + string
  7217. }
  7218. var len = string.length
  7219. if (len === 0) return 0
  7220. // Use a for loop to avoid recursion
  7221. var loweredCase = false
  7222. for (;;) {
  7223. switch (encoding) {
  7224. case 'ascii':
  7225. case 'latin1':
  7226. case 'binary':
  7227. return len
  7228. case 'utf8':
  7229. case 'utf-8':
  7230. case undefined:
  7231. return utf8ToBytes(string).length
  7232. case 'ucs2':
  7233. case 'ucs-2':
  7234. case 'utf16le':
  7235. case 'utf-16le':
  7236. return len * 2
  7237. case 'hex':
  7238. return len >>> 1
  7239. case 'base64':
  7240. return base64ToBytes(string).length
  7241. default:
  7242. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7243. encoding = ('' + encoding).toLowerCase()
  7244. loweredCase = true
  7245. }
  7246. }
  7247. }
  7248. Buffer.byteLength = byteLength
  7249. function slowToString (encoding, start, end) {
  7250. var loweredCase = false
  7251. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7252. // property of a typed array.
  7253. // This behaves neither like String nor Uint8Array in that we set start/end
  7254. // to their upper/lower bounds if the value passed is out of range.
  7255. // undefined is handled specially as per ECMA-262 6th Edition,
  7256. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7257. if (start === undefined || start < 0) {
  7258. start = 0
  7259. }
  7260. // Return early if start > this.length. Done here to prevent potential uint32
  7261. // coercion fail below.
  7262. if (start > this.length) {
  7263. return ''
  7264. }
  7265. if (end === undefined || end > this.length) {
  7266. end = this.length
  7267. }
  7268. if (end <= 0) {
  7269. return ''
  7270. }
  7271. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7272. end >>>= 0
  7273. start >>>= 0
  7274. if (end <= start) {
  7275. return ''
  7276. }
  7277. if (!encoding) encoding = 'utf8'
  7278. while (true) {
  7279. switch (encoding) {
  7280. case 'hex':
  7281. return hexSlice(this, start, end)
  7282. case 'utf8':
  7283. case 'utf-8':
  7284. return utf8Slice(this, start, end)
  7285. case 'ascii':
  7286. return asciiSlice(this, start, end)
  7287. case 'latin1':
  7288. case 'binary':
  7289. return latin1Slice(this, start, end)
  7290. case 'base64':
  7291. return base64Slice(this, start, end)
  7292. case 'ucs2':
  7293. case 'ucs-2':
  7294. case 'utf16le':
  7295. case 'utf-16le':
  7296. return utf16leSlice(this, start, end)
  7297. default:
  7298. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7299. encoding = (encoding + '').toLowerCase()
  7300. loweredCase = true
  7301. }
  7302. }
  7303. }
  7304. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7305. // Buffer instances.
  7306. Buffer.prototype._isBuffer = true
  7307. function swap (b, n, m) {
  7308. var i = b[n]
  7309. b[n] = b[m]
  7310. b[m] = i
  7311. }
  7312. Buffer.prototype.swap16 = function swap16 () {
  7313. var len = this.length
  7314. if (len % 2 !== 0) {
  7315. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7316. }
  7317. for (var i = 0; i < len; i += 2) {
  7318. swap(this, i, i + 1)
  7319. }
  7320. return this
  7321. }
  7322. Buffer.prototype.swap32 = function swap32 () {
  7323. var len = this.length
  7324. if (len % 4 !== 0) {
  7325. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7326. }
  7327. for (var i = 0; i < len; i += 4) {
  7328. swap(this, i, i + 3)
  7329. swap(this, i + 1, i + 2)
  7330. }
  7331. return this
  7332. }
  7333. Buffer.prototype.swap64 = function swap64 () {
  7334. var len = this.length
  7335. if (len % 8 !== 0) {
  7336. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7337. }
  7338. for (var i = 0; i < len; i += 8) {
  7339. swap(this, i, i + 7)
  7340. swap(this, i + 1, i + 6)
  7341. swap(this, i + 2, i + 5)
  7342. swap(this, i + 3, i + 4)
  7343. }
  7344. return this
  7345. }
  7346. Buffer.prototype.toString = function toString () {
  7347. var length = this.length | 0
  7348. if (length === 0) return ''
  7349. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7350. return slowToString.apply(this, arguments)
  7351. }
  7352. Buffer.prototype.equals = function equals (b) {
  7353. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7354. if (this === b) return true
  7355. return Buffer.compare(this, b) === 0
  7356. }
  7357. Buffer.prototype.inspect = function inspect () {
  7358. var str = ''
  7359. var max = exports.INSPECT_MAX_BYTES
  7360. if (this.length > 0) {
  7361. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7362. if (this.length > max) str += ' ... '
  7363. }
  7364. return '<Buffer ' + str + '>'
  7365. }
  7366. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7367. if (!Buffer.isBuffer(target)) {
  7368. throw new TypeError('Argument must be a Buffer')
  7369. }
  7370. if (start === undefined) {
  7371. start = 0
  7372. }
  7373. if (end === undefined) {
  7374. end = target ? target.length : 0
  7375. }
  7376. if (thisStart === undefined) {
  7377. thisStart = 0
  7378. }
  7379. if (thisEnd === undefined) {
  7380. thisEnd = this.length
  7381. }
  7382. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7383. throw new RangeError('out of range index')
  7384. }
  7385. if (thisStart >= thisEnd && start >= end) {
  7386. return 0
  7387. }
  7388. if (thisStart >= thisEnd) {
  7389. return -1
  7390. }
  7391. if (start >= end) {
  7392. return 1
  7393. }
  7394. start >>>= 0
  7395. end >>>= 0
  7396. thisStart >>>= 0
  7397. thisEnd >>>= 0
  7398. if (this === target) return 0
  7399. var x = thisEnd - thisStart
  7400. var y = end - start
  7401. var len = Math.min(x, y)
  7402. var thisCopy = this.slice(thisStart, thisEnd)
  7403. var targetCopy = target.slice(start, end)
  7404. for (var i = 0; i < len; ++i) {
  7405. if (thisCopy[i] !== targetCopy[i]) {
  7406. x = thisCopy[i]
  7407. y = targetCopy[i]
  7408. break
  7409. }
  7410. }
  7411. if (x < y) return -1
  7412. if (y < x) return 1
  7413. return 0
  7414. }
  7415. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7416. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7417. //
  7418. // Arguments:
  7419. // - buffer - a Buffer to search
  7420. // - val - a string, Buffer, or number
  7421. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7422. // - encoding - an optional encoding, relevant is val is a string
  7423. // - dir - true for indexOf, false for lastIndexOf
  7424. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7425. // Empty buffer means no match
  7426. if (buffer.length === 0) return -1
  7427. // Normalize byteOffset
  7428. if (typeof byteOffset === 'string') {
  7429. encoding = byteOffset
  7430. byteOffset = 0
  7431. } else if (byteOffset > 0x7fffffff) {
  7432. byteOffset = 0x7fffffff
  7433. } else if (byteOffset < -0x80000000) {
  7434. byteOffset = -0x80000000
  7435. }
  7436. byteOffset = +byteOffset // Coerce to Number.
  7437. if (isNaN(byteOffset)) {
  7438. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7439. byteOffset = dir ? 0 : (buffer.length - 1)
  7440. }
  7441. // Normalize byteOffset: negative offsets start from the end of the buffer
  7442. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7443. if (byteOffset >= buffer.length) {
  7444. if (dir) return -1
  7445. else byteOffset = buffer.length - 1
  7446. } else if (byteOffset < 0) {
  7447. if (dir) byteOffset = 0
  7448. else return -1
  7449. }
  7450. // Normalize val
  7451. if (typeof val === 'string') {
  7452. val = Buffer.from(val, encoding)
  7453. }
  7454. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7455. if (Buffer.isBuffer(val)) {
  7456. // Special case: looking for empty string/buffer always fails
  7457. if (val.length === 0) {
  7458. return -1
  7459. }
  7460. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7461. } else if (typeof val === 'number') {
  7462. val = val & 0xFF // Search for a byte value [0-255]
  7463. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7464. typeof Uint8Array.prototype.indexOf === 'function') {
  7465. if (dir) {
  7466. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7467. } else {
  7468. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7469. }
  7470. }
  7471. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7472. }
  7473. throw new TypeError('val must be string, number or Buffer')
  7474. }
  7475. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7476. var indexSize = 1
  7477. var arrLength = arr.length
  7478. var valLength = val.length
  7479. if (encoding !== undefined) {
  7480. encoding = String(encoding).toLowerCase()
  7481. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7482. encoding === 'utf16le' || encoding === 'utf-16le') {
  7483. if (arr.length < 2 || val.length < 2) {
  7484. return -1
  7485. }
  7486. indexSize = 2
  7487. arrLength /= 2
  7488. valLength /= 2
  7489. byteOffset /= 2
  7490. }
  7491. }
  7492. function read (buf, i) {
  7493. if (indexSize === 1) {
  7494. return buf[i]
  7495. } else {
  7496. return buf.readUInt16BE(i * indexSize)
  7497. }
  7498. }
  7499. var i
  7500. if (dir) {
  7501. var foundIndex = -1
  7502. for (i = byteOffset; i < arrLength; i++) {
  7503. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7504. if (foundIndex === -1) foundIndex = i
  7505. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7506. } else {
  7507. if (foundIndex !== -1) i -= i - foundIndex
  7508. foundIndex = -1
  7509. }
  7510. }
  7511. } else {
  7512. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7513. for (i = byteOffset; i >= 0; i--) {
  7514. var found = true
  7515. for (var j = 0; j < valLength; j++) {
  7516. if (read(arr, i + j) !== read(val, j)) {
  7517. found = false
  7518. break
  7519. }
  7520. }
  7521. if (found) return i
  7522. }
  7523. }
  7524. return -1
  7525. }
  7526. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7527. return this.indexOf(val, byteOffset, encoding) !== -1
  7528. }
  7529. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7530. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7531. }
  7532. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7533. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7534. }
  7535. function hexWrite (buf, string, offset, length) {
  7536. offset = Number(offset) || 0
  7537. var remaining = buf.length - offset
  7538. if (!length) {
  7539. length = remaining
  7540. } else {
  7541. length = Number(length)
  7542. if (length > remaining) {
  7543. length = remaining
  7544. }
  7545. }
  7546. // must be an even number of digits
  7547. var strLen = string.length
  7548. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7549. if (length > strLen / 2) {
  7550. length = strLen / 2
  7551. }
  7552. for (var i = 0; i < length; ++i) {
  7553. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7554. if (isNaN(parsed)) return i
  7555. buf[offset + i] = parsed
  7556. }
  7557. return i
  7558. }
  7559. function utf8Write (buf, string, offset, length) {
  7560. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7561. }
  7562. function asciiWrite (buf, string, offset, length) {
  7563. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7564. }
  7565. function latin1Write (buf, string, offset, length) {
  7566. return asciiWrite(buf, string, offset, length)
  7567. }
  7568. function base64Write (buf, string, offset, length) {
  7569. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7570. }
  7571. function ucs2Write (buf, string, offset, length) {
  7572. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7573. }
  7574. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7575. // Buffer#write(string)
  7576. if (offset === undefined) {
  7577. encoding = 'utf8'
  7578. length = this.length
  7579. offset = 0
  7580. // Buffer#write(string, encoding)
  7581. } else if (length === undefined && typeof offset === 'string') {
  7582. encoding = offset
  7583. length = this.length
  7584. offset = 0
  7585. // Buffer#write(string, offset[, length][, encoding])
  7586. } else if (isFinite(offset)) {
  7587. offset = offset | 0
  7588. if (isFinite(length)) {
  7589. length = length | 0
  7590. if (encoding === undefined) encoding = 'utf8'
  7591. } else {
  7592. encoding = length
  7593. length = undefined
  7594. }
  7595. // legacy write(string, encoding, offset, length) - remove in v0.13
  7596. } else {
  7597. throw new Error(
  7598. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7599. )
  7600. }
  7601. var remaining = this.length - offset
  7602. if (length === undefined || length > remaining) length = remaining
  7603. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7604. throw new RangeError('Attempt to write outside buffer bounds')
  7605. }
  7606. if (!encoding) encoding = 'utf8'
  7607. var loweredCase = false
  7608. for (;;) {
  7609. switch (encoding) {
  7610. case 'hex':
  7611. return hexWrite(this, string, offset, length)
  7612. case 'utf8':
  7613. case 'utf-8':
  7614. return utf8Write(this, string, offset, length)
  7615. case 'ascii':
  7616. return asciiWrite(this, string, offset, length)
  7617. case 'latin1':
  7618. case 'binary':
  7619. return latin1Write(this, string, offset, length)
  7620. case 'base64':
  7621. // Warning: maxLength not taken into account in base64Write
  7622. return base64Write(this, string, offset, length)
  7623. case 'ucs2':
  7624. case 'ucs-2':
  7625. case 'utf16le':
  7626. case 'utf-16le':
  7627. return ucs2Write(this, string, offset, length)
  7628. default:
  7629. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7630. encoding = ('' + encoding).toLowerCase()
  7631. loweredCase = true
  7632. }
  7633. }
  7634. }
  7635. Buffer.prototype.toJSON = function toJSON () {
  7636. return {
  7637. type: 'Buffer',
  7638. data: Array.prototype.slice.call(this._arr || this, 0)
  7639. }
  7640. }
  7641. function base64Slice (buf, start, end) {
  7642. if (start === 0 && end === buf.length) {
  7643. return base64.fromByteArray(buf)
  7644. } else {
  7645. return base64.fromByteArray(buf.slice(start, end))
  7646. }
  7647. }
  7648. function utf8Slice (buf, start, end) {
  7649. end = Math.min(buf.length, end)
  7650. var res = []
  7651. var i = start
  7652. while (i < end) {
  7653. var firstByte = buf[i]
  7654. var codePoint = null
  7655. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7656. : (firstByte > 0xDF) ? 3
  7657. : (firstByte > 0xBF) ? 2
  7658. : 1
  7659. if (i + bytesPerSequence <= end) {
  7660. var secondByte, thirdByte, fourthByte, tempCodePoint
  7661. switch (bytesPerSequence) {
  7662. case 1:
  7663. if (firstByte < 0x80) {
  7664. codePoint = firstByte
  7665. }
  7666. break
  7667. case 2:
  7668. secondByte = buf[i + 1]
  7669. if ((secondByte & 0xC0) === 0x80) {
  7670. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7671. if (tempCodePoint > 0x7F) {
  7672. codePoint = tempCodePoint
  7673. }
  7674. }
  7675. break
  7676. case 3:
  7677. secondByte = buf[i + 1]
  7678. thirdByte = buf[i + 2]
  7679. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7680. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7681. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7682. codePoint = tempCodePoint
  7683. }
  7684. }
  7685. break
  7686. case 4:
  7687. secondByte = buf[i + 1]
  7688. thirdByte = buf[i + 2]
  7689. fourthByte = buf[i + 3]
  7690. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7691. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7692. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7693. codePoint = tempCodePoint
  7694. }
  7695. }
  7696. }
  7697. }
  7698. if (codePoint === null) {
  7699. // we did not generate a valid codePoint so insert a
  7700. // replacement char (U+FFFD) and advance only 1 byte
  7701. codePoint = 0xFFFD
  7702. bytesPerSequence = 1
  7703. } else if (codePoint > 0xFFFF) {
  7704. // encode to utf16 (surrogate pair dance)
  7705. codePoint -= 0x10000
  7706. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7707. codePoint = 0xDC00 | codePoint & 0x3FF
  7708. }
  7709. res.push(codePoint)
  7710. i += bytesPerSequence
  7711. }
  7712. return decodeCodePointsArray(res)
  7713. }
  7714. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7715. // the lowest limit is Chrome, with 0x10000 args.
  7716. // We go 1 magnitude less, for safety
  7717. var MAX_ARGUMENTS_LENGTH = 0x1000
  7718. function decodeCodePointsArray (codePoints) {
  7719. var len = codePoints.length
  7720. if (len <= MAX_ARGUMENTS_LENGTH) {
  7721. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7722. }
  7723. // Decode in chunks to avoid "call stack size exceeded".
  7724. var res = ''
  7725. var i = 0
  7726. while (i < len) {
  7727. res += String.fromCharCode.apply(
  7728. String,
  7729. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7730. )
  7731. }
  7732. return res
  7733. }
  7734. function asciiSlice (buf, start, end) {
  7735. var ret = ''
  7736. end = Math.min(buf.length, end)
  7737. for (var i = start; i < end; ++i) {
  7738. ret += String.fromCharCode(buf[i] & 0x7F)
  7739. }
  7740. return ret
  7741. }
  7742. function latin1Slice (buf, start, end) {
  7743. var ret = ''
  7744. end = Math.min(buf.length, end)
  7745. for (var i = start; i < end; ++i) {
  7746. ret += String.fromCharCode(buf[i])
  7747. }
  7748. return ret
  7749. }
  7750. function hexSlice (buf, start, end) {
  7751. var len = buf.length
  7752. if (!start || start < 0) start = 0
  7753. if (!end || end < 0 || end > len) end = len
  7754. var out = ''
  7755. for (var i = start; i < end; ++i) {
  7756. out += toHex(buf[i])
  7757. }
  7758. return out
  7759. }
  7760. function utf16leSlice (buf, start, end) {
  7761. var bytes = buf.slice(start, end)
  7762. var res = ''
  7763. for (var i = 0; i < bytes.length; i += 2) {
  7764. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7765. }
  7766. return res
  7767. }
  7768. Buffer.prototype.slice = function slice (start, end) {
  7769. var len = this.length
  7770. start = ~~start
  7771. end = end === undefined ? len : ~~end
  7772. if (start < 0) {
  7773. start += len
  7774. if (start < 0) start = 0
  7775. } else if (start > len) {
  7776. start = len
  7777. }
  7778. if (end < 0) {
  7779. end += len
  7780. if (end < 0) end = 0
  7781. } else if (end > len) {
  7782. end = len
  7783. }
  7784. if (end < start) end = start
  7785. var newBuf
  7786. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7787. newBuf = this.subarray(start, end)
  7788. newBuf.__proto__ = Buffer.prototype
  7789. } else {
  7790. var sliceLen = end - start
  7791. newBuf = new Buffer(sliceLen, undefined)
  7792. for (var i = 0; i < sliceLen; ++i) {
  7793. newBuf[i] = this[i + start]
  7794. }
  7795. }
  7796. return newBuf
  7797. }
  7798. /*
  7799. * Need to make sure that buffer isn't trying to write out of bounds.
  7800. */
  7801. function checkOffset (offset, ext, length) {
  7802. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7803. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7804. }
  7805. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7806. offset = offset | 0
  7807. byteLength = byteLength | 0
  7808. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7809. var val = this[offset]
  7810. var mul = 1
  7811. var i = 0
  7812. while (++i < byteLength && (mul *= 0x100)) {
  7813. val += this[offset + i] * mul
  7814. }
  7815. return val
  7816. }
  7817. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7818. offset = offset | 0
  7819. byteLength = byteLength | 0
  7820. if (!noAssert) {
  7821. checkOffset(offset, byteLength, this.length)
  7822. }
  7823. var val = this[offset + --byteLength]
  7824. var mul = 1
  7825. while (byteLength > 0 && (mul *= 0x100)) {
  7826. val += this[offset + --byteLength] * mul
  7827. }
  7828. return val
  7829. }
  7830. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7831. if (!noAssert) checkOffset(offset, 1, this.length)
  7832. return this[offset]
  7833. }
  7834. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7835. if (!noAssert) checkOffset(offset, 2, this.length)
  7836. return this[offset] | (this[offset + 1] << 8)
  7837. }
  7838. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7839. if (!noAssert) checkOffset(offset, 2, this.length)
  7840. return (this[offset] << 8) | this[offset + 1]
  7841. }
  7842. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7843. if (!noAssert) checkOffset(offset, 4, this.length)
  7844. return ((this[offset]) |
  7845. (this[offset + 1] << 8) |
  7846. (this[offset + 2] << 16)) +
  7847. (this[offset + 3] * 0x1000000)
  7848. }
  7849. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7850. if (!noAssert) checkOffset(offset, 4, this.length)
  7851. return (this[offset] * 0x1000000) +
  7852. ((this[offset + 1] << 16) |
  7853. (this[offset + 2] << 8) |
  7854. this[offset + 3])
  7855. }
  7856. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7857. offset = offset | 0
  7858. byteLength = byteLength | 0
  7859. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7860. var val = this[offset]
  7861. var mul = 1
  7862. var i = 0
  7863. while (++i < byteLength && (mul *= 0x100)) {
  7864. val += this[offset + i] * mul
  7865. }
  7866. mul *= 0x80
  7867. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7868. return val
  7869. }
  7870. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7871. offset = offset | 0
  7872. byteLength = byteLength | 0
  7873. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7874. var i = byteLength
  7875. var mul = 1
  7876. var val = this[offset + --i]
  7877. while (i > 0 && (mul *= 0x100)) {
  7878. val += this[offset + --i] * mul
  7879. }
  7880. mul *= 0x80
  7881. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7882. return val
  7883. }
  7884. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7885. if (!noAssert) checkOffset(offset, 1, this.length)
  7886. if (!(this[offset] & 0x80)) return (this[offset])
  7887. return ((0xff - this[offset] + 1) * -1)
  7888. }
  7889. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7890. if (!noAssert) checkOffset(offset, 2, this.length)
  7891. var val = this[offset] | (this[offset + 1] << 8)
  7892. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7893. }
  7894. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7895. if (!noAssert) checkOffset(offset, 2, this.length)
  7896. var val = this[offset + 1] | (this[offset] << 8)
  7897. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7898. }
  7899. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7900. if (!noAssert) checkOffset(offset, 4, this.length)
  7901. return (this[offset]) |
  7902. (this[offset + 1] << 8) |
  7903. (this[offset + 2] << 16) |
  7904. (this[offset + 3] << 24)
  7905. }
  7906. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7907. if (!noAssert) checkOffset(offset, 4, this.length)
  7908. return (this[offset] << 24) |
  7909. (this[offset + 1] << 16) |
  7910. (this[offset + 2] << 8) |
  7911. (this[offset + 3])
  7912. }
  7913. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7914. if (!noAssert) checkOffset(offset, 4, this.length)
  7915. return ieee754.read(this, offset, true, 23, 4)
  7916. }
  7917. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7918. if (!noAssert) checkOffset(offset, 4, this.length)
  7919. return ieee754.read(this, offset, false, 23, 4)
  7920. }
  7921. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7922. if (!noAssert) checkOffset(offset, 8, this.length)
  7923. return ieee754.read(this, offset, true, 52, 8)
  7924. }
  7925. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7926. if (!noAssert) checkOffset(offset, 8, this.length)
  7927. return ieee754.read(this, offset, false, 52, 8)
  7928. }
  7929. function checkInt (buf, value, offset, ext, max, min) {
  7930. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7931. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7932. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7933. }
  7934. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7935. value = +value
  7936. offset = offset | 0
  7937. byteLength = byteLength | 0
  7938. if (!noAssert) {
  7939. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7940. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7941. }
  7942. var mul = 1
  7943. var i = 0
  7944. this[offset] = value & 0xFF
  7945. while (++i < byteLength && (mul *= 0x100)) {
  7946. this[offset + i] = (value / mul) & 0xFF
  7947. }
  7948. return offset + byteLength
  7949. }
  7950. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7951. value = +value
  7952. offset = offset | 0
  7953. byteLength = byteLength | 0
  7954. if (!noAssert) {
  7955. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7956. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7957. }
  7958. var i = byteLength - 1
  7959. var mul = 1
  7960. this[offset + i] = value & 0xFF
  7961. while (--i >= 0 && (mul *= 0x100)) {
  7962. this[offset + i] = (value / mul) & 0xFF
  7963. }
  7964. return offset + byteLength
  7965. }
  7966. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7967. value = +value
  7968. offset = offset | 0
  7969. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7970. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7971. this[offset] = (value & 0xff)
  7972. return offset + 1
  7973. }
  7974. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7975. if (value < 0) value = 0xffff + value + 1
  7976. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7977. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7978. (littleEndian ? i : 1 - i) * 8
  7979. }
  7980. }
  7981. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7982. value = +value
  7983. offset = offset | 0
  7984. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7985. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7986. this[offset] = (value & 0xff)
  7987. this[offset + 1] = (value >>> 8)
  7988. } else {
  7989. objectWriteUInt16(this, value, offset, true)
  7990. }
  7991. return offset + 2
  7992. }
  7993. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7994. value = +value
  7995. offset = offset | 0
  7996. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7997. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7998. this[offset] = (value >>> 8)
  7999. this[offset + 1] = (value & 0xff)
  8000. } else {
  8001. objectWriteUInt16(this, value, offset, false)
  8002. }
  8003. return offset + 2
  8004. }
  8005. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8006. if (value < 0) value = 0xffffffff + value + 1
  8007. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8008. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8009. }
  8010. }
  8011. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8012. value = +value
  8013. offset = offset | 0
  8014. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8015. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8016. this[offset + 3] = (value >>> 24)
  8017. this[offset + 2] = (value >>> 16)
  8018. this[offset + 1] = (value >>> 8)
  8019. this[offset] = (value & 0xff)
  8020. } else {
  8021. objectWriteUInt32(this, value, offset, true)
  8022. }
  8023. return offset + 4
  8024. }
  8025. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8026. value = +value
  8027. offset = offset | 0
  8028. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8029. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8030. this[offset] = (value >>> 24)
  8031. this[offset + 1] = (value >>> 16)
  8032. this[offset + 2] = (value >>> 8)
  8033. this[offset + 3] = (value & 0xff)
  8034. } else {
  8035. objectWriteUInt32(this, value, offset, false)
  8036. }
  8037. return offset + 4
  8038. }
  8039. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8040. value = +value
  8041. offset = offset | 0
  8042. if (!noAssert) {
  8043. var limit = Math.pow(2, 8 * byteLength - 1)
  8044. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8045. }
  8046. var i = 0
  8047. var mul = 1
  8048. var sub = 0
  8049. this[offset] = value & 0xFF
  8050. while (++i < byteLength && (mul *= 0x100)) {
  8051. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8052. sub = 1
  8053. }
  8054. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8055. }
  8056. return offset + byteLength
  8057. }
  8058. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8059. value = +value
  8060. offset = offset | 0
  8061. if (!noAssert) {
  8062. var limit = Math.pow(2, 8 * byteLength - 1)
  8063. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8064. }
  8065. var i = byteLength - 1
  8066. var mul = 1
  8067. var sub = 0
  8068. this[offset + i] = value & 0xFF
  8069. while (--i >= 0 && (mul *= 0x100)) {
  8070. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8071. sub = 1
  8072. }
  8073. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8074. }
  8075. return offset + byteLength
  8076. }
  8077. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8078. value = +value
  8079. offset = offset | 0
  8080. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8081. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8082. if (value < 0) value = 0xff + value + 1
  8083. this[offset] = (value & 0xff)
  8084. return offset + 1
  8085. }
  8086. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8087. value = +value
  8088. offset = offset | 0
  8089. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8090. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8091. this[offset] = (value & 0xff)
  8092. this[offset + 1] = (value >>> 8)
  8093. } else {
  8094. objectWriteUInt16(this, value, offset, true)
  8095. }
  8096. return offset + 2
  8097. }
  8098. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8099. value = +value
  8100. offset = offset | 0
  8101. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8102. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8103. this[offset] = (value >>> 8)
  8104. this[offset + 1] = (value & 0xff)
  8105. } else {
  8106. objectWriteUInt16(this, value, offset, false)
  8107. }
  8108. return offset + 2
  8109. }
  8110. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8111. value = +value
  8112. offset = offset | 0
  8113. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8114. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8115. this[offset] = (value & 0xff)
  8116. this[offset + 1] = (value >>> 8)
  8117. this[offset + 2] = (value >>> 16)
  8118. this[offset + 3] = (value >>> 24)
  8119. } else {
  8120. objectWriteUInt32(this, value, offset, true)
  8121. }
  8122. return offset + 4
  8123. }
  8124. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8125. value = +value
  8126. offset = offset | 0
  8127. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8128. if (value < 0) value = 0xffffffff + value + 1
  8129. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8130. this[offset] = (value >>> 24)
  8131. this[offset + 1] = (value >>> 16)
  8132. this[offset + 2] = (value >>> 8)
  8133. this[offset + 3] = (value & 0xff)
  8134. } else {
  8135. objectWriteUInt32(this, value, offset, false)
  8136. }
  8137. return offset + 4
  8138. }
  8139. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8140. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8141. if (offset < 0) throw new RangeError('Index out of range')
  8142. }
  8143. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8144. if (!noAssert) {
  8145. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8146. }
  8147. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8148. return offset + 4
  8149. }
  8150. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8151. return writeFloat(this, value, offset, true, noAssert)
  8152. }
  8153. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8154. return writeFloat(this, value, offset, false, noAssert)
  8155. }
  8156. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8157. if (!noAssert) {
  8158. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8159. }
  8160. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8161. return offset + 8
  8162. }
  8163. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8164. return writeDouble(this, value, offset, true, noAssert)
  8165. }
  8166. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8167. return writeDouble(this, value, offset, false, noAssert)
  8168. }
  8169. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8170. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8171. if (!start) start = 0
  8172. if (!end && end !== 0) end = this.length
  8173. if (targetStart >= target.length) targetStart = target.length
  8174. if (!targetStart) targetStart = 0
  8175. if (end > 0 && end < start) end = start
  8176. // Copy 0 bytes; we're done
  8177. if (end === start) return 0
  8178. if (target.length === 0 || this.length === 0) return 0
  8179. // Fatal error conditions
  8180. if (targetStart < 0) {
  8181. throw new RangeError('targetStart out of bounds')
  8182. }
  8183. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8184. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8185. // Are we oob?
  8186. if (end > this.length) end = this.length
  8187. if (target.length - targetStart < end - start) {
  8188. end = target.length - targetStart + start
  8189. }
  8190. var len = end - start
  8191. var i
  8192. if (this === target && start < targetStart && targetStart < end) {
  8193. // descending copy from end
  8194. for (i = len - 1; i >= 0; --i) {
  8195. target[i + targetStart] = this[i + start]
  8196. }
  8197. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8198. // ascending copy from start
  8199. for (i = 0; i < len; ++i) {
  8200. target[i + targetStart] = this[i + start]
  8201. }
  8202. } else {
  8203. Uint8Array.prototype.set.call(
  8204. target,
  8205. this.subarray(start, start + len),
  8206. targetStart
  8207. )
  8208. }
  8209. return len
  8210. }
  8211. // Usage:
  8212. // buffer.fill(number[, offset[, end]])
  8213. // buffer.fill(buffer[, offset[, end]])
  8214. // buffer.fill(string[, offset[, end]][, encoding])
  8215. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8216. // Handle string cases:
  8217. if (typeof val === 'string') {
  8218. if (typeof start === 'string') {
  8219. encoding = start
  8220. start = 0
  8221. end = this.length
  8222. } else if (typeof end === 'string') {
  8223. encoding = end
  8224. end = this.length
  8225. }
  8226. if (val.length === 1) {
  8227. var code = val.charCodeAt(0)
  8228. if (code < 256) {
  8229. val = code
  8230. }
  8231. }
  8232. if (encoding !== undefined && typeof encoding !== 'string') {
  8233. throw new TypeError('encoding must be a string')
  8234. }
  8235. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8236. throw new TypeError('Unknown encoding: ' + encoding)
  8237. }
  8238. } else if (typeof val === 'number') {
  8239. val = val & 255
  8240. }
  8241. // Invalid ranges are not set to a default, so can range check early.
  8242. if (start < 0 || this.length < start || this.length < end) {
  8243. throw new RangeError('Out of range index')
  8244. }
  8245. if (end <= start) {
  8246. return this
  8247. }
  8248. start = start >>> 0
  8249. end = end === undefined ? this.length : end >>> 0
  8250. if (!val) val = 0
  8251. var i
  8252. if (typeof val === 'number') {
  8253. for (i = start; i < end; ++i) {
  8254. this[i] = val
  8255. }
  8256. } else {
  8257. var bytes = Buffer.isBuffer(val)
  8258. ? val
  8259. : utf8ToBytes(new Buffer(val, encoding).toString())
  8260. var len = bytes.length
  8261. for (i = 0; i < end - start; ++i) {
  8262. this[i + start] = bytes[i % len]
  8263. }
  8264. }
  8265. return this
  8266. }
  8267. // HELPER FUNCTIONS
  8268. // ================
  8269. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8270. function base64clean (str) {
  8271. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8272. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8273. // Node converts strings with length < 2 to ''
  8274. if (str.length < 2) return ''
  8275. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8276. while (str.length % 4 !== 0) {
  8277. str = str + '='
  8278. }
  8279. return str
  8280. }
  8281. function stringtrim (str) {
  8282. if (str.trim) return str.trim()
  8283. return str.replace(/^\s+|\s+$/g, '')
  8284. }
  8285. function toHex (n) {
  8286. if (n < 16) return '0' + n.toString(16)
  8287. return n.toString(16)
  8288. }
  8289. function utf8ToBytes (string, units) {
  8290. units = units || Infinity
  8291. var codePoint
  8292. var length = string.length
  8293. var leadSurrogate = null
  8294. var bytes = []
  8295. for (var i = 0; i < length; ++i) {
  8296. codePoint = string.charCodeAt(i)
  8297. // is surrogate component
  8298. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8299. // last char was a lead
  8300. if (!leadSurrogate) {
  8301. // no lead yet
  8302. if (codePoint > 0xDBFF) {
  8303. // unexpected trail
  8304. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8305. continue
  8306. } else if (i + 1 === length) {
  8307. // unpaired lead
  8308. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8309. continue
  8310. }
  8311. // valid lead
  8312. leadSurrogate = codePoint
  8313. continue
  8314. }
  8315. // 2 leads in a row
  8316. if (codePoint < 0xDC00) {
  8317. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8318. leadSurrogate = codePoint
  8319. continue
  8320. }
  8321. // valid surrogate pair
  8322. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8323. } else if (leadSurrogate) {
  8324. // valid bmp char, but last char was a lead
  8325. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8326. }
  8327. leadSurrogate = null
  8328. // encode utf8
  8329. if (codePoint < 0x80) {
  8330. if ((units -= 1) < 0) break
  8331. bytes.push(codePoint)
  8332. } else if (codePoint < 0x800) {
  8333. if ((units -= 2) < 0) break
  8334. bytes.push(
  8335. codePoint >> 0x6 | 0xC0,
  8336. codePoint & 0x3F | 0x80
  8337. )
  8338. } else if (codePoint < 0x10000) {
  8339. if ((units -= 3) < 0) break
  8340. bytes.push(
  8341. codePoint >> 0xC | 0xE0,
  8342. codePoint >> 0x6 & 0x3F | 0x80,
  8343. codePoint & 0x3F | 0x80
  8344. )
  8345. } else if (codePoint < 0x110000) {
  8346. if ((units -= 4) < 0) break
  8347. bytes.push(
  8348. codePoint >> 0x12 | 0xF0,
  8349. codePoint >> 0xC & 0x3F | 0x80,
  8350. codePoint >> 0x6 & 0x3F | 0x80,
  8351. codePoint & 0x3F | 0x80
  8352. )
  8353. } else {
  8354. throw new Error('Invalid code point')
  8355. }
  8356. }
  8357. return bytes
  8358. }
  8359. function asciiToBytes (str) {
  8360. var byteArray = []
  8361. for (var i = 0; i < str.length; ++i) {
  8362. // Node's code seems to be doing this and not & 0x7F..
  8363. byteArray.push(str.charCodeAt(i) & 0xFF)
  8364. }
  8365. return byteArray
  8366. }
  8367. function utf16leToBytes (str, units) {
  8368. var c, hi, lo
  8369. var byteArray = []
  8370. for (var i = 0; i < str.length; ++i) {
  8371. if ((units -= 2) < 0) break
  8372. c = str.charCodeAt(i)
  8373. hi = c >> 8
  8374. lo = c % 256
  8375. byteArray.push(lo)
  8376. byteArray.push(hi)
  8377. }
  8378. return byteArray
  8379. }
  8380. function base64ToBytes (str) {
  8381. return base64.toByteArray(base64clean(str))
  8382. }
  8383. function blitBuffer (src, dst, offset, length) {
  8384. for (var i = 0; i < length; ++i) {
  8385. if ((i + offset >= dst.length) || (i >= src.length)) break
  8386. dst[i + offset] = src[i]
  8387. }
  8388. return i
  8389. }
  8390. function isnan (val) {
  8391. return val !== val // eslint-disable-line no-self-compare
  8392. }
  8393. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8394. /***/ }),
  8395. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8396. /*!**************************************************!*\
  8397. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8398. \**************************************************/
  8399. /*! no static exports found */
  8400. /***/ (function(module, exports, __webpack_require__) {
  8401. /*!
  8402. * clipboard.js v2.0.4
  8403. * https://zenorocha.github.io/clipboard.js
  8404. *
  8405. * Licensed MIT © Zeno Rocha
  8406. */
  8407. (function webpackUniversalModuleDefinition(root, factory) {
  8408. if(true)
  8409. module.exports = factory();
  8410. else {}
  8411. })(this, function() {
  8412. return /******/ (function(modules) { // webpackBootstrap
  8413. /******/ // The module cache
  8414. /******/ var installedModules = {};
  8415. /******/
  8416. /******/ // The require function
  8417. /******/ function __webpack_require__(moduleId) {
  8418. /******/
  8419. /******/ // Check if module is in cache
  8420. /******/ if(installedModules[moduleId]) {
  8421. /******/ return installedModules[moduleId].exports;
  8422. /******/ }
  8423. /******/ // Create a new module (and put it into the cache)
  8424. /******/ var module = installedModules[moduleId] = {
  8425. /******/ i: moduleId,
  8426. /******/ l: false,
  8427. /******/ exports: {}
  8428. /******/ };
  8429. /******/
  8430. /******/ // Execute the module function
  8431. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8432. /******/
  8433. /******/ // Flag the module as loaded
  8434. /******/ module.l = true;
  8435. /******/
  8436. /******/ // Return the exports of the module
  8437. /******/ return module.exports;
  8438. /******/ }
  8439. /******/
  8440. /******/
  8441. /******/ // expose the modules object (__webpack_modules__)
  8442. /******/ __webpack_require__.m = modules;
  8443. /******/
  8444. /******/ // expose the module cache
  8445. /******/ __webpack_require__.c = installedModules;
  8446. /******/
  8447. /******/ // define getter function for harmony exports
  8448. /******/ __webpack_require__.d = function(exports, name, getter) {
  8449. /******/ if(!__webpack_require__.o(exports, name)) {
  8450. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8451. /******/ }
  8452. /******/ };
  8453. /******/
  8454. /******/ // define __esModule on exports
  8455. /******/ __webpack_require__.r = function(exports) {
  8456. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8457. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8458. /******/ }
  8459. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8460. /******/ };
  8461. /******/
  8462. /******/ // create a fake namespace object
  8463. /******/ // mode & 1: value is a module id, require it
  8464. /******/ // mode & 2: merge all properties of value into the ns
  8465. /******/ // mode & 4: return value when already ns object
  8466. /******/ // mode & 8|1: behave like require
  8467. /******/ __webpack_require__.t = function(value, mode) {
  8468. /******/ if(mode & 1) value = __webpack_require__(value);
  8469. /******/ if(mode & 8) return value;
  8470. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8471. /******/ var ns = Object.create(null);
  8472. /******/ __webpack_require__.r(ns);
  8473. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8474. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8475. /******/ return ns;
  8476. /******/ };
  8477. /******/
  8478. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8479. /******/ __webpack_require__.n = function(module) {
  8480. /******/ var getter = module && module.__esModule ?
  8481. /******/ function getDefault() { return module['default']; } :
  8482. /******/ function getModuleExports() { return module; };
  8483. /******/ __webpack_require__.d(getter, 'a', getter);
  8484. /******/ return getter;
  8485. /******/ };
  8486. /******/
  8487. /******/ // Object.prototype.hasOwnProperty.call
  8488. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8489. /******/
  8490. /******/ // __webpack_public_path__
  8491. /******/ __webpack_require__.p = "";
  8492. /******/
  8493. /******/
  8494. /******/ // Load entry module and return exports
  8495. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8496. /******/ })
  8497. /************************************************************************/
  8498. /******/ ([
  8499. /* 0 */
  8500. /***/ (function(module, exports, __webpack_require__) {
  8501. "use strict";
  8502. 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; };
  8503. 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; }; }();
  8504. var _clipboardAction = __webpack_require__(1);
  8505. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8506. var _tinyEmitter = __webpack_require__(3);
  8507. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8508. var _goodListener = __webpack_require__(4);
  8509. var _goodListener2 = _interopRequireDefault(_goodListener);
  8510. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8511. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8512. 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; }
  8513. 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; }
  8514. /**
  8515. * Base class which takes one or more elements, adds event listeners to them,
  8516. * and instantiates a new `ClipboardAction` on each click.
  8517. */
  8518. var Clipboard = function (_Emitter) {
  8519. _inherits(Clipboard, _Emitter);
  8520. /**
  8521. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8522. * @param {Object} options
  8523. */
  8524. function Clipboard(trigger, options) {
  8525. _classCallCheck(this, Clipboard);
  8526. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8527. _this.resolveOptions(options);
  8528. _this.listenClick(trigger);
  8529. return _this;
  8530. }
  8531. /**
  8532. * Defines if attributes would be resolved using internal setter functions
  8533. * or custom functions that were passed in the constructor.
  8534. * @param {Object} options
  8535. */
  8536. _createClass(Clipboard, [{
  8537. key: 'resolveOptions',
  8538. value: function resolveOptions() {
  8539. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8540. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8541. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8542. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8543. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8544. }
  8545. /**
  8546. * Adds a click event listener to the passed trigger.
  8547. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8548. */
  8549. }, {
  8550. key: 'listenClick',
  8551. value: function listenClick(trigger) {
  8552. var _this2 = this;
  8553. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8554. return _this2.onClick(e);
  8555. });
  8556. }
  8557. /**
  8558. * Defines a new `ClipboardAction` on each click event.
  8559. * @param {Event} e
  8560. */
  8561. }, {
  8562. key: 'onClick',
  8563. value: function onClick(e) {
  8564. var trigger = e.delegateTarget || e.currentTarget;
  8565. if (this.clipboardAction) {
  8566. this.clipboardAction = null;
  8567. }
  8568. this.clipboardAction = new _clipboardAction2.default({
  8569. action: this.action(trigger),
  8570. target: this.target(trigger),
  8571. text: this.text(trigger),
  8572. container: this.container,
  8573. trigger: trigger,
  8574. emitter: this
  8575. });
  8576. }
  8577. /**
  8578. * Default `action` lookup function.
  8579. * @param {Element} trigger
  8580. */
  8581. }, {
  8582. key: 'defaultAction',
  8583. value: function defaultAction(trigger) {
  8584. return getAttributeValue('action', trigger);
  8585. }
  8586. /**
  8587. * Default `target` lookup function.
  8588. * @param {Element} trigger
  8589. */
  8590. }, {
  8591. key: 'defaultTarget',
  8592. value: function defaultTarget(trigger) {
  8593. var selector = getAttributeValue('target', trigger);
  8594. if (selector) {
  8595. return document.querySelector(selector);
  8596. }
  8597. }
  8598. /**
  8599. * Returns the support of the given action, or all actions if no action is
  8600. * given.
  8601. * @param {String} [action]
  8602. */
  8603. }, {
  8604. key: 'defaultText',
  8605. /**
  8606. * Default `text` lookup function.
  8607. * @param {Element} trigger
  8608. */
  8609. value: function defaultText(trigger) {
  8610. return getAttributeValue('text', trigger);
  8611. }
  8612. /**
  8613. * Destroy lifecycle.
  8614. */
  8615. }, {
  8616. key: 'destroy',
  8617. value: function destroy() {
  8618. this.listener.destroy();
  8619. if (this.clipboardAction) {
  8620. this.clipboardAction.destroy();
  8621. this.clipboardAction = null;
  8622. }
  8623. }
  8624. }], [{
  8625. key: 'isSupported',
  8626. value: function isSupported() {
  8627. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8628. var actions = typeof action === 'string' ? [action] : action;
  8629. var support = !!document.queryCommandSupported;
  8630. actions.forEach(function (action) {
  8631. support = support && !!document.queryCommandSupported(action);
  8632. });
  8633. return support;
  8634. }
  8635. }]);
  8636. return Clipboard;
  8637. }(_tinyEmitter2.default);
  8638. /**
  8639. * Helper function to retrieve attribute value.
  8640. * @param {String} suffix
  8641. * @param {Element} element
  8642. */
  8643. function getAttributeValue(suffix, element) {
  8644. var attribute = 'data-clipboard-' + suffix;
  8645. if (!element.hasAttribute(attribute)) {
  8646. return;
  8647. }
  8648. return element.getAttribute(attribute);
  8649. }
  8650. module.exports = Clipboard;
  8651. /***/ }),
  8652. /* 1 */
  8653. /***/ (function(module, exports, __webpack_require__) {
  8654. "use strict";
  8655. 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; };
  8656. 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; }; }();
  8657. var _select = __webpack_require__(2);
  8658. var _select2 = _interopRequireDefault(_select);
  8659. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8660. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8661. /**
  8662. * Inner class which performs selection from either `text` or `target`
  8663. * properties and then executes copy or cut operations.
  8664. */
  8665. var ClipboardAction = function () {
  8666. /**
  8667. * @param {Object} options
  8668. */
  8669. function ClipboardAction(options) {
  8670. _classCallCheck(this, ClipboardAction);
  8671. this.resolveOptions(options);
  8672. this.initSelection();
  8673. }
  8674. /**
  8675. * Defines base properties passed from constructor.
  8676. * @param {Object} options
  8677. */
  8678. _createClass(ClipboardAction, [{
  8679. key: 'resolveOptions',
  8680. value: function resolveOptions() {
  8681. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8682. this.action = options.action;
  8683. this.container = options.container;
  8684. this.emitter = options.emitter;
  8685. this.target = options.target;
  8686. this.text = options.text;
  8687. this.trigger = options.trigger;
  8688. this.selectedText = '';
  8689. }
  8690. /**
  8691. * Decides which selection strategy is going to be applied based
  8692. * on the existence of `text` and `target` properties.
  8693. */
  8694. }, {
  8695. key: 'initSelection',
  8696. value: function initSelection() {
  8697. if (this.text) {
  8698. this.selectFake();
  8699. } else if (this.target) {
  8700. this.selectTarget();
  8701. }
  8702. }
  8703. /**
  8704. * Creates a fake textarea element, sets its value from `text` property,
  8705. * and makes a selection on it.
  8706. */
  8707. }, {
  8708. key: 'selectFake',
  8709. value: function selectFake() {
  8710. var _this = this;
  8711. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8712. this.removeFake();
  8713. this.fakeHandlerCallback = function () {
  8714. return _this.removeFake();
  8715. };
  8716. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8717. this.fakeElem = document.createElement('textarea');
  8718. // Prevent zooming on iOS
  8719. this.fakeElem.style.fontSize = '12pt';
  8720. // Reset box model
  8721. this.fakeElem.style.border = '0';
  8722. this.fakeElem.style.padding = '0';
  8723. this.fakeElem.style.margin = '0';
  8724. // Move element out of screen horizontally
  8725. this.fakeElem.style.position = 'absolute';
  8726. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8727. // Move element to the same position vertically
  8728. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8729. this.fakeElem.style.top = yPosition + 'px';
  8730. this.fakeElem.setAttribute('readonly', '');
  8731. this.fakeElem.value = this.text;
  8732. this.container.appendChild(this.fakeElem);
  8733. this.selectedText = (0, _select2.default)(this.fakeElem);
  8734. this.copyText();
  8735. }
  8736. /**
  8737. * Only removes the fake element after another click event, that way
  8738. * a user can hit `Ctrl+C` to copy because selection still exists.
  8739. */
  8740. }, {
  8741. key: 'removeFake',
  8742. value: function removeFake() {
  8743. if (this.fakeHandler) {
  8744. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8745. this.fakeHandler = null;
  8746. this.fakeHandlerCallback = null;
  8747. }
  8748. if (this.fakeElem) {
  8749. this.container.removeChild(this.fakeElem);
  8750. this.fakeElem = null;
  8751. }
  8752. }
  8753. /**
  8754. * Selects the content from element passed on `target` property.
  8755. */
  8756. }, {
  8757. key: 'selectTarget',
  8758. value: function selectTarget() {
  8759. this.selectedText = (0, _select2.default)(this.target);
  8760. this.copyText();
  8761. }
  8762. /**
  8763. * Executes the copy operation based on the current selection.
  8764. */
  8765. }, {
  8766. key: 'copyText',
  8767. value: function copyText() {
  8768. var succeeded = void 0;
  8769. try {
  8770. succeeded = document.execCommand(this.action);
  8771. } catch (err) {
  8772. succeeded = false;
  8773. }
  8774. this.handleResult(succeeded);
  8775. }
  8776. /**
  8777. * Fires an event based on the copy operation result.
  8778. * @param {Boolean} succeeded
  8779. */
  8780. }, {
  8781. key: 'handleResult',
  8782. value: function handleResult(succeeded) {
  8783. this.emitter.emit(succeeded ? 'success' : 'error', {
  8784. action: this.action,
  8785. text: this.selectedText,
  8786. trigger: this.trigger,
  8787. clearSelection: this.clearSelection.bind(this)
  8788. });
  8789. }
  8790. /**
  8791. * Moves focus away from `target` and back to the trigger, removes current selection.
  8792. */
  8793. }, {
  8794. key: 'clearSelection',
  8795. value: function clearSelection() {
  8796. if (this.trigger) {
  8797. this.trigger.focus();
  8798. }
  8799. window.getSelection().removeAllRanges();
  8800. }
  8801. /**
  8802. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8803. * @param {String} action
  8804. */
  8805. }, {
  8806. key: 'destroy',
  8807. /**
  8808. * Destroy lifecycle.
  8809. */
  8810. value: function destroy() {
  8811. this.removeFake();
  8812. }
  8813. }, {
  8814. key: 'action',
  8815. set: function set() {
  8816. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8817. this._action = action;
  8818. if (this._action !== 'copy' && this._action !== 'cut') {
  8819. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8820. }
  8821. }
  8822. /**
  8823. * Gets the `action` property.
  8824. * @return {String}
  8825. */
  8826. ,
  8827. get: function get() {
  8828. return this._action;
  8829. }
  8830. /**
  8831. * Sets the `target` property using an element
  8832. * that will be have its content copied.
  8833. * @param {Element} target
  8834. */
  8835. }, {
  8836. key: 'target',
  8837. set: function set(target) {
  8838. if (target !== undefined) {
  8839. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8840. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8841. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8842. }
  8843. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8844. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8845. }
  8846. this._target = target;
  8847. } else {
  8848. throw new Error('Invalid "target" value, use a valid Element');
  8849. }
  8850. }
  8851. }
  8852. /**
  8853. * Gets the `target` property.
  8854. * @return {String|HTMLElement}
  8855. */
  8856. ,
  8857. get: function get() {
  8858. return this._target;
  8859. }
  8860. }]);
  8861. return ClipboardAction;
  8862. }();
  8863. module.exports = ClipboardAction;
  8864. /***/ }),
  8865. /* 2 */
  8866. /***/ (function(module, exports) {
  8867. function select(element) {
  8868. var selectedText;
  8869. if (element.nodeName === 'SELECT') {
  8870. element.focus();
  8871. selectedText = element.value;
  8872. }
  8873. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8874. var isReadOnly = element.hasAttribute('readonly');
  8875. if (!isReadOnly) {
  8876. element.setAttribute('readonly', '');
  8877. }
  8878. element.select();
  8879. element.setSelectionRange(0, element.value.length);
  8880. if (!isReadOnly) {
  8881. element.removeAttribute('readonly');
  8882. }
  8883. selectedText = element.value;
  8884. }
  8885. else {
  8886. if (element.hasAttribute('contenteditable')) {
  8887. element.focus();
  8888. }
  8889. var selection = window.getSelection();
  8890. var range = document.createRange();
  8891. range.selectNodeContents(element);
  8892. selection.removeAllRanges();
  8893. selection.addRange(range);
  8894. selectedText = selection.toString();
  8895. }
  8896. return selectedText;
  8897. }
  8898. module.exports = select;
  8899. /***/ }),
  8900. /* 3 */
  8901. /***/ (function(module, exports) {
  8902. function E () {
  8903. // Keep this empty so it's easier to inherit from
  8904. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8905. }
  8906. E.prototype = {
  8907. on: function (name, callback, ctx) {
  8908. var e = this.e || (this.e = {});
  8909. (e[name] || (e[name] = [])).push({
  8910. fn: callback,
  8911. ctx: ctx
  8912. });
  8913. return this;
  8914. },
  8915. once: function (name, callback, ctx) {
  8916. var self = this;
  8917. function listener () {
  8918. self.off(name, listener);
  8919. callback.apply(ctx, arguments);
  8920. };
  8921. listener._ = callback
  8922. return this.on(name, listener, ctx);
  8923. },
  8924. emit: function (name) {
  8925. var data = [].slice.call(arguments, 1);
  8926. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8927. var i = 0;
  8928. var len = evtArr.length;
  8929. for (i; i < len; i++) {
  8930. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8931. }
  8932. return this;
  8933. },
  8934. off: function (name, callback) {
  8935. var e = this.e || (this.e = {});
  8936. var evts = e[name];
  8937. var liveEvents = [];
  8938. if (evts && callback) {
  8939. for (var i = 0, len = evts.length; i < len; i++) {
  8940. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8941. liveEvents.push(evts[i]);
  8942. }
  8943. }
  8944. // Remove event from queue to prevent memory leak
  8945. // Suggested by https://github.com/lazd
  8946. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8947. (liveEvents.length)
  8948. ? e[name] = liveEvents
  8949. : delete e[name];
  8950. return this;
  8951. }
  8952. };
  8953. module.exports = E;
  8954. /***/ }),
  8955. /* 4 */
  8956. /***/ (function(module, exports, __webpack_require__) {
  8957. var is = __webpack_require__(5);
  8958. var delegate = __webpack_require__(6);
  8959. /**
  8960. * Validates all params and calls the right
  8961. * listener function based on its target type.
  8962. *
  8963. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8964. * @param {String} type
  8965. * @param {Function} callback
  8966. * @return {Object}
  8967. */
  8968. function listen(target, type, callback) {
  8969. if (!target && !type && !callback) {
  8970. throw new Error('Missing required arguments');
  8971. }
  8972. if (!is.string(type)) {
  8973. throw new TypeError('Second argument must be a String');
  8974. }
  8975. if (!is.fn(callback)) {
  8976. throw new TypeError('Third argument must be a Function');
  8977. }
  8978. if (is.node(target)) {
  8979. return listenNode(target, type, callback);
  8980. }
  8981. else if (is.nodeList(target)) {
  8982. return listenNodeList(target, type, callback);
  8983. }
  8984. else if (is.string(target)) {
  8985. return listenSelector(target, type, callback);
  8986. }
  8987. else {
  8988. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8989. }
  8990. }
  8991. /**
  8992. * Adds an event listener to a HTML element
  8993. * and returns a remove listener function.
  8994. *
  8995. * @param {HTMLElement} node
  8996. * @param {String} type
  8997. * @param {Function} callback
  8998. * @return {Object}
  8999. */
  9000. function listenNode(node, type, callback) {
  9001. node.addEventListener(type, callback);
  9002. return {
  9003. destroy: function() {
  9004. node.removeEventListener(type, callback);
  9005. }
  9006. }
  9007. }
  9008. /**
  9009. * Add an event listener to a list of HTML elements
  9010. * and returns a remove listener function.
  9011. *
  9012. * @param {NodeList|HTMLCollection} nodeList
  9013. * @param {String} type
  9014. * @param {Function} callback
  9015. * @return {Object}
  9016. */
  9017. function listenNodeList(nodeList, type, callback) {
  9018. Array.prototype.forEach.call(nodeList, function(node) {
  9019. node.addEventListener(type, callback);
  9020. });
  9021. return {
  9022. destroy: function() {
  9023. Array.prototype.forEach.call(nodeList, function(node) {
  9024. node.removeEventListener(type, callback);
  9025. });
  9026. }
  9027. }
  9028. }
  9029. /**
  9030. * Add an event listener to a selector
  9031. * and returns a remove listener function.
  9032. *
  9033. * @param {String} selector
  9034. * @param {String} type
  9035. * @param {Function} callback
  9036. * @return {Object}
  9037. */
  9038. function listenSelector(selector, type, callback) {
  9039. return delegate(document.body, selector, type, callback);
  9040. }
  9041. module.exports = listen;
  9042. /***/ }),
  9043. /* 5 */
  9044. /***/ (function(module, exports) {
  9045. /**
  9046. * Check if argument is a HTML element.
  9047. *
  9048. * @param {Object} value
  9049. * @return {Boolean}
  9050. */
  9051. exports.node = function(value) {
  9052. return value !== undefined
  9053. && value instanceof HTMLElement
  9054. && value.nodeType === 1;
  9055. };
  9056. /**
  9057. * Check if argument is a list of HTML elements.
  9058. *
  9059. * @param {Object} value
  9060. * @return {Boolean}
  9061. */
  9062. exports.nodeList = function(value) {
  9063. var type = Object.prototype.toString.call(value);
  9064. return value !== undefined
  9065. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9066. && ('length' in value)
  9067. && (value.length === 0 || exports.node(value[0]));
  9068. };
  9069. /**
  9070. * Check if argument is a string.
  9071. *
  9072. * @param {Object} value
  9073. * @return {Boolean}
  9074. */
  9075. exports.string = function(value) {
  9076. return typeof value === 'string'
  9077. || value instanceof String;
  9078. };
  9079. /**
  9080. * Check if argument is a function.
  9081. *
  9082. * @param {Object} value
  9083. * @return {Boolean}
  9084. */
  9085. exports.fn = function(value) {
  9086. var type = Object.prototype.toString.call(value);
  9087. return type === '[object Function]';
  9088. };
  9089. /***/ }),
  9090. /* 6 */
  9091. /***/ (function(module, exports, __webpack_require__) {
  9092. var closest = __webpack_require__(7);
  9093. /**
  9094. * Delegates event to a selector.
  9095. *
  9096. * @param {Element} element
  9097. * @param {String} selector
  9098. * @param {String} type
  9099. * @param {Function} callback
  9100. * @param {Boolean} useCapture
  9101. * @return {Object}
  9102. */
  9103. function _delegate(element, selector, type, callback, useCapture) {
  9104. var listenerFn = listener.apply(this, arguments);
  9105. element.addEventListener(type, listenerFn, useCapture);
  9106. return {
  9107. destroy: function() {
  9108. element.removeEventListener(type, listenerFn, useCapture);
  9109. }
  9110. }
  9111. }
  9112. /**
  9113. * Delegates event to a selector.
  9114. *
  9115. * @param {Element|String|Array} [elements]
  9116. * @param {String} selector
  9117. * @param {String} type
  9118. * @param {Function} callback
  9119. * @param {Boolean} useCapture
  9120. * @return {Object}
  9121. */
  9122. function delegate(elements, selector, type, callback, useCapture) {
  9123. // Handle the regular Element usage
  9124. if (typeof elements.addEventListener === 'function') {
  9125. return _delegate.apply(null, arguments);
  9126. }
  9127. // Handle Element-less usage, it defaults to global delegation
  9128. if (typeof type === 'function') {
  9129. // Use `document` as the first parameter, then apply arguments
  9130. // This is a short way to .unshift `arguments` without running into deoptimizations
  9131. return _delegate.bind(null, document).apply(null, arguments);
  9132. }
  9133. // Handle Selector-based usage
  9134. if (typeof elements === 'string') {
  9135. elements = document.querySelectorAll(elements);
  9136. }
  9137. // Handle Array-like based usage
  9138. return Array.prototype.map.call(elements, function (element) {
  9139. return _delegate(element, selector, type, callback, useCapture);
  9140. });
  9141. }
  9142. /**
  9143. * Finds closest match and invokes callback.
  9144. *
  9145. * @param {Element} element
  9146. * @param {String} selector
  9147. * @param {String} type
  9148. * @param {Function} callback
  9149. * @return {Function}
  9150. */
  9151. function listener(element, selector, type, callback) {
  9152. return function(e) {
  9153. e.delegateTarget = closest(e.target, selector);
  9154. if (e.delegateTarget) {
  9155. callback.call(element, e);
  9156. }
  9157. }
  9158. }
  9159. module.exports = delegate;
  9160. /***/ }),
  9161. /* 7 */
  9162. /***/ (function(module, exports) {
  9163. var DOCUMENT_NODE_TYPE = 9;
  9164. /**
  9165. * A polyfill for Element.matches()
  9166. */
  9167. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9168. var proto = Element.prototype;
  9169. proto.matches = proto.matchesSelector ||
  9170. proto.mozMatchesSelector ||
  9171. proto.msMatchesSelector ||
  9172. proto.oMatchesSelector ||
  9173. proto.webkitMatchesSelector;
  9174. }
  9175. /**
  9176. * Finds the closest parent that matches a selector.
  9177. *
  9178. * @param {Element} element
  9179. * @param {String} selector
  9180. * @return {Function}
  9181. */
  9182. function closest (element, selector) {
  9183. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9184. if (typeof element.matches === 'function' &&
  9185. element.matches(selector)) {
  9186. return element;
  9187. }
  9188. element = element.parentNode;
  9189. }
  9190. }
  9191. module.exports = closest;
  9192. /***/ })
  9193. /******/ ]);
  9194. });
  9195. /***/ }),
  9196. /***/ "./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&":
  9197. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9198. !*** ./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& ***!
  9199. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9200. /*! no static exports found */
  9201. /***/ (function(module, exports, __webpack_require__) {
  9202. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9203. // imports
  9204. // module
  9205. 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", ""]);
  9206. // exports
  9207. /***/ }),
  9208. /***/ "./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&":
  9209. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9210. !*** ./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& ***!
  9211. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9212. /*! no static exports found */
  9213. /***/ (function(module, exports, __webpack_require__) {
  9214. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9215. // imports
  9216. // module
  9217. 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", ""]);
  9218. // exports
  9219. /***/ }),
  9220. /***/ "./node_modules/css-loader/lib/css-base.js":
  9221. /*!*************************************************!*\
  9222. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9223. \*************************************************/
  9224. /*! no static exports found */
  9225. /***/ (function(module, exports) {
  9226. /*
  9227. MIT License http://www.opensource.org/licenses/mit-license.php
  9228. Author Tobias Koppers @sokra
  9229. */
  9230. // css base code, injected by the css-loader
  9231. module.exports = function(useSourceMap) {
  9232. var list = [];
  9233. // return the list of modules as css string
  9234. list.toString = function toString() {
  9235. return this.map(function (item) {
  9236. var content = cssWithMappingToString(item, useSourceMap);
  9237. if(item[2]) {
  9238. return "@media " + item[2] + "{" + content + "}";
  9239. } else {
  9240. return content;
  9241. }
  9242. }).join("");
  9243. };
  9244. // import a list of modules into the list
  9245. list.i = function(modules, mediaQuery) {
  9246. if(typeof modules === "string")
  9247. modules = [[null, modules, ""]];
  9248. var alreadyImportedModules = {};
  9249. for(var i = 0; i < this.length; i++) {
  9250. var id = this[i][0];
  9251. if(typeof id === "number")
  9252. alreadyImportedModules[id] = true;
  9253. }
  9254. for(i = 0; i < modules.length; i++) {
  9255. var item = modules[i];
  9256. // skip already imported module
  9257. // this implementation is not 100% perfect for weird media query combinations
  9258. // when a module is imported multiple times with different media queries.
  9259. // I hope this will never occur (Hey this way we have smaller bundles)
  9260. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9261. if(mediaQuery && !item[2]) {
  9262. item[2] = mediaQuery;
  9263. } else if(mediaQuery) {
  9264. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9265. }
  9266. list.push(item);
  9267. }
  9268. }
  9269. };
  9270. return list;
  9271. };
  9272. function cssWithMappingToString(item, useSourceMap) {
  9273. var content = item[1] || '';
  9274. var cssMapping = item[3];
  9275. if (!cssMapping) {
  9276. return content;
  9277. }
  9278. if (useSourceMap && typeof btoa === 'function') {
  9279. var sourceMapping = toComment(cssMapping);
  9280. var sourceURLs = cssMapping.sources.map(function (source) {
  9281. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9282. });
  9283. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9284. }
  9285. return [content].join('\n');
  9286. }
  9287. // Adapted from convert-source-map (MIT)
  9288. function toComment(sourceMap) {
  9289. // eslint-disable-next-line no-undef
  9290. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9291. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9292. return '/*# ' + data + ' */';
  9293. }
  9294. /***/ }),
  9295. /***/ "./node_modules/ieee754/index.js":
  9296. /*!***************************************!*\
  9297. !*** ./node_modules/ieee754/index.js ***!
  9298. \***************************************/
  9299. /*! no static exports found */
  9300. /***/ (function(module, exports) {
  9301. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9302. var e, m
  9303. var eLen = (nBytes * 8) - mLen - 1
  9304. var eMax = (1 << eLen) - 1
  9305. var eBias = eMax >> 1
  9306. var nBits = -7
  9307. var i = isLE ? (nBytes - 1) : 0
  9308. var d = isLE ? -1 : 1
  9309. var s = buffer[offset + i]
  9310. i += d
  9311. e = s & ((1 << (-nBits)) - 1)
  9312. s >>= (-nBits)
  9313. nBits += eLen
  9314. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9315. m = e & ((1 << (-nBits)) - 1)
  9316. e >>= (-nBits)
  9317. nBits += mLen
  9318. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9319. if (e === 0) {
  9320. e = 1 - eBias
  9321. } else if (e === eMax) {
  9322. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9323. } else {
  9324. m = m + Math.pow(2, mLen)
  9325. e = e - eBias
  9326. }
  9327. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9328. }
  9329. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9330. var e, m, c
  9331. var eLen = (nBytes * 8) - mLen - 1
  9332. var eMax = (1 << eLen) - 1
  9333. var eBias = eMax >> 1
  9334. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9335. var i = isLE ? 0 : (nBytes - 1)
  9336. var d = isLE ? 1 : -1
  9337. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9338. value = Math.abs(value)
  9339. if (isNaN(value) || value === Infinity) {
  9340. m = isNaN(value) ? 1 : 0
  9341. e = eMax
  9342. } else {
  9343. e = Math.floor(Math.log(value) / Math.LN2)
  9344. if (value * (c = Math.pow(2, -e)) < 1) {
  9345. e--
  9346. c *= 2
  9347. }
  9348. if (e + eBias >= 1) {
  9349. value += rt / c
  9350. } else {
  9351. value += rt * Math.pow(2, 1 - eBias)
  9352. }
  9353. if (value * c >= 2) {
  9354. e++
  9355. c /= 2
  9356. }
  9357. if (e + eBias >= eMax) {
  9358. m = 0
  9359. e = eMax
  9360. } else if (e + eBias >= 1) {
  9361. m = ((value * c) - 1) * Math.pow(2, mLen)
  9362. e = e + eBias
  9363. } else {
  9364. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9365. e = 0
  9366. }
  9367. }
  9368. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9369. e = (e << mLen) | m
  9370. eLen += mLen
  9371. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9372. buffer[offset + i - d] |= s * 128
  9373. }
  9374. /***/ }),
  9375. /***/ "./node_modules/isarray/index.js":
  9376. /*!***************************************!*\
  9377. !*** ./node_modules/isarray/index.js ***!
  9378. \***************************************/
  9379. /*! no static exports found */
  9380. /***/ (function(module, exports) {
  9381. var toString = {}.toString;
  9382. module.exports = Array.isArray || function (arr) {
  9383. return toString.call(arr) == '[object Array]';
  9384. };
  9385. /***/ }),
  9386. /***/ "./node_modules/jquery/dist/jquery.js":
  9387. /*!********************************************!*\
  9388. !*** ./node_modules/jquery/dist/jquery.js ***!
  9389. \********************************************/
  9390. /*! no static exports found */
  9391. /***/ (function(module, exports, __webpack_require__) {
  9392. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9393. * jQuery JavaScript Library v3.4.1
  9394. * https://jquery.com/
  9395. *
  9396. * Includes Sizzle.js
  9397. * https://sizzlejs.com/
  9398. *
  9399. * Copyright JS Foundation and other contributors
  9400. * Released under the MIT license
  9401. * https://jquery.org/license
  9402. *
  9403. * Date: 2019-05-01T21:04Z
  9404. */
  9405. ( function( global, factory ) {
  9406. "use strict";
  9407. if ( true && typeof module.exports === "object" ) {
  9408. // For CommonJS and CommonJS-like environments where a proper `window`
  9409. // is present, execute the factory and get jQuery.
  9410. // For environments that do not have a `window` with a `document`
  9411. // (such as Node.js), expose a factory as module.exports.
  9412. // This accentuates the need for the creation of a real `window`.
  9413. // e.g. var jQuery = require("jquery")(window);
  9414. // See ticket #14549 for more info.
  9415. module.exports = global.document ?
  9416. factory( global, true ) :
  9417. function( w ) {
  9418. if ( !w.document ) {
  9419. throw new Error( "jQuery requires a window with a document" );
  9420. }
  9421. return factory( w );
  9422. };
  9423. } else {
  9424. factory( global );
  9425. }
  9426. // Pass this if window is not defined yet
  9427. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9428. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9429. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9430. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9431. // enough that all such attempts are guarded in a try block.
  9432. "use strict";
  9433. var arr = [];
  9434. var document = window.document;
  9435. var getProto = Object.getPrototypeOf;
  9436. var slice = arr.slice;
  9437. var concat = arr.concat;
  9438. var push = arr.push;
  9439. var indexOf = arr.indexOf;
  9440. var class2type = {};
  9441. var toString = class2type.toString;
  9442. var hasOwn = class2type.hasOwnProperty;
  9443. var fnToString = hasOwn.toString;
  9444. var ObjectFunctionString = fnToString.call( Object );
  9445. var support = {};
  9446. var isFunction = function isFunction( obj ) {
  9447. // Support: Chrome <=57, Firefox <=52
  9448. // In some browsers, typeof returns "function" for HTML <object> elements
  9449. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9450. // We don't want to classify *any* DOM node as a function.
  9451. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9452. };
  9453. var isWindow = function isWindow( obj ) {
  9454. return obj != null && obj === obj.window;
  9455. };
  9456. var preservedScriptAttributes = {
  9457. type: true,
  9458. src: true,
  9459. nonce: true,
  9460. noModule: true
  9461. };
  9462. function DOMEval( code, node, doc ) {
  9463. doc = doc || document;
  9464. var i, val,
  9465. script = doc.createElement( "script" );
  9466. script.text = code;
  9467. if ( node ) {
  9468. for ( i in preservedScriptAttributes ) {
  9469. // Support: Firefox 64+, Edge 18+
  9470. // Some browsers don't support the "nonce" property on scripts.
  9471. // On the other hand, just using `getAttribute` is not enough as
  9472. // the `nonce` attribute is reset to an empty string whenever it
  9473. // becomes browsing-context connected.
  9474. // See https://github.com/whatwg/html/issues/2369
  9475. // See https://html.spec.whatwg.org/#nonce-attributes
  9476. // The `node.getAttribute` check was added for the sake of
  9477. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9478. // via an object.
  9479. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9480. if ( val ) {
  9481. script.setAttribute( i, val );
  9482. }
  9483. }
  9484. }
  9485. doc.head.appendChild( script ).parentNode.removeChild( script );
  9486. }
  9487. function toType( obj ) {
  9488. if ( obj == null ) {
  9489. return obj + "";
  9490. }
  9491. // Support: Android <=2.3 only (functionish RegExp)
  9492. return typeof obj === "object" || typeof obj === "function" ?
  9493. class2type[ toString.call( obj ) ] || "object" :
  9494. typeof obj;
  9495. }
  9496. /* global Symbol */
  9497. // Defining this global in .eslintrc.json would create a danger of using the global
  9498. // unguarded in another place, it seems safer to define global only for this module
  9499. var
  9500. version = "3.4.1",
  9501. // Define a local copy of jQuery
  9502. jQuery = function( selector, context ) {
  9503. // The jQuery object is actually just the init constructor 'enhanced'
  9504. // Need init if jQuery is called (just allow error to be thrown if not included)
  9505. return new jQuery.fn.init( selector, context );
  9506. },
  9507. // Support: Android <=4.0 only
  9508. // Make sure we trim BOM and NBSP
  9509. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9510. jQuery.fn = jQuery.prototype = {
  9511. // The current version of jQuery being used
  9512. jquery: version,
  9513. constructor: jQuery,
  9514. // The default length of a jQuery object is 0
  9515. length: 0,
  9516. toArray: function() {
  9517. return slice.call( this );
  9518. },
  9519. // Get the Nth element in the matched element set OR
  9520. // Get the whole matched element set as a clean array
  9521. get: function( num ) {
  9522. // Return all the elements in a clean array
  9523. if ( num == null ) {
  9524. return slice.call( this );
  9525. }
  9526. // Return just the one element from the set
  9527. return num < 0 ? this[ num + this.length ] : this[ num ];
  9528. },
  9529. // Take an array of elements and push it onto the stack
  9530. // (returning the new matched element set)
  9531. pushStack: function( elems ) {
  9532. // Build a new jQuery matched element set
  9533. var ret = jQuery.merge( this.constructor(), elems );
  9534. // Add the old object onto the stack (as a reference)
  9535. ret.prevObject = this;
  9536. // Return the newly-formed element set
  9537. return ret;
  9538. },
  9539. // Execute a callback for every element in the matched set.
  9540. each: function( callback ) {
  9541. return jQuery.each( this, callback );
  9542. },
  9543. map: function( callback ) {
  9544. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9545. return callback.call( elem, i, elem );
  9546. } ) );
  9547. },
  9548. slice: function() {
  9549. return this.pushStack( slice.apply( this, arguments ) );
  9550. },
  9551. first: function() {
  9552. return this.eq( 0 );
  9553. },
  9554. last: function() {
  9555. return this.eq( -1 );
  9556. },
  9557. eq: function( i ) {
  9558. var len = this.length,
  9559. j = +i + ( i < 0 ? len : 0 );
  9560. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9561. },
  9562. end: function() {
  9563. return this.prevObject || this.constructor();
  9564. },
  9565. // For internal use only.
  9566. // Behaves like an Array's method, not like a jQuery method.
  9567. push: push,
  9568. sort: arr.sort,
  9569. splice: arr.splice
  9570. };
  9571. jQuery.extend = jQuery.fn.extend = function() {
  9572. var options, name, src, copy, copyIsArray, clone,
  9573. target = arguments[ 0 ] || {},
  9574. i = 1,
  9575. length = arguments.length,
  9576. deep = false;
  9577. // Handle a deep copy situation
  9578. if ( typeof target === "boolean" ) {
  9579. deep = target;
  9580. // Skip the boolean and the target
  9581. target = arguments[ i ] || {};
  9582. i++;
  9583. }
  9584. // Handle case when target is a string or something (possible in deep copy)
  9585. if ( typeof target !== "object" && !isFunction( target ) ) {
  9586. target = {};
  9587. }
  9588. // Extend jQuery itself if only one argument is passed
  9589. if ( i === length ) {
  9590. target = this;
  9591. i--;
  9592. }
  9593. for ( ; i < length; i++ ) {
  9594. // Only deal with non-null/undefined values
  9595. if ( ( options = arguments[ i ] ) != null ) {
  9596. // Extend the base object
  9597. for ( name in options ) {
  9598. copy = options[ name ];
  9599. // Prevent Object.prototype pollution
  9600. // Prevent never-ending loop
  9601. if ( name === "__proto__" || target === copy ) {
  9602. continue;
  9603. }
  9604. // Recurse if we're merging plain objects or arrays
  9605. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9606. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9607. src = target[ name ];
  9608. // Ensure proper type for the source value
  9609. if ( copyIsArray && !Array.isArray( src ) ) {
  9610. clone = [];
  9611. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9612. clone = {};
  9613. } else {
  9614. clone = src;
  9615. }
  9616. copyIsArray = false;
  9617. // Never move original objects, clone them
  9618. target[ name ] = jQuery.extend( deep, clone, copy );
  9619. // Don't bring in undefined values
  9620. } else if ( copy !== undefined ) {
  9621. target[ name ] = copy;
  9622. }
  9623. }
  9624. }
  9625. }
  9626. // Return the modified object
  9627. return target;
  9628. };
  9629. jQuery.extend( {
  9630. // Unique for each copy of jQuery on the page
  9631. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9632. // Assume jQuery is ready without the ready module
  9633. isReady: true,
  9634. error: function( msg ) {
  9635. throw new Error( msg );
  9636. },
  9637. noop: function() {},
  9638. isPlainObject: function( obj ) {
  9639. var proto, Ctor;
  9640. // Detect obvious negatives
  9641. // Use toString instead of jQuery.type to catch host objects
  9642. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9643. return false;
  9644. }
  9645. proto = getProto( obj );
  9646. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9647. if ( !proto ) {
  9648. return true;
  9649. }
  9650. // Objects with prototype are plain iff they were constructed by a global Object function
  9651. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9652. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9653. },
  9654. isEmptyObject: function( obj ) {
  9655. var name;
  9656. for ( name in obj ) {
  9657. return false;
  9658. }
  9659. return true;
  9660. },
  9661. // Evaluates a script in a global context
  9662. globalEval: function( code, options ) {
  9663. DOMEval( code, { nonce: options && options.nonce } );
  9664. },
  9665. each: function( obj, callback ) {
  9666. var length, i = 0;
  9667. if ( isArrayLike( obj ) ) {
  9668. length = obj.length;
  9669. for ( ; i < length; i++ ) {
  9670. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9671. break;
  9672. }
  9673. }
  9674. } else {
  9675. for ( i in obj ) {
  9676. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9677. break;
  9678. }
  9679. }
  9680. }
  9681. return obj;
  9682. },
  9683. // Support: Android <=4.0 only
  9684. trim: function( text ) {
  9685. return text == null ?
  9686. "" :
  9687. ( text + "" ).replace( rtrim, "" );
  9688. },
  9689. // results is for internal usage only
  9690. makeArray: function( arr, results ) {
  9691. var ret = results || [];
  9692. if ( arr != null ) {
  9693. if ( isArrayLike( Object( arr ) ) ) {
  9694. jQuery.merge( ret,
  9695. typeof arr === "string" ?
  9696. [ arr ] : arr
  9697. );
  9698. } else {
  9699. push.call( ret, arr );
  9700. }
  9701. }
  9702. return ret;
  9703. },
  9704. inArray: function( elem, arr, i ) {
  9705. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9706. },
  9707. // Support: Android <=4.0 only, PhantomJS 1 only
  9708. // push.apply(_, arraylike) throws on ancient WebKit
  9709. merge: function( first, second ) {
  9710. var len = +second.length,
  9711. j = 0,
  9712. i = first.length;
  9713. for ( ; j < len; j++ ) {
  9714. first[ i++ ] = second[ j ];
  9715. }
  9716. first.length = i;
  9717. return first;
  9718. },
  9719. grep: function( elems, callback, invert ) {
  9720. var callbackInverse,
  9721. matches = [],
  9722. i = 0,
  9723. length = elems.length,
  9724. callbackExpect = !invert;
  9725. // Go through the array, only saving the items
  9726. // that pass the validator function
  9727. for ( ; i < length; i++ ) {
  9728. callbackInverse = !callback( elems[ i ], i );
  9729. if ( callbackInverse !== callbackExpect ) {
  9730. matches.push( elems[ i ] );
  9731. }
  9732. }
  9733. return matches;
  9734. },
  9735. // arg is for internal usage only
  9736. map: function( elems, callback, arg ) {
  9737. var length, value,
  9738. i = 0,
  9739. ret = [];
  9740. // Go through the array, translating each of the items to their new values
  9741. if ( isArrayLike( elems ) ) {
  9742. length = elems.length;
  9743. for ( ; i < length; i++ ) {
  9744. value = callback( elems[ i ], i, arg );
  9745. if ( value != null ) {
  9746. ret.push( value );
  9747. }
  9748. }
  9749. // Go through every key on the object,
  9750. } else {
  9751. for ( i in elems ) {
  9752. value = callback( elems[ i ], i, arg );
  9753. if ( value != null ) {
  9754. ret.push( value );
  9755. }
  9756. }
  9757. }
  9758. // Flatten any nested arrays
  9759. return concat.apply( [], ret );
  9760. },
  9761. // A global GUID counter for objects
  9762. guid: 1,
  9763. // jQuery.support is not used in Core but other projects attach their
  9764. // properties to it so it needs to exist.
  9765. support: support
  9766. } );
  9767. if ( typeof Symbol === "function" ) {
  9768. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9769. }
  9770. // Populate the class2type map
  9771. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9772. function( i, name ) {
  9773. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9774. } );
  9775. function isArrayLike( obj ) {
  9776. // Support: real iOS 8.2 only (not reproducible in simulator)
  9777. // `in` check used to prevent JIT error (gh-2145)
  9778. // hasOwn isn't used here due to false negatives
  9779. // regarding Nodelist length in IE
  9780. var length = !!obj && "length" in obj && obj.length,
  9781. type = toType( obj );
  9782. if ( isFunction( obj ) || isWindow( obj ) ) {
  9783. return false;
  9784. }
  9785. return type === "array" || length === 0 ||
  9786. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9787. }
  9788. var Sizzle =
  9789. /*!
  9790. * Sizzle CSS Selector Engine v2.3.4
  9791. * https://sizzlejs.com/
  9792. *
  9793. * Copyright JS Foundation and other contributors
  9794. * Released under the MIT license
  9795. * https://js.foundation/
  9796. *
  9797. * Date: 2019-04-08
  9798. */
  9799. (function( window ) {
  9800. var i,
  9801. support,
  9802. Expr,
  9803. getText,
  9804. isXML,
  9805. tokenize,
  9806. compile,
  9807. select,
  9808. outermostContext,
  9809. sortInput,
  9810. hasDuplicate,
  9811. // Local document vars
  9812. setDocument,
  9813. document,
  9814. docElem,
  9815. documentIsHTML,
  9816. rbuggyQSA,
  9817. rbuggyMatches,
  9818. matches,
  9819. contains,
  9820. // Instance-specific data
  9821. expando = "sizzle" + 1 * new Date(),
  9822. preferredDoc = window.document,
  9823. dirruns = 0,
  9824. done = 0,
  9825. classCache = createCache(),
  9826. tokenCache = createCache(),
  9827. compilerCache = createCache(),
  9828. nonnativeSelectorCache = createCache(),
  9829. sortOrder = function( a, b ) {
  9830. if ( a === b ) {
  9831. hasDuplicate = true;
  9832. }
  9833. return 0;
  9834. },
  9835. // Instance methods
  9836. hasOwn = ({}).hasOwnProperty,
  9837. arr = [],
  9838. pop = arr.pop,
  9839. push_native = arr.push,
  9840. push = arr.push,
  9841. slice = arr.slice,
  9842. // Use a stripped-down indexOf as it's faster than native
  9843. // https://jsperf.com/thor-indexof-vs-for/5
  9844. indexOf = function( list, elem ) {
  9845. var i = 0,
  9846. len = list.length;
  9847. for ( ; i < len; i++ ) {
  9848. if ( list[i] === elem ) {
  9849. return i;
  9850. }
  9851. }
  9852. return -1;
  9853. },
  9854. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9855. // Regular expressions
  9856. // http://www.w3.org/TR/css3-selectors/#whitespace
  9857. whitespace = "[\\x20\\t\\r\\n\\f]",
  9858. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9859. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9860. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9861. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9862. // Operator (capture 2)
  9863. "*([*^$|!~]?=)" + whitespace +
  9864. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9865. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9866. "*\\]",
  9867. pseudos = ":(" + identifier + ")(?:\\((" +
  9868. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9869. // 1. quoted (capture 3; capture 4 or capture 5)
  9870. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9871. // 2. simple (capture 6)
  9872. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9873. // 3. anything else (capture 2)
  9874. ".*" +
  9875. ")\\)|)",
  9876. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9877. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9878. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9879. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9880. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9881. rdescend = new RegExp( whitespace + "|>" ),
  9882. rpseudo = new RegExp( pseudos ),
  9883. ridentifier = new RegExp( "^" + identifier + "$" ),
  9884. matchExpr = {
  9885. "ID": new RegExp( "^#(" + identifier + ")" ),
  9886. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9887. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9888. "ATTR": new RegExp( "^" + attributes ),
  9889. "PSEUDO": new RegExp( "^" + pseudos ),
  9890. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9891. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9892. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9893. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9894. // For use in libraries implementing .is()
  9895. // We use this for POS matching in `select`
  9896. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9897. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9898. },
  9899. rhtml = /HTML$/i,
  9900. rinputs = /^(?:input|select|textarea|button)$/i,
  9901. rheader = /^h\d$/i,
  9902. rnative = /^[^{]+\{\s*\[native \w/,
  9903. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9904. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9905. rsibling = /[+~]/,
  9906. // CSS escapes
  9907. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9908. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9909. funescape = function( _, escaped, escapedWhitespace ) {
  9910. var high = "0x" + escaped - 0x10000;
  9911. // NaN means non-codepoint
  9912. // Support: Firefox<24
  9913. // Workaround erroneous numeric interpretation of +"0x"
  9914. return high !== high || escapedWhitespace ?
  9915. escaped :
  9916. high < 0 ?
  9917. // BMP codepoint
  9918. String.fromCharCode( high + 0x10000 ) :
  9919. // Supplemental Plane codepoint (surrogate pair)
  9920. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9921. },
  9922. // CSS string/identifier serialization
  9923. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9924. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9925. fcssescape = function( ch, asCodePoint ) {
  9926. if ( asCodePoint ) {
  9927. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9928. if ( ch === "\0" ) {
  9929. return "\uFFFD";
  9930. }
  9931. // Control characters and (dependent upon position) numbers get escaped as code points
  9932. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9933. }
  9934. // Other potentially-special ASCII characters get backslash-escaped
  9935. return "\\" + ch;
  9936. },
  9937. // Used for iframes
  9938. // See setDocument()
  9939. // Removing the function wrapper causes a "Permission Denied"
  9940. // error in IE
  9941. unloadHandler = function() {
  9942. setDocument();
  9943. },
  9944. inDisabledFieldset = addCombinator(
  9945. function( elem ) {
  9946. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9947. },
  9948. { dir: "parentNode", next: "legend" }
  9949. );
  9950. // Optimize for push.apply( _, NodeList )
  9951. try {
  9952. push.apply(
  9953. (arr = slice.call( preferredDoc.childNodes )),
  9954. preferredDoc.childNodes
  9955. );
  9956. // Support: Android<4.0
  9957. // Detect silently failing push.apply
  9958. arr[ preferredDoc.childNodes.length ].nodeType;
  9959. } catch ( e ) {
  9960. push = { apply: arr.length ?
  9961. // Leverage slice if possible
  9962. function( target, els ) {
  9963. push_native.apply( target, slice.call(els) );
  9964. } :
  9965. // Support: IE<9
  9966. // Otherwise append directly
  9967. function( target, els ) {
  9968. var j = target.length,
  9969. i = 0;
  9970. // Can't trust NodeList.length
  9971. while ( (target[j++] = els[i++]) ) {}
  9972. target.length = j - 1;
  9973. }
  9974. };
  9975. }
  9976. function Sizzle( selector, context, results, seed ) {
  9977. var m, i, elem, nid, match, groups, newSelector,
  9978. newContext = context && context.ownerDocument,
  9979. // nodeType defaults to 9, since context defaults to document
  9980. nodeType = context ? context.nodeType : 9;
  9981. results = results || [];
  9982. // Return early from calls with invalid selector or context
  9983. if ( typeof selector !== "string" || !selector ||
  9984. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9985. return results;
  9986. }
  9987. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9988. if ( !seed ) {
  9989. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9990. setDocument( context );
  9991. }
  9992. context = context || document;
  9993. if ( documentIsHTML ) {
  9994. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9995. // (excepting DocumentFragment context, where the methods don't exist)
  9996. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9997. // ID selector
  9998. if ( (m = match[1]) ) {
  9999. // Document context
  10000. if ( nodeType === 9 ) {
  10001. if ( (elem = context.getElementById( m )) ) {
  10002. // Support: IE, Opera, Webkit
  10003. // TODO: identify versions
  10004. // getElementById can match elements by name instead of ID
  10005. if ( elem.id === m ) {
  10006. results.push( elem );
  10007. return results;
  10008. }
  10009. } else {
  10010. return results;
  10011. }
  10012. // Element context
  10013. } else {
  10014. // Support: IE, Opera, Webkit
  10015. // TODO: identify versions
  10016. // getElementById can match elements by name instead of ID
  10017. if ( newContext && (elem = newContext.getElementById( m )) &&
  10018. contains( context, elem ) &&
  10019. elem.id === m ) {
  10020. results.push( elem );
  10021. return results;
  10022. }
  10023. }
  10024. // Type selector
  10025. } else if ( match[2] ) {
  10026. push.apply( results, context.getElementsByTagName( selector ) );
  10027. return results;
  10028. // Class selector
  10029. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10030. context.getElementsByClassName ) {
  10031. push.apply( results, context.getElementsByClassName( m ) );
  10032. return results;
  10033. }
  10034. }
  10035. // Take advantage of querySelectorAll
  10036. if ( support.qsa &&
  10037. !nonnativeSelectorCache[ selector + " " ] &&
  10038. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10039. // Support: IE 8 only
  10040. // Exclude object elements
  10041. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10042. newSelector = selector;
  10043. newContext = context;
  10044. // qSA considers elements outside a scoping root when evaluating child or
  10045. // descendant combinators, which is not what we want.
  10046. // In such cases, we work around the behavior by prefixing every selector in the
  10047. // list with an ID selector referencing the scope context.
  10048. // Thanks to Andrew Dupont for this technique.
  10049. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10050. // Capture the context ID, setting it first if necessary
  10051. if ( (nid = context.getAttribute( "id" )) ) {
  10052. nid = nid.replace( rcssescape, fcssescape );
  10053. } else {
  10054. context.setAttribute( "id", (nid = expando) );
  10055. }
  10056. // Prefix every selector in the list
  10057. groups = tokenize( selector );
  10058. i = groups.length;
  10059. while ( i-- ) {
  10060. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10061. }
  10062. newSelector = groups.join( "," );
  10063. // Expand context for sibling selectors
  10064. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10065. context;
  10066. }
  10067. try {
  10068. push.apply( results,
  10069. newContext.querySelectorAll( newSelector )
  10070. );
  10071. return results;
  10072. } catch ( qsaError ) {
  10073. nonnativeSelectorCache( selector, true );
  10074. } finally {
  10075. if ( nid === expando ) {
  10076. context.removeAttribute( "id" );
  10077. }
  10078. }
  10079. }
  10080. }
  10081. }
  10082. // All others
  10083. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10084. }
  10085. /**
  10086. * Create key-value caches of limited size
  10087. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10088. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10089. * deleting the oldest entry
  10090. */
  10091. function createCache() {
  10092. var keys = [];
  10093. function cache( key, value ) {
  10094. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10095. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10096. // Only keep the most recent entries
  10097. delete cache[ keys.shift() ];
  10098. }
  10099. return (cache[ key + " " ] = value);
  10100. }
  10101. return cache;
  10102. }
  10103. /**
  10104. * Mark a function for special use by Sizzle
  10105. * @param {Function} fn The function to mark
  10106. */
  10107. function markFunction( fn ) {
  10108. fn[ expando ] = true;
  10109. return fn;
  10110. }
  10111. /**
  10112. * Support testing using an element
  10113. * @param {Function} fn Passed the created element and returns a boolean result
  10114. */
  10115. function assert( fn ) {
  10116. var el = document.createElement("fieldset");
  10117. try {
  10118. return !!fn( el );
  10119. } catch (e) {
  10120. return false;
  10121. } finally {
  10122. // Remove from its parent by default
  10123. if ( el.parentNode ) {
  10124. el.parentNode.removeChild( el );
  10125. }
  10126. // release memory in IE
  10127. el = null;
  10128. }
  10129. }
  10130. /**
  10131. * Adds the same handler for all of the specified attrs
  10132. * @param {String} attrs Pipe-separated list of attributes
  10133. * @param {Function} handler The method that will be applied
  10134. */
  10135. function addHandle( attrs, handler ) {
  10136. var arr = attrs.split("|"),
  10137. i = arr.length;
  10138. while ( i-- ) {
  10139. Expr.attrHandle[ arr[i] ] = handler;
  10140. }
  10141. }
  10142. /**
  10143. * Checks document order of two siblings
  10144. * @param {Element} a
  10145. * @param {Element} b
  10146. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10147. */
  10148. function siblingCheck( a, b ) {
  10149. var cur = b && a,
  10150. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10151. a.sourceIndex - b.sourceIndex;
  10152. // Use IE sourceIndex if available on both nodes
  10153. if ( diff ) {
  10154. return diff;
  10155. }
  10156. // Check if b follows a
  10157. if ( cur ) {
  10158. while ( (cur = cur.nextSibling) ) {
  10159. if ( cur === b ) {
  10160. return -1;
  10161. }
  10162. }
  10163. }
  10164. return a ? 1 : -1;
  10165. }
  10166. /**
  10167. * Returns a function to use in pseudos for input types
  10168. * @param {String} type
  10169. */
  10170. function createInputPseudo( type ) {
  10171. return function( elem ) {
  10172. var name = elem.nodeName.toLowerCase();
  10173. return name === "input" && elem.type === type;
  10174. };
  10175. }
  10176. /**
  10177. * Returns a function to use in pseudos for buttons
  10178. * @param {String} type
  10179. */
  10180. function createButtonPseudo( type ) {
  10181. return function( elem ) {
  10182. var name = elem.nodeName.toLowerCase();
  10183. return (name === "input" || name === "button") && elem.type === type;
  10184. };
  10185. }
  10186. /**
  10187. * Returns a function to use in pseudos for :enabled/:disabled
  10188. * @param {Boolean} disabled true for :disabled; false for :enabled
  10189. */
  10190. function createDisabledPseudo( disabled ) {
  10191. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10192. return function( elem ) {
  10193. // Only certain elements can match :enabled or :disabled
  10194. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10195. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10196. if ( "form" in elem ) {
  10197. // Check for inherited disabledness on relevant non-disabled elements:
  10198. // * listed form-associated elements in a disabled fieldset
  10199. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10200. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10201. // * option elements in a disabled optgroup
  10202. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10203. // All such elements have a "form" property.
  10204. if ( elem.parentNode && elem.disabled === false ) {
  10205. // Option elements defer to a parent optgroup if present
  10206. if ( "label" in elem ) {
  10207. if ( "label" in elem.parentNode ) {
  10208. return elem.parentNode.disabled === disabled;
  10209. } else {
  10210. return elem.disabled === disabled;
  10211. }
  10212. }
  10213. // Support: IE 6 - 11
  10214. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10215. return elem.isDisabled === disabled ||
  10216. // Where there is no isDisabled, check manually
  10217. /* jshint -W018 */
  10218. elem.isDisabled !== !disabled &&
  10219. inDisabledFieldset( elem ) === disabled;
  10220. }
  10221. return elem.disabled === disabled;
  10222. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10223. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10224. // even exist on them, let alone have a boolean value.
  10225. } else if ( "label" in elem ) {
  10226. return elem.disabled === disabled;
  10227. }
  10228. // Remaining elements are neither :enabled nor :disabled
  10229. return false;
  10230. };
  10231. }
  10232. /**
  10233. * Returns a function to use in pseudos for positionals
  10234. * @param {Function} fn
  10235. */
  10236. function createPositionalPseudo( fn ) {
  10237. return markFunction(function( argument ) {
  10238. argument = +argument;
  10239. return markFunction(function( seed, matches ) {
  10240. var j,
  10241. matchIndexes = fn( [], seed.length, argument ),
  10242. i = matchIndexes.length;
  10243. // Match elements found at the specified indexes
  10244. while ( i-- ) {
  10245. if ( seed[ (j = matchIndexes[i]) ] ) {
  10246. seed[j] = !(matches[j] = seed[j]);
  10247. }
  10248. }
  10249. });
  10250. });
  10251. }
  10252. /**
  10253. * Checks a node for validity as a Sizzle context
  10254. * @param {Element|Object=} context
  10255. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10256. */
  10257. function testContext( context ) {
  10258. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10259. }
  10260. // Expose support vars for convenience
  10261. support = Sizzle.support = {};
  10262. /**
  10263. * Detects XML nodes
  10264. * @param {Element|Object} elem An element or a document
  10265. * @returns {Boolean} True iff elem is a non-HTML XML node
  10266. */
  10267. isXML = Sizzle.isXML = function( elem ) {
  10268. var namespace = elem.namespaceURI,
  10269. docElem = (elem.ownerDocument || elem).documentElement;
  10270. // Support: IE <=8
  10271. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10272. // https://bugs.jquery.com/ticket/4833
  10273. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10274. };
  10275. /**
  10276. * Sets document-related variables once based on the current document
  10277. * @param {Element|Object} [doc] An element or document object to use to set the document
  10278. * @returns {Object} Returns the current document
  10279. */
  10280. setDocument = Sizzle.setDocument = function( node ) {
  10281. var hasCompare, subWindow,
  10282. doc = node ? node.ownerDocument || node : preferredDoc;
  10283. // Return early if doc is invalid or already selected
  10284. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10285. return document;
  10286. }
  10287. // Update global variables
  10288. document = doc;
  10289. docElem = document.documentElement;
  10290. documentIsHTML = !isXML( document );
  10291. // Support: IE 9-11, Edge
  10292. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10293. if ( preferredDoc !== document &&
  10294. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10295. // Support: IE 11, Edge
  10296. if ( subWindow.addEventListener ) {
  10297. subWindow.addEventListener( "unload", unloadHandler, false );
  10298. // Support: IE 9 - 10 only
  10299. } else if ( subWindow.attachEvent ) {
  10300. subWindow.attachEvent( "onunload", unloadHandler );
  10301. }
  10302. }
  10303. /* Attributes
  10304. ---------------------------------------------------------------------- */
  10305. // Support: IE<8
  10306. // Verify that getAttribute really returns attributes and not properties
  10307. // (excepting IE8 booleans)
  10308. support.attributes = assert(function( el ) {
  10309. el.className = "i";
  10310. return !el.getAttribute("className");
  10311. });
  10312. /* getElement(s)By*
  10313. ---------------------------------------------------------------------- */
  10314. // Check if getElementsByTagName("*") returns only elements
  10315. support.getElementsByTagName = assert(function( el ) {
  10316. el.appendChild( document.createComment("") );
  10317. return !el.getElementsByTagName("*").length;
  10318. });
  10319. // Support: IE<9
  10320. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10321. // Support: IE<10
  10322. // Check if getElementById returns elements by name
  10323. // The broken getElementById methods don't pick up programmatically-set names,
  10324. // so use a roundabout getElementsByName test
  10325. support.getById = assert(function( el ) {
  10326. docElem.appendChild( el ).id = expando;
  10327. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10328. });
  10329. // ID filter and find
  10330. if ( support.getById ) {
  10331. Expr.filter["ID"] = function( id ) {
  10332. var attrId = id.replace( runescape, funescape );
  10333. return function( elem ) {
  10334. return elem.getAttribute("id") === attrId;
  10335. };
  10336. };
  10337. Expr.find["ID"] = function( id, context ) {
  10338. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10339. var elem = context.getElementById( id );
  10340. return elem ? [ elem ] : [];
  10341. }
  10342. };
  10343. } else {
  10344. Expr.filter["ID"] = function( id ) {
  10345. var attrId = id.replace( runescape, funescape );
  10346. return function( elem ) {
  10347. var node = typeof elem.getAttributeNode !== "undefined" &&
  10348. elem.getAttributeNode("id");
  10349. return node && node.value === attrId;
  10350. };
  10351. };
  10352. // Support: IE 6 - 7 only
  10353. // getElementById is not reliable as a find shortcut
  10354. Expr.find["ID"] = function( id, context ) {
  10355. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10356. var node, i, elems,
  10357. elem = context.getElementById( id );
  10358. if ( elem ) {
  10359. // Verify the id attribute
  10360. node = elem.getAttributeNode("id");
  10361. if ( node && node.value === id ) {
  10362. return [ elem ];
  10363. }
  10364. // Fall back on getElementsByName
  10365. elems = context.getElementsByName( id );
  10366. i = 0;
  10367. while ( (elem = elems[i++]) ) {
  10368. node = elem.getAttributeNode("id");
  10369. if ( node && node.value === id ) {
  10370. return [ elem ];
  10371. }
  10372. }
  10373. }
  10374. return [];
  10375. }
  10376. };
  10377. }
  10378. // Tag
  10379. Expr.find["TAG"] = support.getElementsByTagName ?
  10380. function( tag, context ) {
  10381. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10382. return context.getElementsByTagName( tag );
  10383. // DocumentFragment nodes don't have gEBTN
  10384. } else if ( support.qsa ) {
  10385. return context.querySelectorAll( tag );
  10386. }
  10387. } :
  10388. function( tag, context ) {
  10389. var elem,
  10390. tmp = [],
  10391. i = 0,
  10392. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10393. results = context.getElementsByTagName( tag );
  10394. // Filter out possible comments
  10395. if ( tag === "*" ) {
  10396. while ( (elem = results[i++]) ) {
  10397. if ( elem.nodeType === 1 ) {
  10398. tmp.push( elem );
  10399. }
  10400. }
  10401. return tmp;
  10402. }
  10403. return results;
  10404. };
  10405. // Class
  10406. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10407. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10408. return context.getElementsByClassName( className );
  10409. }
  10410. };
  10411. /* QSA/matchesSelector
  10412. ---------------------------------------------------------------------- */
  10413. // QSA and matchesSelector support
  10414. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10415. rbuggyMatches = [];
  10416. // qSa(:focus) reports false when true (Chrome 21)
  10417. // We allow this because of a bug in IE8/9 that throws an error
  10418. // whenever `document.activeElement` is accessed on an iframe
  10419. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10420. // See https://bugs.jquery.com/ticket/13378
  10421. rbuggyQSA = [];
  10422. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10423. // Build QSA regex
  10424. // Regex strategy adopted from Diego Perini
  10425. assert(function( el ) {
  10426. // Select is set to empty string on purpose
  10427. // This is to test IE's treatment of not explicitly
  10428. // setting a boolean content attribute,
  10429. // since its presence should be enough
  10430. // https://bugs.jquery.com/ticket/12359
  10431. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10432. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10433. "<option selected=''></option></select>";
  10434. // Support: IE8, Opera 11-12.16
  10435. // Nothing should be selected when empty strings follow ^= or $= or *=
  10436. // The test attribute must be unknown in Opera but "safe" for WinRT
  10437. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10438. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10439. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10440. }
  10441. // Support: IE8
  10442. // Boolean attributes and "value" are not treated correctly
  10443. if ( !el.querySelectorAll("[selected]").length ) {
  10444. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10445. }
  10446. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10447. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10448. rbuggyQSA.push("~=");
  10449. }
  10450. // Webkit/Opera - :checked should return selected option elements
  10451. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10452. // IE8 throws error here and will not see later tests
  10453. if ( !el.querySelectorAll(":checked").length ) {
  10454. rbuggyQSA.push(":checked");
  10455. }
  10456. // Support: Safari 8+, iOS 8+
  10457. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10458. // In-page `selector#id sibling-combinator selector` fails
  10459. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10460. rbuggyQSA.push(".#.+[+~]");
  10461. }
  10462. });
  10463. assert(function( el ) {
  10464. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10465. "<select disabled='disabled'><option/></select>";
  10466. // Support: Windows 8 Native Apps
  10467. // The type and name attributes are restricted during .innerHTML assignment
  10468. var input = document.createElement("input");
  10469. input.setAttribute( "type", "hidden" );
  10470. el.appendChild( input ).setAttribute( "name", "D" );
  10471. // Support: IE8
  10472. // Enforce case-sensitivity of name attribute
  10473. if ( el.querySelectorAll("[name=d]").length ) {
  10474. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10475. }
  10476. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10477. // IE8 throws error here and will not see later tests
  10478. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10479. rbuggyQSA.push( ":enabled", ":disabled" );
  10480. }
  10481. // Support: IE9-11+
  10482. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10483. docElem.appendChild( el ).disabled = true;
  10484. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10485. rbuggyQSA.push( ":enabled", ":disabled" );
  10486. }
  10487. // Opera 10-11 does not throw on post-comma invalid pseudos
  10488. el.querySelectorAll("*,:x");
  10489. rbuggyQSA.push(",.*:");
  10490. });
  10491. }
  10492. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10493. docElem.webkitMatchesSelector ||
  10494. docElem.mozMatchesSelector ||
  10495. docElem.oMatchesSelector ||
  10496. docElem.msMatchesSelector) )) ) {
  10497. assert(function( el ) {
  10498. // Check to see if it's possible to do matchesSelector
  10499. // on a disconnected node (IE 9)
  10500. support.disconnectedMatch = matches.call( el, "*" );
  10501. // This should fail with an exception
  10502. // Gecko does not error, returns false instead
  10503. matches.call( el, "[s!='']:x" );
  10504. rbuggyMatches.push( "!=", pseudos );
  10505. });
  10506. }
  10507. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10508. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10509. /* Contains
  10510. ---------------------------------------------------------------------- */
  10511. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10512. // Element contains another
  10513. // Purposefully self-exclusive
  10514. // As in, an element does not contain itself
  10515. contains = hasCompare || rnative.test( docElem.contains ) ?
  10516. function( a, b ) {
  10517. var adown = a.nodeType === 9 ? a.documentElement : a,
  10518. bup = b && b.parentNode;
  10519. return a === bup || !!( bup && bup.nodeType === 1 && (
  10520. adown.contains ?
  10521. adown.contains( bup ) :
  10522. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10523. ));
  10524. } :
  10525. function( a, b ) {
  10526. if ( b ) {
  10527. while ( (b = b.parentNode) ) {
  10528. if ( b === a ) {
  10529. return true;
  10530. }
  10531. }
  10532. }
  10533. return false;
  10534. };
  10535. /* Sorting
  10536. ---------------------------------------------------------------------- */
  10537. // Document order sorting
  10538. sortOrder = hasCompare ?
  10539. function( a, b ) {
  10540. // Flag for duplicate removal
  10541. if ( a === b ) {
  10542. hasDuplicate = true;
  10543. return 0;
  10544. }
  10545. // Sort on method existence if only one input has compareDocumentPosition
  10546. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10547. if ( compare ) {
  10548. return compare;
  10549. }
  10550. // Calculate position if both inputs belong to the same document
  10551. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10552. a.compareDocumentPosition( b ) :
  10553. // Otherwise we know they are disconnected
  10554. 1;
  10555. // Disconnected nodes
  10556. if ( compare & 1 ||
  10557. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10558. // Choose the first element that is related to our preferred document
  10559. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10560. return -1;
  10561. }
  10562. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10563. return 1;
  10564. }
  10565. // Maintain original order
  10566. return sortInput ?
  10567. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10568. 0;
  10569. }
  10570. return compare & 4 ? -1 : 1;
  10571. } :
  10572. function( a, b ) {
  10573. // Exit early if the nodes are identical
  10574. if ( a === b ) {
  10575. hasDuplicate = true;
  10576. return 0;
  10577. }
  10578. var cur,
  10579. i = 0,
  10580. aup = a.parentNode,
  10581. bup = b.parentNode,
  10582. ap = [ a ],
  10583. bp = [ b ];
  10584. // Parentless nodes are either documents or disconnected
  10585. if ( !aup || !bup ) {
  10586. return a === document ? -1 :
  10587. b === document ? 1 :
  10588. aup ? -1 :
  10589. bup ? 1 :
  10590. sortInput ?
  10591. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10592. 0;
  10593. // If the nodes are siblings, we can do a quick check
  10594. } else if ( aup === bup ) {
  10595. return siblingCheck( a, b );
  10596. }
  10597. // Otherwise we need full lists of their ancestors for comparison
  10598. cur = a;
  10599. while ( (cur = cur.parentNode) ) {
  10600. ap.unshift( cur );
  10601. }
  10602. cur = b;
  10603. while ( (cur = cur.parentNode) ) {
  10604. bp.unshift( cur );
  10605. }
  10606. // Walk down the tree looking for a discrepancy
  10607. while ( ap[i] === bp[i] ) {
  10608. i++;
  10609. }
  10610. return i ?
  10611. // Do a sibling check if the nodes have a common ancestor
  10612. siblingCheck( ap[i], bp[i] ) :
  10613. // Otherwise nodes in our document sort first
  10614. ap[i] === preferredDoc ? -1 :
  10615. bp[i] === preferredDoc ? 1 :
  10616. 0;
  10617. };
  10618. return document;
  10619. };
  10620. Sizzle.matches = function( expr, elements ) {
  10621. return Sizzle( expr, null, null, elements );
  10622. };
  10623. Sizzle.matchesSelector = function( elem, expr ) {
  10624. // Set document vars if needed
  10625. if ( ( elem.ownerDocument || elem ) !== document ) {
  10626. setDocument( elem );
  10627. }
  10628. if ( support.matchesSelector && documentIsHTML &&
  10629. !nonnativeSelectorCache[ expr + " " ] &&
  10630. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10631. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10632. try {
  10633. var ret = matches.call( elem, expr );
  10634. // IE 9's matchesSelector returns false on disconnected nodes
  10635. if ( ret || support.disconnectedMatch ||
  10636. // As well, disconnected nodes are said to be in a document
  10637. // fragment in IE 9
  10638. elem.document && elem.document.nodeType !== 11 ) {
  10639. return ret;
  10640. }
  10641. } catch (e) {
  10642. nonnativeSelectorCache( expr, true );
  10643. }
  10644. }
  10645. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10646. };
  10647. Sizzle.contains = function( context, elem ) {
  10648. // Set document vars if needed
  10649. if ( ( context.ownerDocument || context ) !== document ) {
  10650. setDocument( context );
  10651. }
  10652. return contains( context, elem );
  10653. };
  10654. Sizzle.attr = function( elem, name ) {
  10655. // Set document vars if needed
  10656. if ( ( elem.ownerDocument || elem ) !== document ) {
  10657. setDocument( elem );
  10658. }
  10659. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10660. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10661. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10662. fn( elem, name, !documentIsHTML ) :
  10663. undefined;
  10664. return val !== undefined ?
  10665. val :
  10666. support.attributes || !documentIsHTML ?
  10667. elem.getAttribute( name ) :
  10668. (val = elem.getAttributeNode(name)) && val.specified ?
  10669. val.value :
  10670. null;
  10671. };
  10672. Sizzle.escape = function( sel ) {
  10673. return (sel + "").replace( rcssescape, fcssescape );
  10674. };
  10675. Sizzle.error = function( msg ) {
  10676. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10677. };
  10678. /**
  10679. * Document sorting and removing duplicates
  10680. * @param {ArrayLike} results
  10681. */
  10682. Sizzle.uniqueSort = function( results ) {
  10683. var elem,
  10684. duplicates = [],
  10685. j = 0,
  10686. i = 0;
  10687. // Unless we *know* we can detect duplicates, assume their presence
  10688. hasDuplicate = !support.detectDuplicates;
  10689. sortInput = !support.sortStable && results.slice( 0 );
  10690. results.sort( sortOrder );
  10691. if ( hasDuplicate ) {
  10692. while ( (elem = results[i++]) ) {
  10693. if ( elem === results[ i ] ) {
  10694. j = duplicates.push( i );
  10695. }
  10696. }
  10697. while ( j-- ) {
  10698. results.splice( duplicates[ j ], 1 );
  10699. }
  10700. }
  10701. // Clear input after sorting to release objects
  10702. // See https://github.com/jquery/sizzle/pull/225
  10703. sortInput = null;
  10704. return results;
  10705. };
  10706. /**
  10707. * Utility function for retrieving the text value of an array of DOM nodes
  10708. * @param {Array|Element} elem
  10709. */
  10710. getText = Sizzle.getText = function( elem ) {
  10711. var node,
  10712. ret = "",
  10713. i = 0,
  10714. nodeType = elem.nodeType;
  10715. if ( !nodeType ) {
  10716. // If no nodeType, this is expected to be an array
  10717. while ( (node = elem[i++]) ) {
  10718. // Do not traverse comment nodes
  10719. ret += getText( node );
  10720. }
  10721. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10722. // Use textContent for elements
  10723. // innerText usage removed for consistency of new lines (jQuery #11153)
  10724. if ( typeof elem.textContent === "string" ) {
  10725. return elem.textContent;
  10726. } else {
  10727. // Traverse its children
  10728. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10729. ret += getText( elem );
  10730. }
  10731. }
  10732. } else if ( nodeType === 3 || nodeType === 4 ) {
  10733. return elem.nodeValue;
  10734. }
  10735. // Do not include comment or processing instruction nodes
  10736. return ret;
  10737. };
  10738. Expr = Sizzle.selectors = {
  10739. // Can be adjusted by the user
  10740. cacheLength: 50,
  10741. createPseudo: markFunction,
  10742. match: matchExpr,
  10743. attrHandle: {},
  10744. find: {},
  10745. relative: {
  10746. ">": { dir: "parentNode", first: true },
  10747. " ": { dir: "parentNode" },
  10748. "+": { dir: "previousSibling", first: true },
  10749. "~": { dir: "previousSibling" }
  10750. },
  10751. preFilter: {
  10752. "ATTR": function( match ) {
  10753. match[1] = match[1].replace( runescape, funescape );
  10754. // Move the given value to match[3] whether quoted or unquoted
  10755. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10756. if ( match[2] === "~=" ) {
  10757. match[3] = " " + match[3] + " ";
  10758. }
  10759. return match.slice( 0, 4 );
  10760. },
  10761. "CHILD": function( match ) {
  10762. /* matches from matchExpr["CHILD"]
  10763. 1 type (only|nth|...)
  10764. 2 what (child|of-type)
  10765. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10766. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10767. 5 sign of xn-component
  10768. 6 x of xn-component
  10769. 7 sign of y-component
  10770. 8 y of y-component
  10771. */
  10772. match[1] = match[1].toLowerCase();
  10773. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10774. // nth-* requires argument
  10775. if ( !match[3] ) {
  10776. Sizzle.error( match[0] );
  10777. }
  10778. // numeric x and y parameters for Expr.filter.CHILD
  10779. // remember that false/true cast respectively to 0/1
  10780. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10781. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10782. // other types prohibit arguments
  10783. } else if ( match[3] ) {
  10784. Sizzle.error( match[0] );
  10785. }
  10786. return match;
  10787. },
  10788. "PSEUDO": function( match ) {
  10789. var excess,
  10790. unquoted = !match[6] && match[2];
  10791. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10792. return null;
  10793. }
  10794. // Accept quoted arguments as-is
  10795. if ( match[3] ) {
  10796. match[2] = match[4] || match[5] || "";
  10797. // Strip excess characters from unquoted arguments
  10798. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10799. // Get excess from tokenize (recursively)
  10800. (excess = tokenize( unquoted, true )) &&
  10801. // advance to the next closing parenthesis
  10802. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10803. // excess is a negative index
  10804. match[0] = match[0].slice( 0, excess );
  10805. match[2] = unquoted.slice( 0, excess );
  10806. }
  10807. // Return only captures needed by the pseudo filter method (type and argument)
  10808. return match.slice( 0, 3 );
  10809. }
  10810. },
  10811. filter: {
  10812. "TAG": function( nodeNameSelector ) {
  10813. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10814. return nodeNameSelector === "*" ?
  10815. function() { return true; } :
  10816. function( elem ) {
  10817. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10818. };
  10819. },
  10820. "CLASS": function( className ) {
  10821. var pattern = classCache[ className + " " ];
  10822. return pattern ||
  10823. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10824. classCache( className, function( elem ) {
  10825. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10826. });
  10827. },
  10828. "ATTR": function( name, operator, check ) {
  10829. return function( elem ) {
  10830. var result = Sizzle.attr( elem, name );
  10831. if ( result == null ) {
  10832. return operator === "!=";
  10833. }
  10834. if ( !operator ) {
  10835. return true;
  10836. }
  10837. result += "";
  10838. return operator === "=" ? result === check :
  10839. operator === "!=" ? result !== check :
  10840. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10841. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10842. operator === "$=" ? check && result.slice( -check.length ) === check :
  10843. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10844. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10845. false;
  10846. };
  10847. },
  10848. "CHILD": function( type, what, argument, first, last ) {
  10849. var simple = type.slice( 0, 3 ) !== "nth",
  10850. forward = type.slice( -4 ) !== "last",
  10851. ofType = what === "of-type";
  10852. return first === 1 && last === 0 ?
  10853. // Shortcut for :nth-*(n)
  10854. function( elem ) {
  10855. return !!elem.parentNode;
  10856. } :
  10857. function( elem, context, xml ) {
  10858. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10859. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10860. parent = elem.parentNode,
  10861. name = ofType && elem.nodeName.toLowerCase(),
  10862. useCache = !xml && !ofType,
  10863. diff = false;
  10864. if ( parent ) {
  10865. // :(first|last|only)-(child|of-type)
  10866. if ( simple ) {
  10867. while ( dir ) {
  10868. node = elem;
  10869. while ( (node = node[ dir ]) ) {
  10870. if ( ofType ?
  10871. node.nodeName.toLowerCase() === name :
  10872. node.nodeType === 1 ) {
  10873. return false;
  10874. }
  10875. }
  10876. // Reverse direction for :only-* (if we haven't yet done so)
  10877. start = dir = type === "only" && !start && "nextSibling";
  10878. }
  10879. return true;
  10880. }
  10881. start = [ forward ? parent.firstChild : parent.lastChild ];
  10882. // non-xml :nth-child(...) stores cache data on `parent`
  10883. if ( forward && useCache ) {
  10884. // Seek `elem` from a previously-cached index
  10885. // ...in a gzip-friendly way
  10886. node = parent;
  10887. outerCache = node[ expando ] || (node[ expando ] = {});
  10888. // Support: IE <9 only
  10889. // Defend against cloned attroperties (jQuery gh-1709)
  10890. uniqueCache = outerCache[ node.uniqueID ] ||
  10891. (outerCache[ node.uniqueID ] = {});
  10892. cache = uniqueCache[ type ] || [];
  10893. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10894. diff = nodeIndex && cache[ 2 ];
  10895. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10896. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10897. // Fallback to seeking `elem` from the start
  10898. (diff = nodeIndex = 0) || start.pop()) ) {
  10899. // When found, cache indexes on `parent` and break
  10900. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10901. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10902. break;
  10903. }
  10904. }
  10905. } else {
  10906. // Use previously-cached element index if available
  10907. if ( useCache ) {
  10908. // ...in a gzip-friendly way
  10909. node = elem;
  10910. outerCache = node[ expando ] || (node[ expando ] = {});
  10911. // Support: IE <9 only
  10912. // Defend against cloned attroperties (jQuery gh-1709)
  10913. uniqueCache = outerCache[ node.uniqueID ] ||
  10914. (outerCache[ node.uniqueID ] = {});
  10915. cache = uniqueCache[ type ] || [];
  10916. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10917. diff = nodeIndex;
  10918. }
  10919. // xml :nth-child(...)
  10920. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10921. if ( diff === false ) {
  10922. // Use the same loop as above to seek `elem` from the start
  10923. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10924. (diff = nodeIndex = 0) || start.pop()) ) {
  10925. if ( ( ofType ?
  10926. node.nodeName.toLowerCase() === name :
  10927. node.nodeType === 1 ) &&
  10928. ++diff ) {
  10929. // Cache the index of each encountered element
  10930. if ( useCache ) {
  10931. outerCache = node[ expando ] || (node[ expando ] = {});
  10932. // Support: IE <9 only
  10933. // Defend against cloned attroperties (jQuery gh-1709)
  10934. uniqueCache = outerCache[ node.uniqueID ] ||
  10935. (outerCache[ node.uniqueID ] = {});
  10936. uniqueCache[ type ] = [ dirruns, diff ];
  10937. }
  10938. if ( node === elem ) {
  10939. break;
  10940. }
  10941. }
  10942. }
  10943. }
  10944. }
  10945. // Incorporate the offset, then check against cycle size
  10946. diff -= last;
  10947. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10948. }
  10949. };
  10950. },
  10951. "PSEUDO": function( pseudo, argument ) {
  10952. // pseudo-class names are case-insensitive
  10953. // http://www.w3.org/TR/selectors/#pseudo-classes
  10954. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10955. // Remember that setFilters inherits from pseudos
  10956. var args,
  10957. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10958. Sizzle.error( "unsupported pseudo: " + pseudo );
  10959. // The user may use createPseudo to indicate that
  10960. // arguments are needed to create the filter function
  10961. // just as Sizzle does
  10962. if ( fn[ expando ] ) {
  10963. return fn( argument );
  10964. }
  10965. // But maintain support for old signatures
  10966. if ( fn.length > 1 ) {
  10967. args = [ pseudo, pseudo, "", argument ];
  10968. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10969. markFunction(function( seed, matches ) {
  10970. var idx,
  10971. matched = fn( seed, argument ),
  10972. i = matched.length;
  10973. while ( i-- ) {
  10974. idx = indexOf( seed, matched[i] );
  10975. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10976. }
  10977. }) :
  10978. function( elem ) {
  10979. return fn( elem, 0, args );
  10980. };
  10981. }
  10982. return fn;
  10983. }
  10984. },
  10985. pseudos: {
  10986. // Potentially complex pseudos
  10987. "not": markFunction(function( selector ) {
  10988. // Trim the selector passed to compile
  10989. // to avoid treating leading and trailing
  10990. // spaces as combinators
  10991. var input = [],
  10992. results = [],
  10993. matcher = compile( selector.replace( rtrim, "$1" ) );
  10994. return matcher[ expando ] ?
  10995. markFunction(function( seed, matches, context, xml ) {
  10996. var elem,
  10997. unmatched = matcher( seed, null, xml, [] ),
  10998. i = seed.length;
  10999. // Match elements unmatched by `matcher`
  11000. while ( i-- ) {
  11001. if ( (elem = unmatched[i]) ) {
  11002. seed[i] = !(matches[i] = elem);
  11003. }
  11004. }
  11005. }) :
  11006. function( elem, context, xml ) {
  11007. input[0] = elem;
  11008. matcher( input, null, xml, results );
  11009. // Don't keep the element (issue #299)
  11010. input[0] = null;
  11011. return !results.pop();
  11012. };
  11013. }),
  11014. "has": markFunction(function( selector ) {
  11015. return function( elem ) {
  11016. return Sizzle( selector, elem ).length > 0;
  11017. };
  11018. }),
  11019. "contains": markFunction(function( text ) {
  11020. text = text.replace( runescape, funescape );
  11021. return function( elem ) {
  11022. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11023. };
  11024. }),
  11025. // "Whether an element is represented by a :lang() selector
  11026. // is based solely on the element's language value
  11027. // being equal to the identifier C,
  11028. // or beginning with the identifier C immediately followed by "-".
  11029. // The matching of C against the element's language value is performed case-insensitively.
  11030. // The identifier C does not have to be a valid language name."
  11031. // http://www.w3.org/TR/selectors/#lang-pseudo
  11032. "lang": markFunction( function( lang ) {
  11033. // lang value must be a valid identifier
  11034. if ( !ridentifier.test(lang || "") ) {
  11035. Sizzle.error( "unsupported lang: " + lang );
  11036. }
  11037. lang = lang.replace( runescape, funescape ).toLowerCase();
  11038. return function( elem ) {
  11039. var elemLang;
  11040. do {
  11041. if ( (elemLang = documentIsHTML ?
  11042. elem.lang :
  11043. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11044. elemLang = elemLang.toLowerCase();
  11045. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11046. }
  11047. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11048. return false;
  11049. };
  11050. }),
  11051. // Miscellaneous
  11052. "target": function( elem ) {
  11053. var hash = window.location && window.location.hash;
  11054. return hash && hash.slice( 1 ) === elem.id;
  11055. },
  11056. "root": function( elem ) {
  11057. return elem === docElem;
  11058. },
  11059. "focus": function( elem ) {
  11060. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11061. },
  11062. // Boolean properties
  11063. "enabled": createDisabledPseudo( false ),
  11064. "disabled": createDisabledPseudo( true ),
  11065. "checked": function( elem ) {
  11066. // In CSS3, :checked should return both checked and selected elements
  11067. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11068. var nodeName = elem.nodeName.toLowerCase();
  11069. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11070. },
  11071. "selected": function( elem ) {
  11072. // Accessing this property makes selected-by-default
  11073. // options in Safari work properly
  11074. if ( elem.parentNode ) {
  11075. elem.parentNode.selectedIndex;
  11076. }
  11077. return elem.selected === true;
  11078. },
  11079. // Contents
  11080. "empty": function( elem ) {
  11081. // http://www.w3.org/TR/selectors/#empty-pseudo
  11082. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11083. // but not by others (comment: 8; processing instruction: 7; etc.)
  11084. // nodeType < 6 works because attributes (2) do not appear as children
  11085. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11086. if ( elem.nodeType < 6 ) {
  11087. return false;
  11088. }
  11089. }
  11090. return true;
  11091. },
  11092. "parent": function( elem ) {
  11093. return !Expr.pseudos["empty"]( elem );
  11094. },
  11095. // Element/input types
  11096. "header": function( elem ) {
  11097. return rheader.test( elem.nodeName );
  11098. },
  11099. "input": function( elem ) {
  11100. return rinputs.test( elem.nodeName );
  11101. },
  11102. "button": function( elem ) {
  11103. var name = elem.nodeName.toLowerCase();
  11104. return name === "input" && elem.type === "button" || name === "button";
  11105. },
  11106. "text": function( elem ) {
  11107. var attr;
  11108. return elem.nodeName.toLowerCase() === "input" &&
  11109. elem.type === "text" &&
  11110. // Support: IE<8
  11111. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11112. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11113. },
  11114. // Position-in-collection
  11115. "first": createPositionalPseudo(function() {
  11116. return [ 0 ];
  11117. }),
  11118. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11119. return [ length - 1 ];
  11120. }),
  11121. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11122. return [ argument < 0 ? argument + length : argument ];
  11123. }),
  11124. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11125. var i = 0;
  11126. for ( ; i < length; i += 2 ) {
  11127. matchIndexes.push( i );
  11128. }
  11129. return matchIndexes;
  11130. }),
  11131. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11132. var i = 1;
  11133. for ( ; i < length; i += 2 ) {
  11134. matchIndexes.push( i );
  11135. }
  11136. return matchIndexes;
  11137. }),
  11138. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11139. var i = argument < 0 ?
  11140. argument + length :
  11141. argument > length ?
  11142. length :
  11143. argument;
  11144. for ( ; --i >= 0; ) {
  11145. matchIndexes.push( i );
  11146. }
  11147. return matchIndexes;
  11148. }),
  11149. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11150. var i = argument < 0 ? argument + length : argument;
  11151. for ( ; ++i < length; ) {
  11152. matchIndexes.push( i );
  11153. }
  11154. return matchIndexes;
  11155. })
  11156. }
  11157. };
  11158. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11159. // Add button/input type pseudos
  11160. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11161. Expr.pseudos[ i ] = createInputPseudo( i );
  11162. }
  11163. for ( i in { submit: true, reset: true } ) {
  11164. Expr.pseudos[ i ] = createButtonPseudo( i );
  11165. }
  11166. // Easy API for creating new setFilters
  11167. function setFilters() {}
  11168. setFilters.prototype = Expr.filters = Expr.pseudos;
  11169. Expr.setFilters = new setFilters();
  11170. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11171. var matched, match, tokens, type,
  11172. soFar, groups, preFilters,
  11173. cached = tokenCache[ selector + " " ];
  11174. if ( cached ) {
  11175. return parseOnly ? 0 : cached.slice( 0 );
  11176. }
  11177. soFar = selector;
  11178. groups = [];
  11179. preFilters = Expr.preFilter;
  11180. while ( soFar ) {
  11181. // Comma and first run
  11182. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11183. if ( match ) {
  11184. // Don't consume trailing commas as valid
  11185. soFar = soFar.slice( match[0].length ) || soFar;
  11186. }
  11187. groups.push( (tokens = []) );
  11188. }
  11189. matched = false;
  11190. // Combinators
  11191. if ( (match = rcombinators.exec( soFar )) ) {
  11192. matched = match.shift();
  11193. tokens.push({
  11194. value: matched,
  11195. // Cast descendant combinators to space
  11196. type: match[0].replace( rtrim, " " )
  11197. });
  11198. soFar = soFar.slice( matched.length );
  11199. }
  11200. // Filters
  11201. for ( type in Expr.filter ) {
  11202. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11203. (match = preFilters[ type ]( match ))) ) {
  11204. matched = match.shift();
  11205. tokens.push({
  11206. value: matched,
  11207. type: type,
  11208. matches: match
  11209. });
  11210. soFar = soFar.slice( matched.length );
  11211. }
  11212. }
  11213. if ( !matched ) {
  11214. break;
  11215. }
  11216. }
  11217. // Return the length of the invalid excess
  11218. // if we're just parsing
  11219. // Otherwise, throw an error or return tokens
  11220. return parseOnly ?
  11221. soFar.length :
  11222. soFar ?
  11223. Sizzle.error( selector ) :
  11224. // Cache the tokens
  11225. tokenCache( selector, groups ).slice( 0 );
  11226. };
  11227. function toSelector( tokens ) {
  11228. var i = 0,
  11229. len = tokens.length,
  11230. selector = "";
  11231. for ( ; i < len; i++ ) {
  11232. selector += tokens[i].value;
  11233. }
  11234. return selector;
  11235. }
  11236. function addCombinator( matcher, combinator, base ) {
  11237. var dir = combinator.dir,
  11238. skip = combinator.next,
  11239. key = skip || dir,
  11240. checkNonElements = base && key === "parentNode",
  11241. doneName = done++;
  11242. return combinator.first ?
  11243. // Check against closest ancestor/preceding element
  11244. function( elem, context, xml ) {
  11245. while ( (elem = elem[ dir ]) ) {
  11246. if ( elem.nodeType === 1 || checkNonElements ) {
  11247. return matcher( elem, context, xml );
  11248. }
  11249. }
  11250. return false;
  11251. } :
  11252. // Check against all ancestor/preceding elements
  11253. function( elem, context, xml ) {
  11254. var oldCache, uniqueCache, outerCache,
  11255. newCache = [ dirruns, doneName ];
  11256. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11257. if ( xml ) {
  11258. while ( (elem = elem[ dir ]) ) {
  11259. if ( elem.nodeType === 1 || checkNonElements ) {
  11260. if ( matcher( elem, context, xml ) ) {
  11261. return true;
  11262. }
  11263. }
  11264. }
  11265. } else {
  11266. while ( (elem = elem[ dir ]) ) {
  11267. if ( elem.nodeType === 1 || checkNonElements ) {
  11268. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11269. // Support: IE <9 only
  11270. // Defend against cloned attroperties (jQuery gh-1709)
  11271. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11272. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11273. elem = elem[ dir ] || elem;
  11274. } else if ( (oldCache = uniqueCache[ key ]) &&
  11275. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11276. // Assign to newCache so results back-propagate to previous elements
  11277. return (newCache[ 2 ] = oldCache[ 2 ]);
  11278. } else {
  11279. // Reuse newcache so results back-propagate to previous elements
  11280. uniqueCache[ key ] = newCache;
  11281. // A match means we're done; a fail means we have to keep checking
  11282. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11283. return true;
  11284. }
  11285. }
  11286. }
  11287. }
  11288. }
  11289. return false;
  11290. };
  11291. }
  11292. function elementMatcher( matchers ) {
  11293. return matchers.length > 1 ?
  11294. function( elem, context, xml ) {
  11295. var i = matchers.length;
  11296. while ( i-- ) {
  11297. if ( !matchers[i]( elem, context, xml ) ) {
  11298. return false;
  11299. }
  11300. }
  11301. return true;
  11302. } :
  11303. matchers[0];
  11304. }
  11305. function multipleContexts( selector, contexts, results ) {
  11306. var i = 0,
  11307. len = contexts.length;
  11308. for ( ; i < len; i++ ) {
  11309. Sizzle( selector, contexts[i], results );
  11310. }
  11311. return results;
  11312. }
  11313. function condense( unmatched, map, filter, context, xml ) {
  11314. var elem,
  11315. newUnmatched = [],
  11316. i = 0,
  11317. len = unmatched.length,
  11318. mapped = map != null;
  11319. for ( ; i < len; i++ ) {
  11320. if ( (elem = unmatched[i]) ) {
  11321. if ( !filter || filter( elem, context, xml ) ) {
  11322. newUnmatched.push( elem );
  11323. if ( mapped ) {
  11324. map.push( i );
  11325. }
  11326. }
  11327. }
  11328. }
  11329. return newUnmatched;
  11330. }
  11331. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11332. if ( postFilter && !postFilter[ expando ] ) {
  11333. postFilter = setMatcher( postFilter );
  11334. }
  11335. if ( postFinder && !postFinder[ expando ] ) {
  11336. postFinder = setMatcher( postFinder, postSelector );
  11337. }
  11338. return markFunction(function( seed, results, context, xml ) {
  11339. var temp, i, elem,
  11340. preMap = [],
  11341. postMap = [],
  11342. preexisting = results.length,
  11343. // Get initial elements from seed or context
  11344. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11345. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11346. matcherIn = preFilter && ( seed || !selector ) ?
  11347. condense( elems, preMap, preFilter, context, xml ) :
  11348. elems,
  11349. matcherOut = matcher ?
  11350. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11351. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11352. // ...intermediate processing is necessary
  11353. [] :
  11354. // ...otherwise use results directly
  11355. results :
  11356. matcherIn;
  11357. // Find primary matches
  11358. if ( matcher ) {
  11359. matcher( matcherIn, matcherOut, context, xml );
  11360. }
  11361. // Apply postFilter
  11362. if ( postFilter ) {
  11363. temp = condense( matcherOut, postMap );
  11364. postFilter( temp, [], context, xml );
  11365. // Un-match failing elements by moving them back to matcherIn
  11366. i = temp.length;
  11367. while ( i-- ) {
  11368. if ( (elem = temp[i]) ) {
  11369. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11370. }
  11371. }
  11372. }
  11373. if ( seed ) {
  11374. if ( postFinder || preFilter ) {
  11375. if ( postFinder ) {
  11376. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11377. temp = [];
  11378. i = matcherOut.length;
  11379. while ( i-- ) {
  11380. if ( (elem = matcherOut[i]) ) {
  11381. // Restore matcherIn since elem is not yet a final match
  11382. temp.push( (matcherIn[i] = elem) );
  11383. }
  11384. }
  11385. postFinder( null, (matcherOut = []), temp, xml );
  11386. }
  11387. // Move matched elements from seed to results to keep them synchronized
  11388. i = matcherOut.length;
  11389. while ( i-- ) {
  11390. if ( (elem = matcherOut[i]) &&
  11391. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11392. seed[temp] = !(results[temp] = elem);
  11393. }
  11394. }
  11395. }
  11396. // Add elements to results, through postFinder if defined
  11397. } else {
  11398. matcherOut = condense(
  11399. matcherOut === results ?
  11400. matcherOut.splice( preexisting, matcherOut.length ) :
  11401. matcherOut
  11402. );
  11403. if ( postFinder ) {
  11404. postFinder( null, results, matcherOut, xml );
  11405. } else {
  11406. push.apply( results, matcherOut );
  11407. }
  11408. }
  11409. });
  11410. }
  11411. function matcherFromTokens( tokens ) {
  11412. var checkContext, matcher, j,
  11413. len = tokens.length,
  11414. leadingRelative = Expr.relative[ tokens[0].type ],
  11415. implicitRelative = leadingRelative || Expr.relative[" "],
  11416. i = leadingRelative ? 1 : 0,
  11417. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11418. matchContext = addCombinator( function( elem ) {
  11419. return elem === checkContext;
  11420. }, implicitRelative, true ),
  11421. matchAnyContext = addCombinator( function( elem ) {
  11422. return indexOf( checkContext, elem ) > -1;
  11423. }, implicitRelative, true ),
  11424. matchers = [ function( elem, context, xml ) {
  11425. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11426. (checkContext = context).nodeType ?
  11427. matchContext( elem, context, xml ) :
  11428. matchAnyContext( elem, context, xml ) );
  11429. // Avoid hanging onto element (issue #299)
  11430. checkContext = null;
  11431. return ret;
  11432. } ];
  11433. for ( ; i < len; i++ ) {
  11434. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11435. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11436. } else {
  11437. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11438. // Return special upon seeing a positional matcher
  11439. if ( matcher[ expando ] ) {
  11440. // Find the next relative operator (if any) for proper handling
  11441. j = ++i;
  11442. for ( ; j < len; j++ ) {
  11443. if ( Expr.relative[ tokens[j].type ] ) {
  11444. break;
  11445. }
  11446. }
  11447. return setMatcher(
  11448. i > 1 && elementMatcher( matchers ),
  11449. i > 1 && toSelector(
  11450. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11451. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11452. ).replace( rtrim, "$1" ),
  11453. matcher,
  11454. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11455. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11456. j < len && toSelector( tokens )
  11457. );
  11458. }
  11459. matchers.push( matcher );
  11460. }
  11461. }
  11462. return elementMatcher( matchers );
  11463. }
  11464. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11465. var bySet = setMatchers.length > 0,
  11466. byElement = elementMatchers.length > 0,
  11467. superMatcher = function( seed, context, xml, results, outermost ) {
  11468. var elem, j, matcher,
  11469. matchedCount = 0,
  11470. i = "0",
  11471. unmatched = seed && [],
  11472. setMatched = [],
  11473. contextBackup = outermostContext,
  11474. // We must always have either seed elements or outermost context
  11475. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11476. // Use integer dirruns iff this is the outermost matcher
  11477. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11478. len = elems.length;
  11479. if ( outermost ) {
  11480. outermostContext = context === document || context || outermost;
  11481. }
  11482. // Add elements passing elementMatchers directly to results
  11483. // Support: IE<9, Safari
  11484. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11485. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11486. if ( byElement && elem ) {
  11487. j = 0;
  11488. if ( !context && elem.ownerDocument !== document ) {
  11489. setDocument( elem );
  11490. xml = !documentIsHTML;
  11491. }
  11492. while ( (matcher = elementMatchers[j++]) ) {
  11493. if ( matcher( elem, context || document, xml) ) {
  11494. results.push( elem );
  11495. break;
  11496. }
  11497. }
  11498. if ( outermost ) {
  11499. dirruns = dirrunsUnique;
  11500. }
  11501. }
  11502. // Track unmatched elements for set filters
  11503. if ( bySet ) {
  11504. // They will have gone through all possible matchers
  11505. if ( (elem = !matcher && elem) ) {
  11506. matchedCount--;
  11507. }
  11508. // Lengthen the array for every element, matched or not
  11509. if ( seed ) {
  11510. unmatched.push( elem );
  11511. }
  11512. }
  11513. }
  11514. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11515. // makes the latter nonnegative.
  11516. matchedCount += i;
  11517. // Apply set filters to unmatched elements
  11518. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11519. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11520. // no element matchers and no seed.
  11521. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11522. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11523. // numerically zero.
  11524. if ( bySet && i !== matchedCount ) {
  11525. j = 0;
  11526. while ( (matcher = setMatchers[j++]) ) {
  11527. matcher( unmatched, setMatched, context, xml );
  11528. }
  11529. if ( seed ) {
  11530. // Reintegrate element matches to eliminate the need for sorting
  11531. if ( matchedCount > 0 ) {
  11532. while ( i-- ) {
  11533. if ( !(unmatched[i] || setMatched[i]) ) {
  11534. setMatched[i] = pop.call( results );
  11535. }
  11536. }
  11537. }
  11538. // Discard index placeholder values to get only actual matches
  11539. setMatched = condense( setMatched );
  11540. }
  11541. // Add matches to results
  11542. push.apply( results, setMatched );
  11543. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11544. if ( outermost && !seed && setMatched.length > 0 &&
  11545. ( matchedCount + setMatchers.length ) > 1 ) {
  11546. Sizzle.uniqueSort( results );
  11547. }
  11548. }
  11549. // Override manipulation of globals by nested matchers
  11550. if ( outermost ) {
  11551. dirruns = dirrunsUnique;
  11552. outermostContext = contextBackup;
  11553. }
  11554. return unmatched;
  11555. };
  11556. return bySet ?
  11557. markFunction( superMatcher ) :
  11558. superMatcher;
  11559. }
  11560. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11561. var i,
  11562. setMatchers = [],
  11563. elementMatchers = [],
  11564. cached = compilerCache[ selector + " " ];
  11565. if ( !cached ) {
  11566. // Generate a function of recursive functions that can be used to check each element
  11567. if ( !match ) {
  11568. match = tokenize( selector );
  11569. }
  11570. i = match.length;
  11571. while ( i-- ) {
  11572. cached = matcherFromTokens( match[i] );
  11573. if ( cached[ expando ] ) {
  11574. setMatchers.push( cached );
  11575. } else {
  11576. elementMatchers.push( cached );
  11577. }
  11578. }
  11579. // Cache the compiled function
  11580. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11581. // Save selector and tokenization
  11582. cached.selector = selector;
  11583. }
  11584. return cached;
  11585. };
  11586. /**
  11587. * A low-level selection function that works with Sizzle's compiled
  11588. * selector functions
  11589. * @param {String|Function} selector A selector or a pre-compiled
  11590. * selector function built with Sizzle.compile
  11591. * @param {Element} context
  11592. * @param {Array} [results]
  11593. * @param {Array} [seed] A set of elements to match against
  11594. */
  11595. select = Sizzle.select = function( selector, context, results, seed ) {
  11596. var i, tokens, token, type, find,
  11597. compiled = typeof selector === "function" && selector,
  11598. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11599. results = results || [];
  11600. // Try to minimize operations if there is only one selector in the list and no seed
  11601. // (the latter of which guarantees us context)
  11602. if ( match.length === 1 ) {
  11603. // Reduce context if the leading compound selector is an ID
  11604. tokens = match[0] = match[0].slice( 0 );
  11605. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11606. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11607. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11608. if ( !context ) {
  11609. return results;
  11610. // Precompiled matchers will still verify ancestry, so step up a level
  11611. } else if ( compiled ) {
  11612. context = context.parentNode;
  11613. }
  11614. selector = selector.slice( tokens.shift().value.length );
  11615. }
  11616. // Fetch a seed set for right-to-left matching
  11617. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11618. while ( i-- ) {
  11619. token = tokens[i];
  11620. // Abort if we hit a combinator
  11621. if ( Expr.relative[ (type = token.type) ] ) {
  11622. break;
  11623. }
  11624. if ( (find = Expr.find[ type ]) ) {
  11625. // Search, expanding context for leading sibling combinators
  11626. if ( (seed = find(
  11627. token.matches[0].replace( runescape, funescape ),
  11628. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11629. )) ) {
  11630. // If seed is empty or no tokens remain, we can return early
  11631. tokens.splice( i, 1 );
  11632. selector = seed.length && toSelector( tokens );
  11633. if ( !selector ) {
  11634. push.apply( results, seed );
  11635. return results;
  11636. }
  11637. break;
  11638. }
  11639. }
  11640. }
  11641. }
  11642. // Compile and execute a filtering function if one is not provided
  11643. // Provide `match` to avoid retokenization if we modified the selector above
  11644. ( compiled || compile( selector, match ) )(
  11645. seed,
  11646. context,
  11647. !documentIsHTML,
  11648. results,
  11649. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11650. );
  11651. return results;
  11652. };
  11653. // One-time assignments
  11654. // Sort stability
  11655. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11656. // Support: Chrome 14-35+
  11657. // Always assume duplicates if they aren't passed to the comparison function
  11658. support.detectDuplicates = !!hasDuplicate;
  11659. // Initialize against the default document
  11660. setDocument();
  11661. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11662. // Detached nodes confoundingly follow *each other*
  11663. support.sortDetached = assert(function( el ) {
  11664. // Should return 1, but returns 4 (following)
  11665. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11666. });
  11667. // Support: IE<8
  11668. // Prevent attribute/property "interpolation"
  11669. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11670. if ( !assert(function( el ) {
  11671. el.innerHTML = "<a href='#'></a>";
  11672. return el.firstChild.getAttribute("href") === "#" ;
  11673. }) ) {
  11674. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11675. if ( !isXML ) {
  11676. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11677. }
  11678. });
  11679. }
  11680. // Support: IE<9
  11681. // Use defaultValue in place of getAttribute("value")
  11682. if ( !support.attributes || !assert(function( el ) {
  11683. el.innerHTML = "<input/>";
  11684. el.firstChild.setAttribute( "value", "" );
  11685. return el.firstChild.getAttribute( "value" ) === "";
  11686. }) ) {
  11687. addHandle( "value", function( elem, name, isXML ) {
  11688. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11689. return elem.defaultValue;
  11690. }
  11691. });
  11692. }
  11693. // Support: IE<9
  11694. // Use getAttributeNode to fetch booleans when getAttribute lies
  11695. if ( !assert(function( el ) {
  11696. return el.getAttribute("disabled") == null;
  11697. }) ) {
  11698. addHandle( booleans, function( elem, name, isXML ) {
  11699. var val;
  11700. if ( !isXML ) {
  11701. return elem[ name ] === true ? name.toLowerCase() :
  11702. (val = elem.getAttributeNode( name )) && val.specified ?
  11703. val.value :
  11704. null;
  11705. }
  11706. });
  11707. }
  11708. return Sizzle;
  11709. })( window );
  11710. jQuery.find = Sizzle;
  11711. jQuery.expr = Sizzle.selectors;
  11712. // Deprecated
  11713. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11714. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11715. jQuery.text = Sizzle.getText;
  11716. jQuery.isXMLDoc = Sizzle.isXML;
  11717. jQuery.contains = Sizzle.contains;
  11718. jQuery.escapeSelector = Sizzle.escape;
  11719. var dir = function( elem, dir, until ) {
  11720. var matched = [],
  11721. truncate = until !== undefined;
  11722. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11723. if ( elem.nodeType === 1 ) {
  11724. if ( truncate && jQuery( elem ).is( until ) ) {
  11725. break;
  11726. }
  11727. matched.push( elem );
  11728. }
  11729. }
  11730. return matched;
  11731. };
  11732. var siblings = function( n, elem ) {
  11733. var matched = [];
  11734. for ( ; n; n = n.nextSibling ) {
  11735. if ( n.nodeType === 1 && n !== elem ) {
  11736. matched.push( n );
  11737. }
  11738. }
  11739. return matched;
  11740. };
  11741. var rneedsContext = jQuery.expr.match.needsContext;
  11742. function nodeName( elem, name ) {
  11743. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11744. };
  11745. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11746. // Implement the identical functionality for filter and not
  11747. function winnow( elements, qualifier, not ) {
  11748. if ( isFunction( qualifier ) ) {
  11749. return jQuery.grep( elements, function( elem, i ) {
  11750. return !!qualifier.call( elem, i, elem ) !== not;
  11751. } );
  11752. }
  11753. // Single element
  11754. if ( qualifier.nodeType ) {
  11755. return jQuery.grep( elements, function( elem ) {
  11756. return ( elem === qualifier ) !== not;
  11757. } );
  11758. }
  11759. // Arraylike of elements (jQuery, arguments, Array)
  11760. if ( typeof qualifier !== "string" ) {
  11761. return jQuery.grep( elements, function( elem ) {
  11762. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11763. } );
  11764. }
  11765. // Filtered directly for both simple and complex selectors
  11766. return jQuery.filter( qualifier, elements, not );
  11767. }
  11768. jQuery.filter = function( expr, elems, not ) {
  11769. var elem = elems[ 0 ];
  11770. if ( not ) {
  11771. expr = ":not(" + expr + ")";
  11772. }
  11773. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11774. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11775. }
  11776. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11777. return elem.nodeType === 1;
  11778. } ) );
  11779. };
  11780. jQuery.fn.extend( {
  11781. find: function( selector ) {
  11782. var i, ret,
  11783. len = this.length,
  11784. self = this;
  11785. if ( typeof selector !== "string" ) {
  11786. return this.pushStack( jQuery( selector ).filter( function() {
  11787. for ( i = 0; i < len; i++ ) {
  11788. if ( jQuery.contains( self[ i ], this ) ) {
  11789. return true;
  11790. }
  11791. }
  11792. } ) );
  11793. }
  11794. ret = this.pushStack( [] );
  11795. for ( i = 0; i < len; i++ ) {
  11796. jQuery.find( selector, self[ i ], ret );
  11797. }
  11798. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11799. },
  11800. filter: function( selector ) {
  11801. return this.pushStack( winnow( this, selector || [], false ) );
  11802. },
  11803. not: function( selector ) {
  11804. return this.pushStack( winnow( this, selector || [], true ) );
  11805. },
  11806. is: function( selector ) {
  11807. return !!winnow(
  11808. this,
  11809. // If this is a positional/relative selector, check membership in the returned set
  11810. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11811. typeof selector === "string" && rneedsContext.test( selector ) ?
  11812. jQuery( selector ) :
  11813. selector || [],
  11814. false
  11815. ).length;
  11816. }
  11817. } );
  11818. // Initialize a jQuery object
  11819. // A central reference to the root jQuery(document)
  11820. var rootjQuery,
  11821. // A simple way to check for HTML strings
  11822. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11823. // Strict HTML recognition (#11290: must start with <)
  11824. // Shortcut simple #id case for speed
  11825. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11826. init = jQuery.fn.init = function( selector, context, root ) {
  11827. var match, elem;
  11828. // HANDLE: $(""), $(null), $(undefined), $(false)
  11829. if ( !selector ) {
  11830. return this;
  11831. }
  11832. // Method init() accepts an alternate rootjQuery
  11833. // so migrate can support jQuery.sub (gh-2101)
  11834. root = root || rootjQuery;
  11835. // Handle HTML strings
  11836. if ( typeof selector === "string" ) {
  11837. if ( selector[ 0 ] === "<" &&
  11838. selector[ selector.length - 1 ] === ">" &&
  11839. selector.length >= 3 ) {
  11840. // Assume that strings that start and end with <> are HTML and skip the regex check
  11841. match = [ null, selector, null ];
  11842. } else {
  11843. match = rquickExpr.exec( selector );
  11844. }
  11845. // Match html or make sure no context is specified for #id
  11846. if ( match && ( match[ 1 ] || !context ) ) {
  11847. // HANDLE: $(html) -> $(array)
  11848. if ( match[ 1 ] ) {
  11849. context = context instanceof jQuery ? context[ 0 ] : context;
  11850. // Option to run scripts is true for back-compat
  11851. // Intentionally let the error be thrown if parseHTML is not present
  11852. jQuery.merge( this, jQuery.parseHTML(
  11853. match[ 1 ],
  11854. context && context.nodeType ? context.ownerDocument || context : document,
  11855. true
  11856. ) );
  11857. // HANDLE: $(html, props)
  11858. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11859. for ( match in context ) {
  11860. // Properties of context are called as methods if possible
  11861. if ( isFunction( this[ match ] ) ) {
  11862. this[ match ]( context[ match ] );
  11863. // ...and otherwise set as attributes
  11864. } else {
  11865. this.attr( match, context[ match ] );
  11866. }
  11867. }
  11868. }
  11869. return this;
  11870. // HANDLE: $(#id)
  11871. } else {
  11872. elem = document.getElementById( match[ 2 ] );
  11873. if ( elem ) {
  11874. // Inject the element directly into the jQuery object
  11875. this[ 0 ] = elem;
  11876. this.length = 1;
  11877. }
  11878. return this;
  11879. }
  11880. // HANDLE: $(expr, $(...))
  11881. } else if ( !context || context.jquery ) {
  11882. return ( context || root ).find( selector );
  11883. // HANDLE: $(expr, context)
  11884. // (which is just equivalent to: $(context).find(expr)
  11885. } else {
  11886. return this.constructor( context ).find( selector );
  11887. }
  11888. // HANDLE: $(DOMElement)
  11889. } else if ( selector.nodeType ) {
  11890. this[ 0 ] = selector;
  11891. this.length = 1;
  11892. return this;
  11893. // HANDLE: $(function)
  11894. // Shortcut for document ready
  11895. } else if ( isFunction( selector ) ) {
  11896. return root.ready !== undefined ?
  11897. root.ready( selector ) :
  11898. // Execute immediately if ready is not present
  11899. selector( jQuery );
  11900. }
  11901. return jQuery.makeArray( selector, this );
  11902. };
  11903. // Give the init function the jQuery prototype for later instantiation
  11904. init.prototype = jQuery.fn;
  11905. // Initialize central reference
  11906. rootjQuery = jQuery( document );
  11907. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11908. // Methods guaranteed to produce a unique set when starting from a unique set
  11909. guaranteedUnique = {
  11910. children: true,
  11911. contents: true,
  11912. next: true,
  11913. prev: true
  11914. };
  11915. jQuery.fn.extend( {
  11916. has: function( target ) {
  11917. var targets = jQuery( target, this ),
  11918. l = targets.length;
  11919. return this.filter( function() {
  11920. var i = 0;
  11921. for ( ; i < l; i++ ) {
  11922. if ( jQuery.contains( this, targets[ i ] ) ) {
  11923. return true;
  11924. }
  11925. }
  11926. } );
  11927. },
  11928. closest: function( selectors, context ) {
  11929. var cur,
  11930. i = 0,
  11931. l = this.length,
  11932. matched = [],
  11933. targets = typeof selectors !== "string" && jQuery( selectors );
  11934. // Positional selectors never match, since there's no _selection_ context
  11935. if ( !rneedsContext.test( selectors ) ) {
  11936. for ( ; i < l; i++ ) {
  11937. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11938. // Always skip document fragments
  11939. if ( cur.nodeType < 11 && ( targets ?
  11940. targets.index( cur ) > -1 :
  11941. // Don't pass non-elements to Sizzle
  11942. cur.nodeType === 1 &&
  11943. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11944. matched.push( cur );
  11945. break;
  11946. }
  11947. }
  11948. }
  11949. }
  11950. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11951. },
  11952. // Determine the position of an element within the set
  11953. index: function( elem ) {
  11954. // No argument, return index in parent
  11955. if ( !elem ) {
  11956. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11957. }
  11958. // Index in selector
  11959. if ( typeof elem === "string" ) {
  11960. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11961. }
  11962. // Locate the position of the desired element
  11963. return indexOf.call( this,
  11964. // If it receives a jQuery object, the first element is used
  11965. elem.jquery ? elem[ 0 ] : elem
  11966. );
  11967. },
  11968. add: function( selector, context ) {
  11969. return this.pushStack(
  11970. jQuery.uniqueSort(
  11971. jQuery.merge( this.get(), jQuery( selector, context ) )
  11972. )
  11973. );
  11974. },
  11975. addBack: function( selector ) {
  11976. return this.add( selector == null ?
  11977. this.prevObject : this.prevObject.filter( selector )
  11978. );
  11979. }
  11980. } );
  11981. function sibling( cur, dir ) {
  11982. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11983. return cur;
  11984. }
  11985. jQuery.each( {
  11986. parent: function( elem ) {
  11987. var parent = elem.parentNode;
  11988. return parent && parent.nodeType !== 11 ? parent : null;
  11989. },
  11990. parents: function( elem ) {
  11991. return dir( elem, "parentNode" );
  11992. },
  11993. parentsUntil: function( elem, i, until ) {
  11994. return dir( elem, "parentNode", until );
  11995. },
  11996. next: function( elem ) {
  11997. return sibling( elem, "nextSibling" );
  11998. },
  11999. prev: function( elem ) {
  12000. return sibling( elem, "previousSibling" );
  12001. },
  12002. nextAll: function( elem ) {
  12003. return dir( elem, "nextSibling" );
  12004. },
  12005. prevAll: function( elem ) {
  12006. return dir( elem, "previousSibling" );
  12007. },
  12008. nextUntil: function( elem, i, until ) {
  12009. return dir( elem, "nextSibling", until );
  12010. },
  12011. prevUntil: function( elem, i, until ) {
  12012. return dir( elem, "previousSibling", until );
  12013. },
  12014. siblings: function( elem ) {
  12015. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12016. },
  12017. children: function( elem ) {
  12018. return siblings( elem.firstChild );
  12019. },
  12020. contents: function( elem ) {
  12021. if ( typeof elem.contentDocument !== "undefined" ) {
  12022. return elem.contentDocument;
  12023. }
  12024. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12025. // Treat the template element as a regular one in browsers that
  12026. // don't support it.
  12027. if ( nodeName( elem, "template" ) ) {
  12028. elem = elem.content || elem;
  12029. }
  12030. return jQuery.merge( [], elem.childNodes );
  12031. }
  12032. }, function( name, fn ) {
  12033. jQuery.fn[ name ] = function( until, selector ) {
  12034. var matched = jQuery.map( this, fn, until );
  12035. if ( name.slice( -5 ) !== "Until" ) {
  12036. selector = until;
  12037. }
  12038. if ( selector && typeof selector === "string" ) {
  12039. matched = jQuery.filter( selector, matched );
  12040. }
  12041. if ( this.length > 1 ) {
  12042. // Remove duplicates
  12043. if ( !guaranteedUnique[ name ] ) {
  12044. jQuery.uniqueSort( matched );
  12045. }
  12046. // Reverse order for parents* and prev-derivatives
  12047. if ( rparentsprev.test( name ) ) {
  12048. matched.reverse();
  12049. }
  12050. }
  12051. return this.pushStack( matched );
  12052. };
  12053. } );
  12054. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12055. // Convert String-formatted options into Object-formatted ones
  12056. function createOptions( options ) {
  12057. var object = {};
  12058. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12059. object[ flag ] = true;
  12060. } );
  12061. return object;
  12062. }
  12063. /*
  12064. * Create a callback list using the following parameters:
  12065. *
  12066. * options: an optional list of space-separated options that will change how
  12067. * the callback list behaves or a more traditional option object
  12068. *
  12069. * By default a callback list will act like an event callback list and can be
  12070. * "fired" multiple times.
  12071. *
  12072. * Possible options:
  12073. *
  12074. * once: will ensure the callback list can only be fired once (like a Deferred)
  12075. *
  12076. * memory: will keep track of previous values and will call any callback added
  12077. * after the list has been fired right away with the latest "memorized"
  12078. * values (like a Deferred)
  12079. *
  12080. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12081. *
  12082. * stopOnFalse: interrupt callings when a callback returns false
  12083. *
  12084. */
  12085. jQuery.Callbacks = function( options ) {
  12086. // Convert options from String-formatted to Object-formatted if needed
  12087. // (we check in cache first)
  12088. options = typeof options === "string" ?
  12089. createOptions( options ) :
  12090. jQuery.extend( {}, options );
  12091. var // Flag to know if list is currently firing
  12092. firing,
  12093. // Last fire value for non-forgettable lists
  12094. memory,
  12095. // Flag to know if list was already fired
  12096. fired,
  12097. // Flag to prevent firing
  12098. locked,
  12099. // Actual callback list
  12100. list = [],
  12101. // Queue of execution data for repeatable lists
  12102. queue = [],
  12103. // Index of currently firing callback (modified by add/remove as needed)
  12104. firingIndex = -1,
  12105. // Fire callbacks
  12106. fire = function() {
  12107. // Enforce single-firing
  12108. locked = locked || options.once;
  12109. // Execute callbacks for all pending executions,
  12110. // respecting firingIndex overrides and runtime changes
  12111. fired = firing = true;
  12112. for ( ; queue.length; firingIndex = -1 ) {
  12113. memory = queue.shift();
  12114. while ( ++firingIndex < list.length ) {
  12115. // Run callback and check for early termination
  12116. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12117. options.stopOnFalse ) {
  12118. // Jump to end and forget the data so .add doesn't re-fire
  12119. firingIndex = list.length;
  12120. memory = false;
  12121. }
  12122. }
  12123. }
  12124. // Forget the data if we're done with it
  12125. if ( !options.memory ) {
  12126. memory = false;
  12127. }
  12128. firing = false;
  12129. // Clean up if we're done firing for good
  12130. if ( locked ) {
  12131. // Keep an empty list if we have data for future add calls
  12132. if ( memory ) {
  12133. list = [];
  12134. // Otherwise, this object is spent
  12135. } else {
  12136. list = "";
  12137. }
  12138. }
  12139. },
  12140. // Actual Callbacks object
  12141. self = {
  12142. // Add a callback or a collection of callbacks to the list
  12143. add: function() {
  12144. if ( list ) {
  12145. // If we have memory from a past run, we should fire after adding
  12146. if ( memory && !firing ) {
  12147. firingIndex = list.length - 1;
  12148. queue.push( memory );
  12149. }
  12150. ( function add( args ) {
  12151. jQuery.each( args, function( _, arg ) {
  12152. if ( isFunction( arg ) ) {
  12153. if ( !options.unique || !self.has( arg ) ) {
  12154. list.push( arg );
  12155. }
  12156. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12157. // Inspect recursively
  12158. add( arg );
  12159. }
  12160. } );
  12161. } )( arguments );
  12162. if ( memory && !firing ) {
  12163. fire();
  12164. }
  12165. }
  12166. return this;
  12167. },
  12168. // Remove a callback from the list
  12169. remove: function() {
  12170. jQuery.each( arguments, function( _, arg ) {
  12171. var index;
  12172. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12173. list.splice( index, 1 );
  12174. // Handle firing indexes
  12175. if ( index <= firingIndex ) {
  12176. firingIndex--;
  12177. }
  12178. }
  12179. } );
  12180. return this;
  12181. },
  12182. // Check if a given callback is in the list.
  12183. // If no argument is given, return whether or not list has callbacks attached.
  12184. has: function( fn ) {
  12185. return fn ?
  12186. jQuery.inArray( fn, list ) > -1 :
  12187. list.length > 0;
  12188. },
  12189. // Remove all callbacks from the list
  12190. empty: function() {
  12191. if ( list ) {
  12192. list = [];
  12193. }
  12194. return this;
  12195. },
  12196. // Disable .fire and .add
  12197. // Abort any current/pending executions
  12198. // Clear all callbacks and values
  12199. disable: function() {
  12200. locked = queue = [];
  12201. list = memory = "";
  12202. return this;
  12203. },
  12204. disabled: function() {
  12205. return !list;
  12206. },
  12207. // Disable .fire
  12208. // Also disable .add unless we have memory (since it would have no effect)
  12209. // Abort any pending executions
  12210. lock: function() {
  12211. locked = queue = [];
  12212. if ( !memory && !firing ) {
  12213. list = memory = "";
  12214. }
  12215. return this;
  12216. },
  12217. locked: function() {
  12218. return !!locked;
  12219. },
  12220. // Call all callbacks with the given context and arguments
  12221. fireWith: function( context, args ) {
  12222. if ( !locked ) {
  12223. args = args || [];
  12224. args = [ context, args.slice ? args.slice() : args ];
  12225. queue.push( args );
  12226. if ( !firing ) {
  12227. fire();
  12228. }
  12229. }
  12230. return this;
  12231. },
  12232. // Call all the callbacks with the given arguments
  12233. fire: function() {
  12234. self.fireWith( this, arguments );
  12235. return this;
  12236. },
  12237. // To know if the callbacks have already been called at least once
  12238. fired: function() {
  12239. return !!fired;
  12240. }
  12241. };
  12242. return self;
  12243. };
  12244. function Identity( v ) {
  12245. return v;
  12246. }
  12247. function Thrower( ex ) {
  12248. throw ex;
  12249. }
  12250. function adoptValue( value, resolve, reject, noValue ) {
  12251. var method;
  12252. try {
  12253. // Check for promise aspect first to privilege synchronous behavior
  12254. if ( value && isFunction( ( method = value.promise ) ) ) {
  12255. method.call( value ).done( resolve ).fail( reject );
  12256. // Other thenables
  12257. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12258. method.call( value, resolve, reject );
  12259. // Other non-thenables
  12260. } else {
  12261. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12262. // * false: [ value ].slice( 0 ) => resolve( value )
  12263. // * true: [ value ].slice( 1 ) => resolve()
  12264. resolve.apply( undefined, [ value ].slice( noValue ) );
  12265. }
  12266. // For Promises/A+, convert exceptions into rejections
  12267. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12268. // Deferred#then to conditionally suppress rejection.
  12269. } catch ( value ) {
  12270. // Support: Android 4.0 only
  12271. // Strict mode functions invoked without .call/.apply get global-object context
  12272. reject.apply( undefined, [ value ] );
  12273. }
  12274. }
  12275. jQuery.extend( {
  12276. Deferred: function( func ) {
  12277. var tuples = [
  12278. // action, add listener, callbacks,
  12279. // ... .then handlers, argument index, [final state]
  12280. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12281. jQuery.Callbacks( "memory" ), 2 ],
  12282. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12283. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12284. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12285. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12286. ],
  12287. state = "pending",
  12288. promise = {
  12289. state: function() {
  12290. return state;
  12291. },
  12292. always: function() {
  12293. deferred.done( arguments ).fail( arguments );
  12294. return this;
  12295. },
  12296. "catch": function( fn ) {
  12297. return promise.then( null, fn );
  12298. },
  12299. // Keep pipe for back-compat
  12300. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12301. var fns = arguments;
  12302. return jQuery.Deferred( function( newDefer ) {
  12303. jQuery.each( tuples, function( i, tuple ) {
  12304. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12305. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12306. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12307. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12308. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12309. deferred[ tuple[ 1 ] ]( function() {
  12310. var returned = fn && fn.apply( this, arguments );
  12311. if ( returned && isFunction( returned.promise ) ) {
  12312. returned.promise()
  12313. .progress( newDefer.notify )
  12314. .done( newDefer.resolve )
  12315. .fail( newDefer.reject );
  12316. } else {
  12317. newDefer[ tuple[ 0 ] + "With" ](
  12318. this,
  12319. fn ? [ returned ] : arguments
  12320. );
  12321. }
  12322. } );
  12323. } );
  12324. fns = null;
  12325. } ).promise();
  12326. },
  12327. then: function( onFulfilled, onRejected, onProgress ) {
  12328. var maxDepth = 0;
  12329. function resolve( depth, deferred, handler, special ) {
  12330. return function() {
  12331. var that = this,
  12332. args = arguments,
  12333. mightThrow = function() {
  12334. var returned, then;
  12335. // Support: Promises/A+ section 2.3.3.3.3
  12336. // https://promisesaplus.com/#point-59
  12337. // Ignore double-resolution attempts
  12338. if ( depth < maxDepth ) {
  12339. return;
  12340. }
  12341. returned = handler.apply( that, args );
  12342. // Support: Promises/A+ section 2.3.1
  12343. // https://promisesaplus.com/#point-48
  12344. if ( returned === deferred.promise() ) {
  12345. throw new TypeError( "Thenable self-resolution" );
  12346. }
  12347. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12348. // https://promisesaplus.com/#point-54
  12349. // https://promisesaplus.com/#point-75
  12350. // Retrieve `then` only once
  12351. then = returned &&
  12352. // Support: Promises/A+ section 2.3.4
  12353. // https://promisesaplus.com/#point-64
  12354. // Only check objects and functions for thenability
  12355. ( typeof returned === "object" ||
  12356. typeof returned === "function" ) &&
  12357. returned.then;
  12358. // Handle a returned thenable
  12359. if ( isFunction( then ) ) {
  12360. // Special processors (notify) just wait for resolution
  12361. if ( special ) {
  12362. then.call(
  12363. returned,
  12364. resolve( maxDepth, deferred, Identity, special ),
  12365. resolve( maxDepth, deferred, Thrower, special )
  12366. );
  12367. // Normal processors (resolve) also hook into progress
  12368. } else {
  12369. // ...and disregard older resolution values
  12370. maxDepth++;
  12371. then.call(
  12372. returned,
  12373. resolve( maxDepth, deferred, Identity, special ),
  12374. resolve( maxDepth, deferred, Thrower, special ),
  12375. resolve( maxDepth, deferred, Identity,
  12376. deferred.notifyWith )
  12377. );
  12378. }
  12379. // Handle all other returned values
  12380. } else {
  12381. // Only substitute handlers pass on context
  12382. // and multiple values (non-spec behavior)
  12383. if ( handler !== Identity ) {
  12384. that = undefined;
  12385. args = [ returned ];
  12386. }
  12387. // Process the value(s)
  12388. // Default process is resolve
  12389. ( special || deferred.resolveWith )( that, args );
  12390. }
  12391. },
  12392. // Only normal processors (resolve) catch and reject exceptions
  12393. process = special ?
  12394. mightThrow :
  12395. function() {
  12396. try {
  12397. mightThrow();
  12398. } catch ( e ) {
  12399. if ( jQuery.Deferred.exceptionHook ) {
  12400. jQuery.Deferred.exceptionHook( e,
  12401. process.stackTrace );
  12402. }
  12403. // Support: Promises/A+ section 2.3.3.3.4.1
  12404. // https://promisesaplus.com/#point-61
  12405. // Ignore post-resolution exceptions
  12406. if ( depth + 1 >= maxDepth ) {
  12407. // Only substitute handlers pass on context
  12408. // and multiple values (non-spec behavior)
  12409. if ( handler !== Thrower ) {
  12410. that = undefined;
  12411. args = [ e ];
  12412. }
  12413. deferred.rejectWith( that, args );
  12414. }
  12415. }
  12416. };
  12417. // Support: Promises/A+ section 2.3.3.3.1
  12418. // https://promisesaplus.com/#point-57
  12419. // Re-resolve promises immediately to dodge false rejection from
  12420. // subsequent errors
  12421. if ( depth ) {
  12422. process();
  12423. } else {
  12424. // Call an optional hook to record the stack, in case of exception
  12425. // since it's otherwise lost when execution goes async
  12426. if ( jQuery.Deferred.getStackHook ) {
  12427. process.stackTrace = jQuery.Deferred.getStackHook();
  12428. }
  12429. window.setTimeout( process );
  12430. }
  12431. };
  12432. }
  12433. return jQuery.Deferred( function( newDefer ) {
  12434. // progress_handlers.add( ... )
  12435. tuples[ 0 ][ 3 ].add(
  12436. resolve(
  12437. 0,
  12438. newDefer,
  12439. isFunction( onProgress ) ?
  12440. onProgress :
  12441. Identity,
  12442. newDefer.notifyWith
  12443. )
  12444. );
  12445. // fulfilled_handlers.add( ... )
  12446. tuples[ 1 ][ 3 ].add(
  12447. resolve(
  12448. 0,
  12449. newDefer,
  12450. isFunction( onFulfilled ) ?
  12451. onFulfilled :
  12452. Identity
  12453. )
  12454. );
  12455. // rejected_handlers.add( ... )
  12456. tuples[ 2 ][ 3 ].add(
  12457. resolve(
  12458. 0,
  12459. newDefer,
  12460. isFunction( onRejected ) ?
  12461. onRejected :
  12462. Thrower
  12463. )
  12464. );
  12465. } ).promise();
  12466. },
  12467. // Get a promise for this deferred
  12468. // If obj is provided, the promise aspect is added to the object
  12469. promise: function( obj ) {
  12470. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12471. }
  12472. },
  12473. deferred = {};
  12474. // Add list-specific methods
  12475. jQuery.each( tuples, function( i, tuple ) {
  12476. var list = tuple[ 2 ],
  12477. stateString = tuple[ 5 ];
  12478. // promise.progress = list.add
  12479. // promise.done = list.add
  12480. // promise.fail = list.add
  12481. promise[ tuple[ 1 ] ] = list.add;
  12482. // Handle state
  12483. if ( stateString ) {
  12484. list.add(
  12485. function() {
  12486. // state = "resolved" (i.e., fulfilled)
  12487. // state = "rejected"
  12488. state = stateString;
  12489. },
  12490. // rejected_callbacks.disable
  12491. // fulfilled_callbacks.disable
  12492. tuples[ 3 - i ][ 2 ].disable,
  12493. // rejected_handlers.disable
  12494. // fulfilled_handlers.disable
  12495. tuples[ 3 - i ][ 3 ].disable,
  12496. // progress_callbacks.lock
  12497. tuples[ 0 ][ 2 ].lock,
  12498. // progress_handlers.lock
  12499. tuples[ 0 ][ 3 ].lock
  12500. );
  12501. }
  12502. // progress_handlers.fire
  12503. // fulfilled_handlers.fire
  12504. // rejected_handlers.fire
  12505. list.add( tuple[ 3 ].fire );
  12506. // deferred.notify = function() { deferred.notifyWith(...) }
  12507. // deferred.resolve = function() { deferred.resolveWith(...) }
  12508. // deferred.reject = function() { deferred.rejectWith(...) }
  12509. deferred[ tuple[ 0 ] ] = function() {
  12510. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12511. return this;
  12512. };
  12513. // deferred.notifyWith = list.fireWith
  12514. // deferred.resolveWith = list.fireWith
  12515. // deferred.rejectWith = list.fireWith
  12516. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12517. } );
  12518. // Make the deferred a promise
  12519. promise.promise( deferred );
  12520. // Call given func if any
  12521. if ( func ) {
  12522. func.call( deferred, deferred );
  12523. }
  12524. // All done!
  12525. return deferred;
  12526. },
  12527. // Deferred helper
  12528. when: function( singleValue ) {
  12529. var
  12530. // count of uncompleted subordinates
  12531. remaining = arguments.length,
  12532. // count of unprocessed arguments
  12533. i = remaining,
  12534. // subordinate fulfillment data
  12535. resolveContexts = Array( i ),
  12536. resolveValues = slice.call( arguments ),
  12537. // the master Deferred
  12538. master = jQuery.Deferred(),
  12539. // subordinate callback factory
  12540. updateFunc = function( i ) {
  12541. return function( value ) {
  12542. resolveContexts[ i ] = this;
  12543. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12544. if ( !( --remaining ) ) {
  12545. master.resolveWith( resolveContexts, resolveValues );
  12546. }
  12547. };
  12548. };
  12549. // Single- and empty arguments are adopted like Promise.resolve
  12550. if ( remaining <= 1 ) {
  12551. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12552. !remaining );
  12553. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12554. if ( master.state() === "pending" ||
  12555. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12556. return master.then();
  12557. }
  12558. }
  12559. // Multiple arguments are aggregated like Promise.all array elements
  12560. while ( i-- ) {
  12561. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12562. }
  12563. return master.promise();
  12564. }
  12565. } );
  12566. // These usually indicate a programmer mistake during development,
  12567. // warn about them ASAP rather than swallowing them by default.
  12568. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12569. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12570. // Support: IE 8 - 9 only
  12571. // Console exists when dev tools are open, which can happen at any time
  12572. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12573. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12574. }
  12575. };
  12576. jQuery.readyException = function( error ) {
  12577. window.setTimeout( function() {
  12578. throw error;
  12579. } );
  12580. };
  12581. // The deferred used on DOM ready
  12582. var readyList = jQuery.Deferred();
  12583. jQuery.fn.ready = function( fn ) {
  12584. readyList
  12585. .then( fn )
  12586. // Wrap jQuery.readyException in a function so that the lookup
  12587. // happens at the time of error handling instead of callback
  12588. // registration.
  12589. .catch( function( error ) {
  12590. jQuery.readyException( error );
  12591. } );
  12592. return this;
  12593. };
  12594. jQuery.extend( {
  12595. // Is the DOM ready to be used? Set to true once it occurs.
  12596. isReady: false,
  12597. // A counter to track how many items to wait for before
  12598. // the ready event fires. See #6781
  12599. readyWait: 1,
  12600. // Handle when the DOM is ready
  12601. ready: function( wait ) {
  12602. // Abort if there are pending holds or we're already ready
  12603. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12604. return;
  12605. }
  12606. // Remember that the DOM is ready
  12607. jQuery.isReady = true;
  12608. // If a normal DOM Ready event fired, decrement, and wait if need be
  12609. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12610. return;
  12611. }
  12612. // If there are functions bound, to execute
  12613. readyList.resolveWith( document, [ jQuery ] );
  12614. }
  12615. } );
  12616. jQuery.ready.then = readyList.then;
  12617. // The ready event handler and self cleanup method
  12618. function completed() {
  12619. document.removeEventListener( "DOMContentLoaded", completed );
  12620. window.removeEventListener( "load", completed );
  12621. jQuery.ready();
  12622. }
  12623. // Catch cases where $(document).ready() is called
  12624. // after the browser event has already occurred.
  12625. // Support: IE <=9 - 10 only
  12626. // Older IE sometimes signals "interactive" too soon
  12627. if ( document.readyState === "complete" ||
  12628. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12629. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12630. window.setTimeout( jQuery.ready );
  12631. } else {
  12632. // Use the handy event callback
  12633. document.addEventListener( "DOMContentLoaded", completed );
  12634. // A fallback to window.onload, that will always work
  12635. window.addEventListener( "load", completed );
  12636. }
  12637. // Multifunctional method to get and set values of a collection
  12638. // The value/s can optionally be executed if it's a function
  12639. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12640. var i = 0,
  12641. len = elems.length,
  12642. bulk = key == null;
  12643. // Sets many values
  12644. if ( toType( key ) === "object" ) {
  12645. chainable = true;
  12646. for ( i in key ) {
  12647. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12648. }
  12649. // Sets one value
  12650. } else if ( value !== undefined ) {
  12651. chainable = true;
  12652. if ( !isFunction( value ) ) {
  12653. raw = true;
  12654. }
  12655. if ( bulk ) {
  12656. // Bulk operations run against the entire set
  12657. if ( raw ) {
  12658. fn.call( elems, value );
  12659. fn = null;
  12660. // ...except when executing function values
  12661. } else {
  12662. bulk = fn;
  12663. fn = function( elem, key, value ) {
  12664. return bulk.call( jQuery( elem ), value );
  12665. };
  12666. }
  12667. }
  12668. if ( fn ) {
  12669. for ( ; i < len; i++ ) {
  12670. fn(
  12671. elems[ i ], key, raw ?
  12672. value :
  12673. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12674. );
  12675. }
  12676. }
  12677. }
  12678. if ( chainable ) {
  12679. return elems;
  12680. }
  12681. // Gets
  12682. if ( bulk ) {
  12683. return fn.call( elems );
  12684. }
  12685. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12686. };
  12687. // Matches dashed string for camelizing
  12688. var rmsPrefix = /^-ms-/,
  12689. rdashAlpha = /-([a-z])/g;
  12690. // Used by camelCase as callback to replace()
  12691. function fcamelCase( all, letter ) {
  12692. return letter.toUpperCase();
  12693. }
  12694. // Convert dashed to camelCase; used by the css and data modules
  12695. // Support: IE <=9 - 11, Edge 12 - 15
  12696. // Microsoft forgot to hump their vendor prefix (#9572)
  12697. function camelCase( string ) {
  12698. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12699. }
  12700. var acceptData = function( owner ) {
  12701. // Accepts only:
  12702. // - Node
  12703. // - Node.ELEMENT_NODE
  12704. // - Node.DOCUMENT_NODE
  12705. // - Object
  12706. // - Any
  12707. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12708. };
  12709. function Data() {
  12710. this.expando = jQuery.expando + Data.uid++;
  12711. }
  12712. Data.uid = 1;
  12713. Data.prototype = {
  12714. cache: function( owner ) {
  12715. // Check if the owner object already has a cache
  12716. var value = owner[ this.expando ];
  12717. // If not, create one
  12718. if ( !value ) {
  12719. value = {};
  12720. // We can accept data for non-element nodes in modern browsers,
  12721. // but we should not, see #8335.
  12722. // Always return an empty object.
  12723. if ( acceptData( owner ) ) {
  12724. // If it is a node unlikely to be stringify-ed or looped over
  12725. // use plain assignment
  12726. if ( owner.nodeType ) {
  12727. owner[ this.expando ] = value;
  12728. // Otherwise secure it in a non-enumerable property
  12729. // configurable must be true to allow the property to be
  12730. // deleted when data is removed
  12731. } else {
  12732. Object.defineProperty( owner, this.expando, {
  12733. value: value,
  12734. configurable: true
  12735. } );
  12736. }
  12737. }
  12738. }
  12739. return value;
  12740. },
  12741. set: function( owner, data, value ) {
  12742. var prop,
  12743. cache = this.cache( owner );
  12744. // Handle: [ owner, key, value ] args
  12745. // Always use camelCase key (gh-2257)
  12746. if ( typeof data === "string" ) {
  12747. cache[ camelCase( data ) ] = value;
  12748. // Handle: [ owner, { properties } ] args
  12749. } else {
  12750. // Copy the properties one-by-one to the cache object
  12751. for ( prop in data ) {
  12752. cache[ camelCase( prop ) ] = data[ prop ];
  12753. }
  12754. }
  12755. return cache;
  12756. },
  12757. get: function( owner, key ) {
  12758. return key === undefined ?
  12759. this.cache( owner ) :
  12760. // Always use camelCase key (gh-2257)
  12761. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12762. },
  12763. access: function( owner, key, value ) {
  12764. // In cases where either:
  12765. //
  12766. // 1. No key was specified
  12767. // 2. A string key was specified, but no value provided
  12768. //
  12769. // Take the "read" path and allow the get method to determine
  12770. // which value to return, respectively either:
  12771. //
  12772. // 1. The entire cache object
  12773. // 2. The data stored at the key
  12774. //
  12775. if ( key === undefined ||
  12776. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12777. return this.get( owner, key );
  12778. }
  12779. // When the key is not a string, or both a key and value
  12780. // are specified, set or extend (existing objects) with either:
  12781. //
  12782. // 1. An object of properties
  12783. // 2. A key and value
  12784. //
  12785. this.set( owner, key, value );
  12786. // Since the "set" path can have two possible entry points
  12787. // return the expected data based on which path was taken[*]
  12788. return value !== undefined ? value : key;
  12789. },
  12790. remove: function( owner, key ) {
  12791. var i,
  12792. cache = owner[ this.expando ];
  12793. if ( cache === undefined ) {
  12794. return;
  12795. }
  12796. if ( key !== undefined ) {
  12797. // Support array or space separated string of keys
  12798. if ( Array.isArray( key ) ) {
  12799. // If key is an array of keys...
  12800. // We always set camelCase keys, so remove that.
  12801. key = key.map( camelCase );
  12802. } else {
  12803. key = camelCase( key );
  12804. // If a key with the spaces exists, use it.
  12805. // Otherwise, create an array by matching non-whitespace
  12806. key = key in cache ?
  12807. [ key ] :
  12808. ( key.match( rnothtmlwhite ) || [] );
  12809. }
  12810. i = key.length;
  12811. while ( i-- ) {
  12812. delete cache[ key[ i ] ];
  12813. }
  12814. }
  12815. // Remove the expando if there's no more data
  12816. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12817. // Support: Chrome <=35 - 45
  12818. // Webkit & Blink performance suffers when deleting properties
  12819. // from DOM nodes, so set to undefined instead
  12820. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12821. if ( owner.nodeType ) {
  12822. owner[ this.expando ] = undefined;
  12823. } else {
  12824. delete owner[ this.expando ];
  12825. }
  12826. }
  12827. },
  12828. hasData: function( owner ) {
  12829. var cache = owner[ this.expando ];
  12830. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12831. }
  12832. };
  12833. var dataPriv = new Data();
  12834. var dataUser = new Data();
  12835. // Implementation Summary
  12836. //
  12837. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12838. // 2. Improve the module's maintainability by reducing the storage
  12839. // paths to a single mechanism.
  12840. // 3. Use the same single mechanism to support "private" and "user" data.
  12841. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12842. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12843. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12844. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12845. rmultiDash = /[A-Z]/g;
  12846. function getData( data ) {
  12847. if ( data === "true" ) {
  12848. return true;
  12849. }
  12850. if ( data === "false" ) {
  12851. return false;
  12852. }
  12853. if ( data === "null" ) {
  12854. return null;
  12855. }
  12856. // Only convert to a number if it doesn't change the string
  12857. if ( data === +data + "" ) {
  12858. return +data;
  12859. }
  12860. if ( rbrace.test( data ) ) {
  12861. return JSON.parse( data );
  12862. }
  12863. return data;
  12864. }
  12865. function dataAttr( elem, key, data ) {
  12866. var name;
  12867. // If nothing was found internally, try to fetch any
  12868. // data from the HTML5 data-* attribute
  12869. if ( data === undefined && elem.nodeType === 1 ) {
  12870. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12871. data = elem.getAttribute( name );
  12872. if ( typeof data === "string" ) {
  12873. try {
  12874. data = getData( data );
  12875. } catch ( e ) {}
  12876. // Make sure we set the data so it isn't changed later
  12877. dataUser.set( elem, key, data );
  12878. } else {
  12879. data = undefined;
  12880. }
  12881. }
  12882. return data;
  12883. }
  12884. jQuery.extend( {
  12885. hasData: function( elem ) {
  12886. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12887. },
  12888. data: function( elem, name, data ) {
  12889. return dataUser.access( elem, name, data );
  12890. },
  12891. removeData: function( elem, name ) {
  12892. dataUser.remove( elem, name );
  12893. },
  12894. // TODO: Now that all calls to _data and _removeData have been replaced
  12895. // with direct calls to dataPriv methods, these can be deprecated.
  12896. _data: function( elem, name, data ) {
  12897. return dataPriv.access( elem, name, data );
  12898. },
  12899. _removeData: function( elem, name ) {
  12900. dataPriv.remove( elem, name );
  12901. }
  12902. } );
  12903. jQuery.fn.extend( {
  12904. data: function( key, value ) {
  12905. var i, name, data,
  12906. elem = this[ 0 ],
  12907. attrs = elem && elem.attributes;
  12908. // Gets all values
  12909. if ( key === undefined ) {
  12910. if ( this.length ) {
  12911. data = dataUser.get( elem );
  12912. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12913. i = attrs.length;
  12914. while ( i-- ) {
  12915. // Support: IE 11 only
  12916. // The attrs elements can be null (#14894)
  12917. if ( attrs[ i ] ) {
  12918. name = attrs[ i ].name;
  12919. if ( name.indexOf( "data-" ) === 0 ) {
  12920. name = camelCase( name.slice( 5 ) );
  12921. dataAttr( elem, name, data[ name ] );
  12922. }
  12923. }
  12924. }
  12925. dataPriv.set( elem, "hasDataAttrs", true );
  12926. }
  12927. }
  12928. return data;
  12929. }
  12930. // Sets multiple values
  12931. if ( typeof key === "object" ) {
  12932. return this.each( function() {
  12933. dataUser.set( this, key );
  12934. } );
  12935. }
  12936. return access( this, function( value ) {
  12937. var data;
  12938. // The calling jQuery object (element matches) is not empty
  12939. // (and therefore has an element appears at this[ 0 ]) and the
  12940. // `value` parameter was not undefined. An empty jQuery object
  12941. // will result in `undefined` for elem = this[ 0 ] which will
  12942. // throw an exception if an attempt to read a data cache is made.
  12943. if ( elem && value === undefined ) {
  12944. // Attempt to get data from the cache
  12945. // The key will always be camelCased in Data
  12946. data = dataUser.get( elem, key );
  12947. if ( data !== undefined ) {
  12948. return data;
  12949. }
  12950. // Attempt to "discover" the data in
  12951. // HTML5 custom data-* attrs
  12952. data = dataAttr( elem, key );
  12953. if ( data !== undefined ) {
  12954. return data;
  12955. }
  12956. // We tried really hard, but the data doesn't exist.
  12957. return;
  12958. }
  12959. // Set the data...
  12960. this.each( function() {
  12961. // We always store the camelCased key
  12962. dataUser.set( this, key, value );
  12963. } );
  12964. }, null, value, arguments.length > 1, null, true );
  12965. },
  12966. removeData: function( key ) {
  12967. return this.each( function() {
  12968. dataUser.remove( this, key );
  12969. } );
  12970. }
  12971. } );
  12972. jQuery.extend( {
  12973. queue: function( elem, type, data ) {
  12974. var queue;
  12975. if ( elem ) {
  12976. type = ( type || "fx" ) + "queue";
  12977. queue = dataPriv.get( elem, type );
  12978. // Speed up dequeue by getting out quickly if this is just a lookup
  12979. if ( data ) {
  12980. if ( !queue || Array.isArray( data ) ) {
  12981. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12982. } else {
  12983. queue.push( data );
  12984. }
  12985. }
  12986. return queue || [];
  12987. }
  12988. },
  12989. dequeue: function( elem, type ) {
  12990. type = type || "fx";
  12991. var queue = jQuery.queue( elem, type ),
  12992. startLength = queue.length,
  12993. fn = queue.shift(),
  12994. hooks = jQuery._queueHooks( elem, type ),
  12995. next = function() {
  12996. jQuery.dequeue( elem, type );
  12997. };
  12998. // If the fx queue is dequeued, always remove the progress sentinel
  12999. if ( fn === "inprogress" ) {
  13000. fn = queue.shift();
  13001. startLength--;
  13002. }
  13003. if ( fn ) {
  13004. // Add a progress sentinel to prevent the fx queue from being
  13005. // automatically dequeued
  13006. if ( type === "fx" ) {
  13007. queue.unshift( "inprogress" );
  13008. }
  13009. // Clear up the last queue stop function
  13010. delete hooks.stop;
  13011. fn.call( elem, next, hooks );
  13012. }
  13013. if ( !startLength && hooks ) {
  13014. hooks.empty.fire();
  13015. }
  13016. },
  13017. // Not public - generate a queueHooks object, or return the current one
  13018. _queueHooks: function( elem, type ) {
  13019. var key = type + "queueHooks";
  13020. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13021. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13022. dataPriv.remove( elem, [ type + "queue", key ] );
  13023. } )
  13024. } );
  13025. }
  13026. } );
  13027. jQuery.fn.extend( {
  13028. queue: function( type, data ) {
  13029. var setter = 2;
  13030. if ( typeof type !== "string" ) {
  13031. data = type;
  13032. type = "fx";
  13033. setter--;
  13034. }
  13035. if ( arguments.length < setter ) {
  13036. return jQuery.queue( this[ 0 ], type );
  13037. }
  13038. return data === undefined ?
  13039. this :
  13040. this.each( function() {
  13041. var queue = jQuery.queue( this, type, data );
  13042. // Ensure a hooks for this queue
  13043. jQuery._queueHooks( this, type );
  13044. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13045. jQuery.dequeue( this, type );
  13046. }
  13047. } );
  13048. },
  13049. dequeue: function( type ) {
  13050. return this.each( function() {
  13051. jQuery.dequeue( this, type );
  13052. } );
  13053. },
  13054. clearQueue: function( type ) {
  13055. return this.queue( type || "fx", [] );
  13056. },
  13057. // Get a promise resolved when queues of a certain type
  13058. // are emptied (fx is the type by default)
  13059. promise: function( type, obj ) {
  13060. var tmp,
  13061. count = 1,
  13062. defer = jQuery.Deferred(),
  13063. elements = this,
  13064. i = this.length,
  13065. resolve = function() {
  13066. if ( !( --count ) ) {
  13067. defer.resolveWith( elements, [ elements ] );
  13068. }
  13069. };
  13070. if ( typeof type !== "string" ) {
  13071. obj = type;
  13072. type = undefined;
  13073. }
  13074. type = type || "fx";
  13075. while ( i-- ) {
  13076. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13077. if ( tmp && tmp.empty ) {
  13078. count++;
  13079. tmp.empty.add( resolve );
  13080. }
  13081. }
  13082. resolve();
  13083. return defer.promise( obj );
  13084. }
  13085. } );
  13086. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13087. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13088. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13089. var documentElement = document.documentElement;
  13090. var isAttached = function( elem ) {
  13091. return jQuery.contains( elem.ownerDocument, elem );
  13092. },
  13093. composed = { composed: true };
  13094. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13095. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13096. // Support: iOS 10.0-10.2 only
  13097. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13098. // leading to errors. We need to check for `getRootNode`.
  13099. if ( documentElement.getRootNode ) {
  13100. isAttached = function( elem ) {
  13101. return jQuery.contains( elem.ownerDocument, elem ) ||
  13102. elem.getRootNode( composed ) === elem.ownerDocument;
  13103. };
  13104. }
  13105. var isHiddenWithinTree = function( elem, el ) {
  13106. // isHiddenWithinTree might be called from jQuery#filter function;
  13107. // in that case, element will be second argument
  13108. elem = el || elem;
  13109. // Inline style trumps all
  13110. return elem.style.display === "none" ||
  13111. elem.style.display === "" &&
  13112. // Otherwise, check computed style
  13113. // Support: Firefox <=43 - 45
  13114. // Disconnected elements can have computed display: none, so first confirm that elem is
  13115. // in the document.
  13116. isAttached( elem ) &&
  13117. jQuery.css( elem, "display" ) === "none";
  13118. };
  13119. var swap = function( elem, options, callback, args ) {
  13120. var ret, name,
  13121. old = {};
  13122. // Remember the old values, and insert the new ones
  13123. for ( name in options ) {
  13124. old[ name ] = elem.style[ name ];
  13125. elem.style[ name ] = options[ name ];
  13126. }
  13127. ret = callback.apply( elem, args || [] );
  13128. // Revert the old values
  13129. for ( name in options ) {
  13130. elem.style[ name ] = old[ name ];
  13131. }
  13132. return ret;
  13133. };
  13134. function adjustCSS( elem, prop, valueParts, tween ) {
  13135. var adjusted, scale,
  13136. maxIterations = 20,
  13137. currentValue = tween ?
  13138. function() {
  13139. return tween.cur();
  13140. } :
  13141. function() {
  13142. return jQuery.css( elem, prop, "" );
  13143. },
  13144. initial = currentValue(),
  13145. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13146. // Starting value computation is required for potential unit mismatches
  13147. initialInUnit = elem.nodeType &&
  13148. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13149. rcssNum.exec( jQuery.css( elem, prop ) );
  13150. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13151. // Support: Firefox <=54
  13152. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13153. initial = initial / 2;
  13154. // Trust units reported by jQuery.css
  13155. unit = unit || initialInUnit[ 3 ];
  13156. // Iteratively approximate from a nonzero starting point
  13157. initialInUnit = +initial || 1;
  13158. while ( maxIterations-- ) {
  13159. // Evaluate and update our best guess (doubling guesses that zero out).
  13160. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13161. jQuery.style( elem, prop, initialInUnit + unit );
  13162. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13163. maxIterations = 0;
  13164. }
  13165. initialInUnit = initialInUnit / scale;
  13166. }
  13167. initialInUnit = initialInUnit * 2;
  13168. jQuery.style( elem, prop, initialInUnit + unit );
  13169. // Make sure we update the tween properties later on
  13170. valueParts = valueParts || [];
  13171. }
  13172. if ( valueParts ) {
  13173. initialInUnit = +initialInUnit || +initial || 0;
  13174. // Apply relative offset (+=/-=) if specified
  13175. adjusted = valueParts[ 1 ] ?
  13176. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13177. +valueParts[ 2 ];
  13178. if ( tween ) {
  13179. tween.unit = unit;
  13180. tween.start = initialInUnit;
  13181. tween.end = adjusted;
  13182. }
  13183. }
  13184. return adjusted;
  13185. }
  13186. var defaultDisplayMap = {};
  13187. function getDefaultDisplay( elem ) {
  13188. var temp,
  13189. doc = elem.ownerDocument,
  13190. nodeName = elem.nodeName,
  13191. display = defaultDisplayMap[ nodeName ];
  13192. if ( display ) {
  13193. return display;
  13194. }
  13195. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13196. display = jQuery.css( temp, "display" );
  13197. temp.parentNode.removeChild( temp );
  13198. if ( display === "none" ) {
  13199. display = "block";
  13200. }
  13201. defaultDisplayMap[ nodeName ] = display;
  13202. return display;
  13203. }
  13204. function showHide( elements, show ) {
  13205. var display, elem,
  13206. values = [],
  13207. index = 0,
  13208. length = elements.length;
  13209. // Determine new display value for elements that need to change
  13210. for ( ; index < length; index++ ) {
  13211. elem = elements[ index ];
  13212. if ( !elem.style ) {
  13213. continue;
  13214. }
  13215. display = elem.style.display;
  13216. if ( show ) {
  13217. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13218. // check is required in this first loop unless we have a nonempty display value (either
  13219. // inline or about-to-be-restored)
  13220. if ( display === "none" ) {
  13221. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13222. if ( !values[ index ] ) {
  13223. elem.style.display = "";
  13224. }
  13225. }
  13226. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13227. values[ index ] = getDefaultDisplay( elem );
  13228. }
  13229. } else {
  13230. if ( display !== "none" ) {
  13231. values[ index ] = "none";
  13232. // Remember what we're overwriting
  13233. dataPriv.set( elem, "display", display );
  13234. }
  13235. }
  13236. }
  13237. // Set the display of the elements in a second loop to avoid constant reflow
  13238. for ( index = 0; index < length; index++ ) {
  13239. if ( values[ index ] != null ) {
  13240. elements[ index ].style.display = values[ index ];
  13241. }
  13242. }
  13243. return elements;
  13244. }
  13245. jQuery.fn.extend( {
  13246. show: function() {
  13247. return showHide( this, true );
  13248. },
  13249. hide: function() {
  13250. return showHide( this );
  13251. },
  13252. toggle: function( state ) {
  13253. if ( typeof state === "boolean" ) {
  13254. return state ? this.show() : this.hide();
  13255. }
  13256. return this.each( function() {
  13257. if ( isHiddenWithinTree( this ) ) {
  13258. jQuery( this ).show();
  13259. } else {
  13260. jQuery( this ).hide();
  13261. }
  13262. } );
  13263. }
  13264. } );
  13265. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13266. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13267. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13268. // We have to close these tags to support XHTML (#13200)
  13269. var wrapMap = {
  13270. // Support: IE <=9 only
  13271. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13272. // XHTML parsers do not magically insert elements in the
  13273. // same way that tag soup parsers do. So we cannot shorten
  13274. // this by omitting <tbody> or other required elements.
  13275. thead: [ 1, "<table>", "</table>" ],
  13276. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13277. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13278. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13279. _default: [ 0, "", "" ]
  13280. };
  13281. // Support: IE <=9 only
  13282. wrapMap.optgroup = wrapMap.option;
  13283. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13284. wrapMap.th = wrapMap.td;
  13285. function getAll( context, tag ) {
  13286. // Support: IE <=9 - 11 only
  13287. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13288. var ret;
  13289. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13290. ret = context.getElementsByTagName( tag || "*" );
  13291. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13292. ret = context.querySelectorAll( tag || "*" );
  13293. } else {
  13294. ret = [];
  13295. }
  13296. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13297. return jQuery.merge( [ context ], ret );
  13298. }
  13299. return ret;
  13300. }
  13301. // Mark scripts as having already been evaluated
  13302. function setGlobalEval( elems, refElements ) {
  13303. var i = 0,
  13304. l = elems.length;
  13305. for ( ; i < l; i++ ) {
  13306. dataPriv.set(
  13307. elems[ i ],
  13308. "globalEval",
  13309. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13310. );
  13311. }
  13312. }
  13313. var rhtml = /<|&#?\w+;/;
  13314. function buildFragment( elems, context, scripts, selection, ignored ) {
  13315. var elem, tmp, tag, wrap, attached, j,
  13316. fragment = context.createDocumentFragment(),
  13317. nodes = [],
  13318. i = 0,
  13319. l = elems.length;
  13320. for ( ; i < l; i++ ) {
  13321. elem = elems[ i ];
  13322. if ( elem || elem === 0 ) {
  13323. // Add nodes directly
  13324. if ( toType( elem ) === "object" ) {
  13325. // Support: Android <=4.0 only, PhantomJS 1 only
  13326. // push.apply(_, arraylike) throws on ancient WebKit
  13327. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13328. // Convert non-html into a text node
  13329. } else if ( !rhtml.test( elem ) ) {
  13330. nodes.push( context.createTextNode( elem ) );
  13331. // Convert html into DOM nodes
  13332. } else {
  13333. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13334. // Deserialize a standard representation
  13335. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13336. wrap = wrapMap[ tag ] || wrapMap._default;
  13337. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13338. // Descend through wrappers to the right content
  13339. j = wrap[ 0 ];
  13340. while ( j-- ) {
  13341. tmp = tmp.lastChild;
  13342. }
  13343. // Support: Android <=4.0 only, PhantomJS 1 only
  13344. // push.apply(_, arraylike) throws on ancient WebKit
  13345. jQuery.merge( nodes, tmp.childNodes );
  13346. // Remember the top-level container
  13347. tmp = fragment.firstChild;
  13348. // Ensure the created nodes are orphaned (#12392)
  13349. tmp.textContent = "";
  13350. }
  13351. }
  13352. }
  13353. // Remove wrapper from fragment
  13354. fragment.textContent = "";
  13355. i = 0;
  13356. while ( ( elem = nodes[ i++ ] ) ) {
  13357. // Skip elements already in the context collection (trac-4087)
  13358. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13359. if ( ignored ) {
  13360. ignored.push( elem );
  13361. }
  13362. continue;
  13363. }
  13364. attached = isAttached( elem );
  13365. // Append to fragment
  13366. tmp = getAll( fragment.appendChild( elem ), "script" );
  13367. // Preserve script evaluation history
  13368. if ( attached ) {
  13369. setGlobalEval( tmp );
  13370. }
  13371. // Capture executables
  13372. if ( scripts ) {
  13373. j = 0;
  13374. while ( ( elem = tmp[ j++ ] ) ) {
  13375. if ( rscriptType.test( elem.type || "" ) ) {
  13376. scripts.push( elem );
  13377. }
  13378. }
  13379. }
  13380. }
  13381. return fragment;
  13382. }
  13383. ( function() {
  13384. var fragment = document.createDocumentFragment(),
  13385. div = fragment.appendChild( document.createElement( "div" ) ),
  13386. input = document.createElement( "input" );
  13387. // Support: Android 4.0 - 4.3 only
  13388. // Check state lost if the name is set (#11217)
  13389. // Support: Windows Web Apps (WWA)
  13390. // `name` and `type` must use .setAttribute for WWA (#14901)
  13391. input.setAttribute( "type", "radio" );
  13392. input.setAttribute( "checked", "checked" );
  13393. input.setAttribute( "name", "t" );
  13394. div.appendChild( input );
  13395. // Support: Android <=4.1 only
  13396. // Older WebKit doesn't clone checked state correctly in fragments
  13397. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13398. // Support: IE <=11 only
  13399. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13400. div.innerHTML = "<textarea>x</textarea>";
  13401. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13402. } )();
  13403. var
  13404. rkeyEvent = /^key/,
  13405. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13406. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13407. function returnTrue() {
  13408. return true;
  13409. }
  13410. function returnFalse() {
  13411. return false;
  13412. }
  13413. // Support: IE <=9 - 11+
  13414. // focus() and blur() are asynchronous, except when they are no-op.
  13415. // So expect focus to be synchronous when the element is already active,
  13416. // and blur to be synchronous when the element is not already active.
  13417. // (focus and blur are always synchronous in other supported browsers,
  13418. // this just defines when we can count on it).
  13419. function expectSync( elem, type ) {
  13420. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13421. }
  13422. // Support: IE <=9 only
  13423. // Accessing document.activeElement can throw unexpectedly
  13424. // https://bugs.jquery.com/ticket/13393
  13425. function safeActiveElement() {
  13426. try {
  13427. return document.activeElement;
  13428. } catch ( err ) { }
  13429. }
  13430. function on( elem, types, selector, data, fn, one ) {
  13431. var origFn, type;
  13432. // Types can be a map of types/handlers
  13433. if ( typeof types === "object" ) {
  13434. // ( types-Object, selector, data )
  13435. if ( typeof selector !== "string" ) {
  13436. // ( types-Object, data )
  13437. data = data || selector;
  13438. selector = undefined;
  13439. }
  13440. for ( type in types ) {
  13441. on( elem, type, selector, data, types[ type ], one );
  13442. }
  13443. return elem;
  13444. }
  13445. if ( data == null && fn == null ) {
  13446. // ( types, fn )
  13447. fn = selector;
  13448. data = selector = undefined;
  13449. } else if ( fn == null ) {
  13450. if ( typeof selector === "string" ) {
  13451. // ( types, selector, fn )
  13452. fn = data;
  13453. data = undefined;
  13454. } else {
  13455. // ( types, data, fn )
  13456. fn = data;
  13457. data = selector;
  13458. selector = undefined;
  13459. }
  13460. }
  13461. if ( fn === false ) {
  13462. fn = returnFalse;
  13463. } else if ( !fn ) {
  13464. return elem;
  13465. }
  13466. if ( one === 1 ) {
  13467. origFn = fn;
  13468. fn = function( event ) {
  13469. // Can use an empty set, since event contains the info
  13470. jQuery().off( event );
  13471. return origFn.apply( this, arguments );
  13472. };
  13473. // Use same guid so caller can remove using origFn
  13474. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13475. }
  13476. return elem.each( function() {
  13477. jQuery.event.add( this, types, fn, data, selector );
  13478. } );
  13479. }
  13480. /*
  13481. * Helper functions for managing events -- not part of the public interface.
  13482. * Props to Dean Edwards' addEvent library for many of the ideas.
  13483. */
  13484. jQuery.event = {
  13485. global: {},
  13486. add: function( elem, types, handler, data, selector ) {
  13487. var handleObjIn, eventHandle, tmp,
  13488. events, t, handleObj,
  13489. special, handlers, type, namespaces, origType,
  13490. elemData = dataPriv.get( elem );
  13491. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13492. if ( !elemData ) {
  13493. return;
  13494. }
  13495. // Caller can pass in an object of custom data in lieu of the handler
  13496. if ( handler.handler ) {
  13497. handleObjIn = handler;
  13498. handler = handleObjIn.handler;
  13499. selector = handleObjIn.selector;
  13500. }
  13501. // Ensure that invalid selectors throw exceptions at attach time
  13502. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13503. if ( selector ) {
  13504. jQuery.find.matchesSelector( documentElement, selector );
  13505. }
  13506. // Make sure that the handler has a unique ID, used to find/remove it later
  13507. if ( !handler.guid ) {
  13508. handler.guid = jQuery.guid++;
  13509. }
  13510. // Init the element's event structure and main handler, if this is the first
  13511. if ( !( events = elemData.events ) ) {
  13512. events = elemData.events = {};
  13513. }
  13514. if ( !( eventHandle = elemData.handle ) ) {
  13515. eventHandle = elemData.handle = function( e ) {
  13516. // Discard the second event of a jQuery.event.trigger() and
  13517. // when an event is called after a page has unloaded
  13518. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13519. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13520. };
  13521. }
  13522. // Handle multiple events separated by a space
  13523. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13524. t = types.length;
  13525. while ( t-- ) {
  13526. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13527. type = origType = tmp[ 1 ];
  13528. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13529. // There *must* be a type, no attaching namespace-only handlers
  13530. if ( !type ) {
  13531. continue;
  13532. }
  13533. // If event changes its type, use the special event handlers for the changed type
  13534. special = jQuery.event.special[ type ] || {};
  13535. // If selector defined, determine special event api type, otherwise given type
  13536. type = ( selector ? special.delegateType : special.bindType ) || type;
  13537. // Update special based on newly reset type
  13538. special = jQuery.event.special[ type ] || {};
  13539. // handleObj is passed to all event handlers
  13540. handleObj = jQuery.extend( {
  13541. type: type,
  13542. origType: origType,
  13543. data: data,
  13544. handler: handler,
  13545. guid: handler.guid,
  13546. selector: selector,
  13547. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13548. namespace: namespaces.join( "." )
  13549. }, handleObjIn );
  13550. // Init the event handler queue if we're the first
  13551. if ( !( handlers = events[ type ] ) ) {
  13552. handlers = events[ type ] = [];
  13553. handlers.delegateCount = 0;
  13554. // Only use addEventListener if the special events handler returns false
  13555. if ( !special.setup ||
  13556. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13557. if ( elem.addEventListener ) {
  13558. elem.addEventListener( type, eventHandle );
  13559. }
  13560. }
  13561. }
  13562. if ( special.add ) {
  13563. special.add.call( elem, handleObj );
  13564. if ( !handleObj.handler.guid ) {
  13565. handleObj.handler.guid = handler.guid;
  13566. }
  13567. }
  13568. // Add to the element's handler list, delegates in front
  13569. if ( selector ) {
  13570. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13571. } else {
  13572. handlers.push( handleObj );
  13573. }
  13574. // Keep track of which events have ever been used, for event optimization
  13575. jQuery.event.global[ type ] = true;
  13576. }
  13577. },
  13578. // Detach an event or set of events from an element
  13579. remove: function( elem, types, handler, selector, mappedTypes ) {
  13580. var j, origCount, tmp,
  13581. events, t, handleObj,
  13582. special, handlers, type, namespaces, origType,
  13583. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13584. if ( !elemData || !( events = elemData.events ) ) {
  13585. return;
  13586. }
  13587. // Once for each type.namespace in types; type may be omitted
  13588. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13589. t = types.length;
  13590. while ( t-- ) {
  13591. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13592. type = origType = tmp[ 1 ];
  13593. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13594. // Unbind all events (on this namespace, if provided) for the element
  13595. if ( !type ) {
  13596. for ( type in events ) {
  13597. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13598. }
  13599. continue;
  13600. }
  13601. special = jQuery.event.special[ type ] || {};
  13602. type = ( selector ? special.delegateType : special.bindType ) || type;
  13603. handlers = events[ type ] || [];
  13604. tmp = tmp[ 2 ] &&
  13605. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13606. // Remove matching events
  13607. origCount = j = handlers.length;
  13608. while ( j-- ) {
  13609. handleObj = handlers[ j ];
  13610. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13611. ( !handler || handler.guid === handleObj.guid ) &&
  13612. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13613. ( !selector || selector === handleObj.selector ||
  13614. selector === "**" && handleObj.selector ) ) {
  13615. handlers.splice( j, 1 );
  13616. if ( handleObj.selector ) {
  13617. handlers.delegateCount--;
  13618. }
  13619. if ( special.remove ) {
  13620. special.remove.call( elem, handleObj );
  13621. }
  13622. }
  13623. }
  13624. // Remove generic event handler if we removed something and no more handlers exist
  13625. // (avoids potential for endless recursion during removal of special event handlers)
  13626. if ( origCount && !handlers.length ) {
  13627. if ( !special.teardown ||
  13628. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13629. jQuery.removeEvent( elem, type, elemData.handle );
  13630. }
  13631. delete events[ type ];
  13632. }
  13633. }
  13634. // Remove data and the expando if it's no longer used
  13635. if ( jQuery.isEmptyObject( events ) ) {
  13636. dataPriv.remove( elem, "handle events" );
  13637. }
  13638. },
  13639. dispatch: function( nativeEvent ) {
  13640. // Make a writable jQuery.Event from the native event object
  13641. var event = jQuery.event.fix( nativeEvent );
  13642. var i, j, ret, matched, handleObj, handlerQueue,
  13643. args = new Array( arguments.length ),
  13644. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13645. special = jQuery.event.special[ event.type ] || {};
  13646. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13647. args[ 0 ] = event;
  13648. for ( i = 1; i < arguments.length; i++ ) {
  13649. args[ i ] = arguments[ i ];
  13650. }
  13651. event.delegateTarget = this;
  13652. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13653. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13654. return;
  13655. }
  13656. // Determine handlers
  13657. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13658. // Run delegates first; they may want to stop propagation beneath us
  13659. i = 0;
  13660. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13661. event.currentTarget = matched.elem;
  13662. j = 0;
  13663. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13664. !event.isImmediatePropagationStopped() ) {
  13665. // If the event is namespaced, then each handler is only invoked if it is
  13666. // specially universal or its namespaces are a superset of the event's.
  13667. if ( !event.rnamespace || handleObj.namespace === false ||
  13668. event.rnamespace.test( handleObj.namespace ) ) {
  13669. event.handleObj = handleObj;
  13670. event.data = handleObj.data;
  13671. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13672. handleObj.handler ).apply( matched.elem, args );
  13673. if ( ret !== undefined ) {
  13674. if ( ( event.result = ret ) === false ) {
  13675. event.preventDefault();
  13676. event.stopPropagation();
  13677. }
  13678. }
  13679. }
  13680. }
  13681. }
  13682. // Call the postDispatch hook for the mapped type
  13683. if ( special.postDispatch ) {
  13684. special.postDispatch.call( this, event );
  13685. }
  13686. return event.result;
  13687. },
  13688. handlers: function( event, handlers ) {
  13689. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13690. handlerQueue = [],
  13691. delegateCount = handlers.delegateCount,
  13692. cur = event.target;
  13693. // Find delegate handlers
  13694. if ( delegateCount &&
  13695. // Support: IE <=9
  13696. // Black-hole SVG <use> instance trees (trac-13180)
  13697. cur.nodeType &&
  13698. // Support: Firefox <=42
  13699. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13700. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13701. // Support: IE 11 only
  13702. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13703. !( event.type === "click" && event.button >= 1 ) ) {
  13704. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13705. // Don't check non-elements (#13208)
  13706. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13707. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13708. matchedHandlers = [];
  13709. matchedSelectors = {};
  13710. for ( i = 0; i < delegateCount; i++ ) {
  13711. handleObj = handlers[ i ];
  13712. // Don't conflict with Object.prototype properties (#13203)
  13713. sel = handleObj.selector + " ";
  13714. if ( matchedSelectors[ sel ] === undefined ) {
  13715. matchedSelectors[ sel ] = handleObj.needsContext ?
  13716. jQuery( sel, this ).index( cur ) > -1 :
  13717. jQuery.find( sel, this, null, [ cur ] ).length;
  13718. }
  13719. if ( matchedSelectors[ sel ] ) {
  13720. matchedHandlers.push( handleObj );
  13721. }
  13722. }
  13723. if ( matchedHandlers.length ) {
  13724. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13725. }
  13726. }
  13727. }
  13728. }
  13729. // Add the remaining (directly-bound) handlers
  13730. cur = this;
  13731. if ( delegateCount < handlers.length ) {
  13732. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13733. }
  13734. return handlerQueue;
  13735. },
  13736. addProp: function( name, hook ) {
  13737. Object.defineProperty( jQuery.Event.prototype, name, {
  13738. enumerable: true,
  13739. configurable: true,
  13740. get: isFunction( hook ) ?
  13741. function() {
  13742. if ( this.originalEvent ) {
  13743. return hook( this.originalEvent );
  13744. }
  13745. } :
  13746. function() {
  13747. if ( this.originalEvent ) {
  13748. return this.originalEvent[ name ];
  13749. }
  13750. },
  13751. set: function( value ) {
  13752. Object.defineProperty( this, name, {
  13753. enumerable: true,
  13754. configurable: true,
  13755. writable: true,
  13756. value: value
  13757. } );
  13758. }
  13759. } );
  13760. },
  13761. fix: function( originalEvent ) {
  13762. return originalEvent[ jQuery.expando ] ?
  13763. originalEvent :
  13764. new jQuery.Event( originalEvent );
  13765. },
  13766. special: {
  13767. load: {
  13768. // Prevent triggered image.load events from bubbling to window.load
  13769. noBubble: true
  13770. },
  13771. click: {
  13772. // Utilize native event to ensure correct state for checkable inputs
  13773. setup: function( data ) {
  13774. // For mutual compressibility with _default, replace `this` access with a local var.
  13775. // `|| data` is dead code meant only to preserve the variable through minification.
  13776. var el = this || data;
  13777. // Claim the first handler
  13778. if ( rcheckableType.test( el.type ) &&
  13779. el.click && nodeName( el, "input" ) ) {
  13780. // dataPriv.set( el, "click", ... )
  13781. leverageNative( el, "click", returnTrue );
  13782. }
  13783. // Return false to allow normal processing in the caller
  13784. return false;
  13785. },
  13786. trigger: function( data ) {
  13787. // For mutual compressibility with _default, replace `this` access with a local var.
  13788. // `|| data` is dead code meant only to preserve the variable through minification.
  13789. var el = this || data;
  13790. // Force setup before triggering a click
  13791. if ( rcheckableType.test( el.type ) &&
  13792. el.click && nodeName( el, "input" ) ) {
  13793. leverageNative( el, "click" );
  13794. }
  13795. // Return non-false to allow normal event-path propagation
  13796. return true;
  13797. },
  13798. // For cross-browser consistency, suppress native .click() on links
  13799. // Also prevent it if we're currently inside a leveraged native-event stack
  13800. _default: function( event ) {
  13801. var target = event.target;
  13802. return rcheckableType.test( target.type ) &&
  13803. target.click && nodeName( target, "input" ) &&
  13804. dataPriv.get( target, "click" ) ||
  13805. nodeName( target, "a" );
  13806. }
  13807. },
  13808. beforeunload: {
  13809. postDispatch: function( event ) {
  13810. // Support: Firefox 20+
  13811. // Firefox doesn't alert if the returnValue field is not set.
  13812. if ( event.result !== undefined && event.originalEvent ) {
  13813. event.originalEvent.returnValue = event.result;
  13814. }
  13815. }
  13816. }
  13817. }
  13818. };
  13819. // Ensure the presence of an event listener that handles manually-triggered
  13820. // synthetic events by interrupting progress until reinvoked in response to
  13821. // *native* events that it fires directly, ensuring that state changes have
  13822. // already occurred before other listeners are invoked.
  13823. function leverageNative( el, type, expectSync ) {
  13824. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13825. if ( !expectSync ) {
  13826. if ( dataPriv.get( el, type ) === undefined ) {
  13827. jQuery.event.add( el, type, returnTrue );
  13828. }
  13829. return;
  13830. }
  13831. // Register the controller as a special universal handler for all event namespaces
  13832. dataPriv.set( el, type, false );
  13833. jQuery.event.add( el, type, {
  13834. namespace: false,
  13835. handler: function( event ) {
  13836. var notAsync, result,
  13837. saved = dataPriv.get( this, type );
  13838. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13839. // Interrupt processing of the outer synthetic .trigger()ed event
  13840. // Saved data should be false in such cases, but might be a leftover capture object
  13841. // from an async native handler (gh-4350)
  13842. if ( !saved.length ) {
  13843. // Store arguments for use when handling the inner native event
  13844. // There will always be at least one argument (an event object), so this array
  13845. // will not be confused with a leftover capture object.
  13846. saved = slice.call( arguments );
  13847. dataPriv.set( this, type, saved );
  13848. // Trigger the native event and capture its result
  13849. // Support: IE <=9 - 11+
  13850. // focus() and blur() are asynchronous
  13851. notAsync = expectSync( this, type );
  13852. this[ type ]();
  13853. result = dataPriv.get( this, type );
  13854. if ( saved !== result || notAsync ) {
  13855. dataPriv.set( this, type, false );
  13856. } else {
  13857. result = {};
  13858. }
  13859. if ( saved !== result ) {
  13860. // Cancel the outer synthetic event
  13861. event.stopImmediatePropagation();
  13862. event.preventDefault();
  13863. return result.value;
  13864. }
  13865. // If this is an inner synthetic event for an event with a bubbling surrogate
  13866. // (focus or blur), assume that the surrogate already propagated from triggering the
  13867. // native event and prevent that from happening again here.
  13868. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13869. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13870. // less bad than duplication.
  13871. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13872. event.stopPropagation();
  13873. }
  13874. // If this is a native event triggered above, everything is now in order
  13875. // Fire an inner synthetic event with the original arguments
  13876. } else if ( saved.length ) {
  13877. // ...and capture the result
  13878. dataPriv.set( this, type, {
  13879. value: jQuery.event.trigger(
  13880. // Support: IE <=9 - 11+
  13881. // Extend with the prototype to reset the above stopImmediatePropagation()
  13882. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13883. saved.slice( 1 ),
  13884. this
  13885. )
  13886. } );
  13887. // Abort handling of the native event
  13888. event.stopImmediatePropagation();
  13889. }
  13890. }
  13891. } );
  13892. }
  13893. jQuery.removeEvent = function( elem, type, handle ) {
  13894. // This "if" is needed for plain objects
  13895. if ( elem.removeEventListener ) {
  13896. elem.removeEventListener( type, handle );
  13897. }
  13898. };
  13899. jQuery.Event = function( src, props ) {
  13900. // Allow instantiation without the 'new' keyword
  13901. if ( !( this instanceof jQuery.Event ) ) {
  13902. return new jQuery.Event( src, props );
  13903. }
  13904. // Event object
  13905. if ( src && src.type ) {
  13906. this.originalEvent = src;
  13907. this.type = src.type;
  13908. // Events bubbling up the document may have been marked as prevented
  13909. // by a handler lower down the tree; reflect the correct value.
  13910. this.isDefaultPrevented = src.defaultPrevented ||
  13911. src.defaultPrevented === undefined &&
  13912. // Support: Android <=2.3 only
  13913. src.returnValue === false ?
  13914. returnTrue :
  13915. returnFalse;
  13916. // Create target properties
  13917. // Support: Safari <=6 - 7 only
  13918. // Target should not be a text node (#504, #13143)
  13919. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13920. src.target.parentNode :
  13921. src.target;
  13922. this.currentTarget = src.currentTarget;
  13923. this.relatedTarget = src.relatedTarget;
  13924. // Event type
  13925. } else {
  13926. this.type = src;
  13927. }
  13928. // Put explicitly provided properties onto the event object
  13929. if ( props ) {
  13930. jQuery.extend( this, props );
  13931. }
  13932. // Create a timestamp if incoming event doesn't have one
  13933. this.timeStamp = src && src.timeStamp || Date.now();
  13934. // Mark it as fixed
  13935. this[ jQuery.expando ] = true;
  13936. };
  13937. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13938. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13939. jQuery.Event.prototype = {
  13940. constructor: jQuery.Event,
  13941. isDefaultPrevented: returnFalse,
  13942. isPropagationStopped: returnFalse,
  13943. isImmediatePropagationStopped: returnFalse,
  13944. isSimulated: false,
  13945. preventDefault: function() {
  13946. var e = this.originalEvent;
  13947. this.isDefaultPrevented = returnTrue;
  13948. if ( e && !this.isSimulated ) {
  13949. e.preventDefault();
  13950. }
  13951. },
  13952. stopPropagation: function() {
  13953. var e = this.originalEvent;
  13954. this.isPropagationStopped = returnTrue;
  13955. if ( e && !this.isSimulated ) {
  13956. e.stopPropagation();
  13957. }
  13958. },
  13959. stopImmediatePropagation: function() {
  13960. var e = this.originalEvent;
  13961. this.isImmediatePropagationStopped = returnTrue;
  13962. if ( e && !this.isSimulated ) {
  13963. e.stopImmediatePropagation();
  13964. }
  13965. this.stopPropagation();
  13966. }
  13967. };
  13968. // Includes all common event props including KeyEvent and MouseEvent specific props
  13969. jQuery.each( {
  13970. altKey: true,
  13971. bubbles: true,
  13972. cancelable: true,
  13973. changedTouches: true,
  13974. ctrlKey: true,
  13975. detail: true,
  13976. eventPhase: true,
  13977. metaKey: true,
  13978. pageX: true,
  13979. pageY: true,
  13980. shiftKey: true,
  13981. view: true,
  13982. "char": true,
  13983. code: true,
  13984. charCode: true,
  13985. key: true,
  13986. keyCode: true,
  13987. button: true,
  13988. buttons: true,
  13989. clientX: true,
  13990. clientY: true,
  13991. offsetX: true,
  13992. offsetY: true,
  13993. pointerId: true,
  13994. pointerType: true,
  13995. screenX: true,
  13996. screenY: true,
  13997. targetTouches: true,
  13998. toElement: true,
  13999. touches: true,
  14000. which: function( event ) {
  14001. var button = event.button;
  14002. // Add which for key events
  14003. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14004. return event.charCode != null ? event.charCode : event.keyCode;
  14005. }
  14006. // Add which for click: 1 === left; 2 === middle; 3 === right
  14007. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14008. if ( button & 1 ) {
  14009. return 1;
  14010. }
  14011. if ( button & 2 ) {
  14012. return 3;
  14013. }
  14014. if ( button & 4 ) {
  14015. return 2;
  14016. }
  14017. return 0;
  14018. }
  14019. return event.which;
  14020. }
  14021. }, jQuery.event.addProp );
  14022. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14023. jQuery.event.special[ type ] = {
  14024. // Utilize native event if possible so blur/focus sequence is correct
  14025. setup: function() {
  14026. // Claim the first handler
  14027. // dataPriv.set( this, "focus", ... )
  14028. // dataPriv.set( this, "blur", ... )
  14029. leverageNative( this, type, expectSync );
  14030. // Return false to allow normal processing in the caller
  14031. return false;
  14032. },
  14033. trigger: function() {
  14034. // Force setup before trigger
  14035. leverageNative( this, type );
  14036. // Return non-false to allow normal event-path propagation
  14037. return true;
  14038. },
  14039. delegateType: delegateType
  14040. };
  14041. } );
  14042. // Create mouseenter/leave events using mouseover/out and event-time checks
  14043. // so that event delegation works in jQuery.
  14044. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14045. //
  14046. // Support: Safari 7 only
  14047. // Safari sends mouseenter too often; see:
  14048. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14049. // for the description of the bug (it existed in older Chrome versions as well).
  14050. jQuery.each( {
  14051. mouseenter: "mouseover",
  14052. mouseleave: "mouseout",
  14053. pointerenter: "pointerover",
  14054. pointerleave: "pointerout"
  14055. }, function( orig, fix ) {
  14056. jQuery.event.special[ orig ] = {
  14057. delegateType: fix,
  14058. bindType: fix,
  14059. handle: function( event ) {
  14060. var ret,
  14061. target = this,
  14062. related = event.relatedTarget,
  14063. handleObj = event.handleObj;
  14064. // For mouseenter/leave call the handler if related is outside the target.
  14065. // NB: No relatedTarget if the mouse left/entered the browser window
  14066. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14067. event.type = handleObj.origType;
  14068. ret = handleObj.handler.apply( this, arguments );
  14069. event.type = fix;
  14070. }
  14071. return ret;
  14072. }
  14073. };
  14074. } );
  14075. jQuery.fn.extend( {
  14076. on: function( types, selector, data, fn ) {
  14077. return on( this, types, selector, data, fn );
  14078. },
  14079. one: function( types, selector, data, fn ) {
  14080. return on( this, types, selector, data, fn, 1 );
  14081. },
  14082. off: function( types, selector, fn ) {
  14083. var handleObj, type;
  14084. if ( types && types.preventDefault && types.handleObj ) {
  14085. // ( event ) dispatched jQuery.Event
  14086. handleObj = types.handleObj;
  14087. jQuery( types.delegateTarget ).off(
  14088. handleObj.namespace ?
  14089. handleObj.origType + "." + handleObj.namespace :
  14090. handleObj.origType,
  14091. handleObj.selector,
  14092. handleObj.handler
  14093. );
  14094. return this;
  14095. }
  14096. if ( typeof types === "object" ) {
  14097. // ( types-object [, selector] )
  14098. for ( type in types ) {
  14099. this.off( type, selector, types[ type ] );
  14100. }
  14101. return this;
  14102. }
  14103. if ( selector === false || typeof selector === "function" ) {
  14104. // ( types [, fn] )
  14105. fn = selector;
  14106. selector = undefined;
  14107. }
  14108. if ( fn === false ) {
  14109. fn = returnFalse;
  14110. }
  14111. return this.each( function() {
  14112. jQuery.event.remove( this, types, fn, selector );
  14113. } );
  14114. }
  14115. } );
  14116. var
  14117. /* eslint-disable max-len */
  14118. // See https://github.com/eslint/eslint/issues/3229
  14119. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14120. /* eslint-enable */
  14121. // Support: IE <=10 - 11, Edge 12 - 13 only
  14122. // In IE/Edge using regex groups here causes severe slowdowns.
  14123. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14124. rnoInnerhtml = /<script|<style|<link/i,
  14125. // checked="checked" or checked
  14126. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14127. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14128. // Prefer a tbody over its parent table for containing new rows
  14129. function manipulationTarget( elem, content ) {
  14130. if ( nodeName( elem, "table" ) &&
  14131. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14132. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14133. }
  14134. return elem;
  14135. }
  14136. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14137. function disableScript( elem ) {
  14138. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14139. return elem;
  14140. }
  14141. function restoreScript( elem ) {
  14142. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14143. elem.type = elem.type.slice( 5 );
  14144. } else {
  14145. elem.removeAttribute( "type" );
  14146. }
  14147. return elem;
  14148. }
  14149. function cloneCopyEvent( src, dest ) {
  14150. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14151. if ( dest.nodeType !== 1 ) {
  14152. return;
  14153. }
  14154. // 1. Copy private data: events, handlers, etc.
  14155. if ( dataPriv.hasData( src ) ) {
  14156. pdataOld = dataPriv.access( src );
  14157. pdataCur = dataPriv.set( dest, pdataOld );
  14158. events = pdataOld.events;
  14159. if ( events ) {
  14160. delete pdataCur.handle;
  14161. pdataCur.events = {};
  14162. for ( type in events ) {
  14163. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14164. jQuery.event.add( dest, type, events[ type ][ i ] );
  14165. }
  14166. }
  14167. }
  14168. }
  14169. // 2. Copy user data
  14170. if ( dataUser.hasData( src ) ) {
  14171. udataOld = dataUser.access( src );
  14172. udataCur = jQuery.extend( {}, udataOld );
  14173. dataUser.set( dest, udataCur );
  14174. }
  14175. }
  14176. // Fix IE bugs, see support tests
  14177. function fixInput( src, dest ) {
  14178. var nodeName = dest.nodeName.toLowerCase();
  14179. // Fails to persist the checked state of a cloned checkbox or radio button.
  14180. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14181. dest.checked = src.checked;
  14182. // Fails to return the selected option to the default selected state when cloning options
  14183. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14184. dest.defaultValue = src.defaultValue;
  14185. }
  14186. }
  14187. function domManip( collection, args, callback, ignored ) {
  14188. // Flatten any nested arrays
  14189. args = concat.apply( [], args );
  14190. var fragment, first, scripts, hasScripts, node, doc,
  14191. i = 0,
  14192. l = collection.length,
  14193. iNoClone = l - 1,
  14194. value = args[ 0 ],
  14195. valueIsFunction = isFunction( value );
  14196. // We can't cloneNode fragments that contain checked, in WebKit
  14197. if ( valueIsFunction ||
  14198. ( l > 1 && typeof value === "string" &&
  14199. !support.checkClone && rchecked.test( value ) ) ) {
  14200. return collection.each( function( index ) {
  14201. var self = collection.eq( index );
  14202. if ( valueIsFunction ) {
  14203. args[ 0 ] = value.call( this, index, self.html() );
  14204. }
  14205. domManip( self, args, callback, ignored );
  14206. } );
  14207. }
  14208. if ( l ) {
  14209. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14210. first = fragment.firstChild;
  14211. if ( fragment.childNodes.length === 1 ) {
  14212. fragment = first;
  14213. }
  14214. // Require either new content or an interest in ignored elements to invoke the callback
  14215. if ( first || ignored ) {
  14216. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14217. hasScripts = scripts.length;
  14218. // Use the original fragment for the last item
  14219. // instead of the first because it can end up
  14220. // being emptied incorrectly in certain situations (#8070).
  14221. for ( ; i < l; i++ ) {
  14222. node = fragment;
  14223. if ( i !== iNoClone ) {
  14224. node = jQuery.clone( node, true, true );
  14225. // Keep references to cloned scripts for later restoration
  14226. if ( hasScripts ) {
  14227. // Support: Android <=4.0 only, PhantomJS 1 only
  14228. // push.apply(_, arraylike) throws on ancient WebKit
  14229. jQuery.merge( scripts, getAll( node, "script" ) );
  14230. }
  14231. }
  14232. callback.call( collection[ i ], node, i );
  14233. }
  14234. if ( hasScripts ) {
  14235. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14236. // Reenable scripts
  14237. jQuery.map( scripts, restoreScript );
  14238. // Evaluate executable scripts on first document insertion
  14239. for ( i = 0; i < hasScripts; i++ ) {
  14240. node = scripts[ i ];
  14241. if ( rscriptType.test( node.type || "" ) &&
  14242. !dataPriv.access( node, "globalEval" ) &&
  14243. jQuery.contains( doc, node ) ) {
  14244. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14245. // Optional AJAX dependency, but won't run scripts if not present
  14246. if ( jQuery._evalUrl && !node.noModule ) {
  14247. jQuery._evalUrl( node.src, {
  14248. nonce: node.nonce || node.getAttribute( "nonce" )
  14249. } );
  14250. }
  14251. } else {
  14252. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14253. }
  14254. }
  14255. }
  14256. }
  14257. }
  14258. }
  14259. return collection;
  14260. }
  14261. function remove( elem, selector, keepData ) {
  14262. var node,
  14263. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14264. i = 0;
  14265. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14266. if ( !keepData && node.nodeType === 1 ) {
  14267. jQuery.cleanData( getAll( node ) );
  14268. }
  14269. if ( node.parentNode ) {
  14270. if ( keepData && isAttached( node ) ) {
  14271. setGlobalEval( getAll( node, "script" ) );
  14272. }
  14273. node.parentNode.removeChild( node );
  14274. }
  14275. }
  14276. return elem;
  14277. }
  14278. jQuery.extend( {
  14279. htmlPrefilter: function( html ) {
  14280. return html.replace( rxhtmlTag, "<$1></$2>" );
  14281. },
  14282. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14283. var i, l, srcElements, destElements,
  14284. clone = elem.cloneNode( true ),
  14285. inPage = isAttached( elem );
  14286. // Fix IE cloning issues
  14287. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14288. !jQuery.isXMLDoc( elem ) ) {
  14289. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14290. destElements = getAll( clone );
  14291. srcElements = getAll( elem );
  14292. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14293. fixInput( srcElements[ i ], destElements[ i ] );
  14294. }
  14295. }
  14296. // Copy the events from the original to the clone
  14297. if ( dataAndEvents ) {
  14298. if ( deepDataAndEvents ) {
  14299. srcElements = srcElements || getAll( elem );
  14300. destElements = destElements || getAll( clone );
  14301. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14302. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14303. }
  14304. } else {
  14305. cloneCopyEvent( elem, clone );
  14306. }
  14307. }
  14308. // Preserve script evaluation history
  14309. destElements = getAll( clone, "script" );
  14310. if ( destElements.length > 0 ) {
  14311. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14312. }
  14313. // Return the cloned set
  14314. return clone;
  14315. },
  14316. cleanData: function( elems ) {
  14317. var data, elem, type,
  14318. special = jQuery.event.special,
  14319. i = 0;
  14320. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14321. if ( acceptData( elem ) ) {
  14322. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14323. if ( data.events ) {
  14324. for ( type in data.events ) {
  14325. if ( special[ type ] ) {
  14326. jQuery.event.remove( elem, type );
  14327. // This is a shortcut to avoid jQuery.event.remove's overhead
  14328. } else {
  14329. jQuery.removeEvent( elem, type, data.handle );
  14330. }
  14331. }
  14332. }
  14333. // Support: Chrome <=35 - 45+
  14334. // Assign undefined instead of using delete, see Data#remove
  14335. elem[ dataPriv.expando ] = undefined;
  14336. }
  14337. if ( elem[ dataUser.expando ] ) {
  14338. // Support: Chrome <=35 - 45+
  14339. // Assign undefined instead of using delete, see Data#remove
  14340. elem[ dataUser.expando ] = undefined;
  14341. }
  14342. }
  14343. }
  14344. }
  14345. } );
  14346. jQuery.fn.extend( {
  14347. detach: function( selector ) {
  14348. return remove( this, selector, true );
  14349. },
  14350. remove: function( selector ) {
  14351. return remove( this, selector );
  14352. },
  14353. text: function( value ) {
  14354. return access( this, function( value ) {
  14355. return value === undefined ?
  14356. jQuery.text( this ) :
  14357. this.empty().each( function() {
  14358. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14359. this.textContent = value;
  14360. }
  14361. } );
  14362. }, null, value, arguments.length );
  14363. },
  14364. append: function() {
  14365. return domManip( this, arguments, function( elem ) {
  14366. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14367. var target = manipulationTarget( this, elem );
  14368. target.appendChild( elem );
  14369. }
  14370. } );
  14371. },
  14372. prepend: function() {
  14373. return domManip( this, arguments, function( elem ) {
  14374. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14375. var target = manipulationTarget( this, elem );
  14376. target.insertBefore( elem, target.firstChild );
  14377. }
  14378. } );
  14379. },
  14380. before: function() {
  14381. return domManip( this, arguments, function( elem ) {
  14382. if ( this.parentNode ) {
  14383. this.parentNode.insertBefore( elem, this );
  14384. }
  14385. } );
  14386. },
  14387. after: function() {
  14388. return domManip( this, arguments, function( elem ) {
  14389. if ( this.parentNode ) {
  14390. this.parentNode.insertBefore( elem, this.nextSibling );
  14391. }
  14392. } );
  14393. },
  14394. empty: function() {
  14395. var elem,
  14396. i = 0;
  14397. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14398. if ( elem.nodeType === 1 ) {
  14399. // Prevent memory leaks
  14400. jQuery.cleanData( getAll( elem, false ) );
  14401. // Remove any remaining nodes
  14402. elem.textContent = "";
  14403. }
  14404. }
  14405. return this;
  14406. },
  14407. clone: function( dataAndEvents, deepDataAndEvents ) {
  14408. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14409. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14410. return this.map( function() {
  14411. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14412. } );
  14413. },
  14414. html: function( value ) {
  14415. return access( this, function( value ) {
  14416. var elem = this[ 0 ] || {},
  14417. i = 0,
  14418. l = this.length;
  14419. if ( value === undefined && elem.nodeType === 1 ) {
  14420. return elem.innerHTML;
  14421. }
  14422. // See if we can take a shortcut and just use innerHTML
  14423. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14424. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14425. value = jQuery.htmlPrefilter( value );
  14426. try {
  14427. for ( ; i < l; i++ ) {
  14428. elem = this[ i ] || {};
  14429. // Remove element nodes and prevent memory leaks
  14430. if ( elem.nodeType === 1 ) {
  14431. jQuery.cleanData( getAll( elem, false ) );
  14432. elem.innerHTML = value;
  14433. }
  14434. }
  14435. elem = 0;
  14436. // If using innerHTML throws an exception, use the fallback method
  14437. } catch ( e ) {}
  14438. }
  14439. if ( elem ) {
  14440. this.empty().append( value );
  14441. }
  14442. }, null, value, arguments.length );
  14443. },
  14444. replaceWith: function() {
  14445. var ignored = [];
  14446. // Make the changes, replacing each non-ignored context element with the new content
  14447. return domManip( this, arguments, function( elem ) {
  14448. var parent = this.parentNode;
  14449. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14450. jQuery.cleanData( getAll( this ) );
  14451. if ( parent ) {
  14452. parent.replaceChild( elem, this );
  14453. }
  14454. }
  14455. // Force callback invocation
  14456. }, ignored );
  14457. }
  14458. } );
  14459. jQuery.each( {
  14460. appendTo: "append",
  14461. prependTo: "prepend",
  14462. insertBefore: "before",
  14463. insertAfter: "after",
  14464. replaceAll: "replaceWith"
  14465. }, function( name, original ) {
  14466. jQuery.fn[ name ] = function( selector ) {
  14467. var elems,
  14468. ret = [],
  14469. insert = jQuery( selector ),
  14470. last = insert.length - 1,
  14471. i = 0;
  14472. for ( ; i <= last; i++ ) {
  14473. elems = i === last ? this : this.clone( true );
  14474. jQuery( insert[ i ] )[ original ]( elems );
  14475. // Support: Android <=4.0 only, PhantomJS 1 only
  14476. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14477. push.apply( ret, elems.get() );
  14478. }
  14479. return this.pushStack( ret );
  14480. };
  14481. } );
  14482. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14483. var getStyles = function( elem ) {
  14484. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14485. // IE throws on elements created in popups
  14486. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14487. var view = elem.ownerDocument.defaultView;
  14488. if ( !view || !view.opener ) {
  14489. view = window;
  14490. }
  14491. return view.getComputedStyle( elem );
  14492. };
  14493. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14494. ( function() {
  14495. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14496. // so they're executed at the same time to save the second computation.
  14497. function computeStyleTests() {
  14498. // This is a singleton, we need to execute it only once
  14499. if ( !div ) {
  14500. return;
  14501. }
  14502. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14503. "margin-top:1px;padding:0;border:0";
  14504. div.style.cssText =
  14505. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14506. "margin:auto;border:1px;padding:1px;" +
  14507. "width:60%;top:1%";
  14508. documentElement.appendChild( container ).appendChild( div );
  14509. var divStyle = window.getComputedStyle( div );
  14510. pixelPositionVal = divStyle.top !== "1%";
  14511. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14512. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14513. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14514. // Some styles come back with percentage values, even though they shouldn't
  14515. div.style.right = "60%";
  14516. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14517. // Support: IE 9 - 11 only
  14518. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14519. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14520. // Support: IE 9 only
  14521. // Detect overflow:scroll screwiness (gh-3699)
  14522. // Support: Chrome <=64
  14523. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14524. div.style.position = "absolute";
  14525. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14526. documentElement.removeChild( container );
  14527. // Nullify the div so it wouldn't be stored in the memory and
  14528. // it will also be a sign that checks already performed
  14529. div = null;
  14530. }
  14531. function roundPixelMeasures( measure ) {
  14532. return Math.round( parseFloat( measure ) );
  14533. }
  14534. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14535. reliableMarginLeftVal,
  14536. container = document.createElement( "div" ),
  14537. div = document.createElement( "div" );
  14538. // Finish early in limited (non-browser) environments
  14539. if ( !div.style ) {
  14540. return;
  14541. }
  14542. // Support: IE <=9 - 11 only
  14543. // Style of cloned element affects source element cloned (#8908)
  14544. div.style.backgroundClip = "content-box";
  14545. div.cloneNode( true ).style.backgroundClip = "";
  14546. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14547. jQuery.extend( support, {
  14548. boxSizingReliable: function() {
  14549. computeStyleTests();
  14550. return boxSizingReliableVal;
  14551. },
  14552. pixelBoxStyles: function() {
  14553. computeStyleTests();
  14554. return pixelBoxStylesVal;
  14555. },
  14556. pixelPosition: function() {
  14557. computeStyleTests();
  14558. return pixelPositionVal;
  14559. },
  14560. reliableMarginLeft: function() {
  14561. computeStyleTests();
  14562. return reliableMarginLeftVal;
  14563. },
  14564. scrollboxSize: function() {
  14565. computeStyleTests();
  14566. return scrollboxSizeVal;
  14567. }
  14568. } );
  14569. } )();
  14570. function curCSS( elem, name, computed ) {
  14571. var width, minWidth, maxWidth, ret,
  14572. // Support: Firefox 51+
  14573. // Retrieving style before computed somehow
  14574. // fixes an issue with getting wrong values
  14575. // on detached elements
  14576. style = elem.style;
  14577. computed = computed || getStyles( elem );
  14578. // getPropertyValue is needed for:
  14579. // .css('filter') (IE 9 only, #12537)
  14580. // .css('--customProperty) (#3144)
  14581. if ( computed ) {
  14582. ret = computed.getPropertyValue( name ) || computed[ name ];
  14583. if ( ret === "" && !isAttached( elem ) ) {
  14584. ret = jQuery.style( elem, name );
  14585. }
  14586. // A tribute to the "awesome hack by Dean Edwards"
  14587. // Android Browser returns percentage for some values,
  14588. // but width seems to be reliably pixels.
  14589. // This is against the CSSOM draft spec:
  14590. // https://drafts.csswg.org/cssom/#resolved-values
  14591. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14592. // Remember the original values
  14593. width = style.width;
  14594. minWidth = style.minWidth;
  14595. maxWidth = style.maxWidth;
  14596. // Put in the new values to get a computed value out
  14597. style.minWidth = style.maxWidth = style.width = ret;
  14598. ret = computed.width;
  14599. // Revert the changed values
  14600. style.width = width;
  14601. style.minWidth = minWidth;
  14602. style.maxWidth = maxWidth;
  14603. }
  14604. }
  14605. return ret !== undefined ?
  14606. // Support: IE <=9 - 11 only
  14607. // IE returns zIndex value as an integer.
  14608. ret + "" :
  14609. ret;
  14610. }
  14611. function addGetHookIf( conditionFn, hookFn ) {
  14612. // Define the hook, we'll check on the first run if it's really needed.
  14613. return {
  14614. get: function() {
  14615. if ( conditionFn() ) {
  14616. // Hook not needed (or it's not possible to use it due
  14617. // to missing dependency), remove it.
  14618. delete this.get;
  14619. return;
  14620. }
  14621. // Hook needed; redefine it so that the support test is not executed again.
  14622. return ( this.get = hookFn ).apply( this, arguments );
  14623. }
  14624. };
  14625. }
  14626. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14627. emptyStyle = document.createElement( "div" ).style,
  14628. vendorProps = {};
  14629. // Return a vendor-prefixed property or undefined
  14630. function vendorPropName( name ) {
  14631. // Check for vendor prefixed names
  14632. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14633. i = cssPrefixes.length;
  14634. while ( i-- ) {
  14635. name = cssPrefixes[ i ] + capName;
  14636. if ( name in emptyStyle ) {
  14637. return name;
  14638. }
  14639. }
  14640. }
  14641. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14642. function finalPropName( name ) {
  14643. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14644. if ( final ) {
  14645. return final;
  14646. }
  14647. if ( name in emptyStyle ) {
  14648. return name;
  14649. }
  14650. return vendorProps[ name ] = vendorPropName( name ) || name;
  14651. }
  14652. var
  14653. // Swappable if display is none or starts with table
  14654. // except "table", "table-cell", or "table-caption"
  14655. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14656. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14657. rcustomProp = /^--/,
  14658. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14659. cssNormalTransform = {
  14660. letterSpacing: "0",
  14661. fontWeight: "400"
  14662. };
  14663. function setPositiveNumber( elem, value, subtract ) {
  14664. // Any relative (+/-) values have already been
  14665. // normalized at this point
  14666. var matches = rcssNum.exec( value );
  14667. return matches ?
  14668. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14669. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14670. value;
  14671. }
  14672. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14673. var i = dimension === "width" ? 1 : 0,
  14674. extra = 0,
  14675. delta = 0;
  14676. // Adjustment may not be necessary
  14677. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14678. return 0;
  14679. }
  14680. for ( ; i < 4; i += 2 ) {
  14681. // Both box models exclude margin
  14682. if ( box === "margin" ) {
  14683. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14684. }
  14685. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14686. if ( !isBorderBox ) {
  14687. // Add padding
  14688. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14689. // For "border" or "margin", add border
  14690. if ( box !== "padding" ) {
  14691. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14692. // But still keep track of it otherwise
  14693. } else {
  14694. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14695. }
  14696. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14697. // "padding" or "margin"
  14698. } else {
  14699. // For "content", subtract padding
  14700. if ( box === "content" ) {
  14701. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14702. }
  14703. // For "content" or "padding", subtract border
  14704. if ( box !== "margin" ) {
  14705. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14706. }
  14707. }
  14708. }
  14709. // Account for positive content-box scroll gutter when requested by providing computedVal
  14710. if ( !isBorderBox && computedVal >= 0 ) {
  14711. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14712. // Assuming integer scroll gutter, subtract the rest and round down
  14713. delta += Math.max( 0, Math.ceil(
  14714. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14715. computedVal -
  14716. delta -
  14717. extra -
  14718. 0.5
  14719. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14720. // Use an explicit zero to avoid NaN (gh-3964)
  14721. ) ) || 0;
  14722. }
  14723. return delta;
  14724. }
  14725. function getWidthOrHeight( elem, dimension, extra ) {
  14726. // Start with computed style
  14727. var styles = getStyles( elem ),
  14728. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14729. // Fake content-box until we know it's needed to know the true value.
  14730. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14731. isBorderBox = boxSizingNeeded &&
  14732. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14733. valueIsBorderBox = isBorderBox,
  14734. val = curCSS( elem, dimension, styles ),
  14735. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14736. // Support: Firefox <=54
  14737. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14738. if ( rnumnonpx.test( val ) ) {
  14739. if ( !extra ) {
  14740. return val;
  14741. }
  14742. val = "auto";
  14743. }
  14744. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14745. // This happens for inline elements with no explicit setting (gh-3571)
  14746. // Support: Android <=4.1 - 4.3 only
  14747. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14748. // Support: IE 9-11 only
  14749. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14750. // We use getClientRects() to check for hidden/disconnected.
  14751. // In those cases, the computed value can be trusted to be border-box
  14752. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14753. val === "auto" ||
  14754. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14755. elem.getClientRects().length ) {
  14756. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14757. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14758. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14759. // retrieved value as a content box dimension.
  14760. valueIsBorderBox = offsetProp in elem;
  14761. if ( valueIsBorderBox ) {
  14762. val = elem[ offsetProp ];
  14763. }
  14764. }
  14765. // Normalize "" and auto
  14766. val = parseFloat( val ) || 0;
  14767. // Adjust for the element's box model
  14768. return ( val +
  14769. boxModelAdjustment(
  14770. elem,
  14771. dimension,
  14772. extra || ( isBorderBox ? "border" : "content" ),
  14773. valueIsBorderBox,
  14774. styles,
  14775. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14776. val
  14777. )
  14778. ) + "px";
  14779. }
  14780. jQuery.extend( {
  14781. // Add in style property hooks for overriding the default
  14782. // behavior of getting and setting a style property
  14783. cssHooks: {
  14784. opacity: {
  14785. get: function( elem, computed ) {
  14786. if ( computed ) {
  14787. // We should always get a number back from opacity
  14788. var ret = curCSS( elem, "opacity" );
  14789. return ret === "" ? "1" : ret;
  14790. }
  14791. }
  14792. }
  14793. },
  14794. // Don't automatically add "px" to these possibly-unitless properties
  14795. cssNumber: {
  14796. "animationIterationCount": true,
  14797. "columnCount": true,
  14798. "fillOpacity": true,
  14799. "flexGrow": true,
  14800. "flexShrink": true,
  14801. "fontWeight": true,
  14802. "gridArea": true,
  14803. "gridColumn": true,
  14804. "gridColumnEnd": true,
  14805. "gridColumnStart": true,
  14806. "gridRow": true,
  14807. "gridRowEnd": true,
  14808. "gridRowStart": true,
  14809. "lineHeight": true,
  14810. "opacity": true,
  14811. "order": true,
  14812. "orphans": true,
  14813. "widows": true,
  14814. "zIndex": true,
  14815. "zoom": true
  14816. },
  14817. // Add in properties whose names you wish to fix before
  14818. // setting or getting the value
  14819. cssProps: {},
  14820. // Get and set the style property on a DOM Node
  14821. style: function( elem, name, value, extra ) {
  14822. // Don't set styles on text and comment nodes
  14823. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14824. return;
  14825. }
  14826. // Make sure that we're working with the right name
  14827. var ret, type, hooks,
  14828. origName = camelCase( name ),
  14829. isCustomProp = rcustomProp.test( name ),
  14830. style = elem.style;
  14831. // Make sure that we're working with the right name. We don't
  14832. // want to query the value if it is a CSS custom property
  14833. // since they are user-defined.
  14834. if ( !isCustomProp ) {
  14835. name = finalPropName( origName );
  14836. }
  14837. // Gets hook for the prefixed version, then unprefixed version
  14838. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14839. // Check if we're setting a value
  14840. if ( value !== undefined ) {
  14841. type = typeof value;
  14842. // Convert "+=" or "-=" to relative numbers (#7345)
  14843. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14844. value = adjustCSS( elem, name, ret );
  14845. // Fixes bug #9237
  14846. type = "number";
  14847. }
  14848. // Make sure that null and NaN values aren't set (#7116)
  14849. if ( value == null || value !== value ) {
  14850. return;
  14851. }
  14852. // If a number was passed in, add the unit (except for certain CSS properties)
  14853. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14854. // "px" to a few hardcoded values.
  14855. if ( type === "number" && !isCustomProp ) {
  14856. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14857. }
  14858. // background-* props affect original clone's values
  14859. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14860. style[ name ] = "inherit";
  14861. }
  14862. // If a hook was provided, use that value, otherwise just set the specified value
  14863. if ( !hooks || !( "set" in hooks ) ||
  14864. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14865. if ( isCustomProp ) {
  14866. style.setProperty( name, value );
  14867. } else {
  14868. style[ name ] = value;
  14869. }
  14870. }
  14871. } else {
  14872. // If a hook was provided get the non-computed value from there
  14873. if ( hooks && "get" in hooks &&
  14874. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14875. return ret;
  14876. }
  14877. // Otherwise just get the value from the style object
  14878. return style[ name ];
  14879. }
  14880. },
  14881. css: function( elem, name, extra, styles ) {
  14882. var val, num, hooks,
  14883. origName = camelCase( name ),
  14884. isCustomProp = rcustomProp.test( name );
  14885. // Make sure that we're working with the right name. We don't
  14886. // want to modify the value if it is a CSS custom property
  14887. // since they are user-defined.
  14888. if ( !isCustomProp ) {
  14889. name = finalPropName( origName );
  14890. }
  14891. // Try prefixed name followed by the unprefixed name
  14892. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14893. // If a hook was provided get the computed value from there
  14894. if ( hooks && "get" in hooks ) {
  14895. val = hooks.get( elem, true, extra );
  14896. }
  14897. // Otherwise, if a way to get the computed value exists, use that
  14898. if ( val === undefined ) {
  14899. val = curCSS( elem, name, styles );
  14900. }
  14901. // Convert "normal" to computed value
  14902. if ( val === "normal" && name in cssNormalTransform ) {
  14903. val = cssNormalTransform[ name ];
  14904. }
  14905. // Make numeric if forced or a qualifier was provided and val looks numeric
  14906. if ( extra === "" || extra ) {
  14907. num = parseFloat( val );
  14908. return extra === true || isFinite( num ) ? num || 0 : val;
  14909. }
  14910. return val;
  14911. }
  14912. } );
  14913. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14914. jQuery.cssHooks[ dimension ] = {
  14915. get: function( elem, computed, extra ) {
  14916. if ( computed ) {
  14917. // Certain elements can have dimension info if we invisibly show them
  14918. // but it must have a current display style that would benefit
  14919. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14920. // Support: Safari 8+
  14921. // Table columns in Safari have non-zero offsetWidth & zero
  14922. // getBoundingClientRect().width unless display is changed.
  14923. // Support: IE <=11 only
  14924. // Running getBoundingClientRect on a disconnected node
  14925. // in IE throws an error.
  14926. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14927. swap( elem, cssShow, function() {
  14928. return getWidthOrHeight( elem, dimension, extra );
  14929. } ) :
  14930. getWidthOrHeight( elem, dimension, extra );
  14931. }
  14932. },
  14933. set: function( elem, value, extra ) {
  14934. var matches,
  14935. styles = getStyles( elem ),
  14936. // Only read styles.position if the test has a chance to fail
  14937. // to avoid forcing a reflow.
  14938. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14939. styles.position === "absolute",
  14940. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14941. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14942. isBorderBox = boxSizingNeeded &&
  14943. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14944. subtract = extra ?
  14945. boxModelAdjustment(
  14946. elem,
  14947. dimension,
  14948. extra,
  14949. isBorderBox,
  14950. styles
  14951. ) :
  14952. 0;
  14953. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14954. // faking a content-box to get border and padding (gh-3699)
  14955. if ( isBorderBox && scrollboxSizeBuggy ) {
  14956. subtract -= Math.ceil(
  14957. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14958. parseFloat( styles[ dimension ] ) -
  14959. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14960. 0.5
  14961. );
  14962. }
  14963. // Convert to pixels if value adjustment is needed
  14964. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14965. ( matches[ 3 ] || "px" ) !== "px" ) {
  14966. elem.style[ dimension ] = value;
  14967. value = jQuery.css( elem, dimension );
  14968. }
  14969. return setPositiveNumber( elem, value, subtract );
  14970. }
  14971. };
  14972. } );
  14973. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14974. function( elem, computed ) {
  14975. if ( computed ) {
  14976. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14977. elem.getBoundingClientRect().left -
  14978. swap( elem, { marginLeft: 0 }, function() {
  14979. return elem.getBoundingClientRect().left;
  14980. } )
  14981. ) + "px";
  14982. }
  14983. }
  14984. );
  14985. // These hooks are used by animate to expand properties
  14986. jQuery.each( {
  14987. margin: "",
  14988. padding: "",
  14989. border: "Width"
  14990. }, function( prefix, suffix ) {
  14991. jQuery.cssHooks[ prefix + suffix ] = {
  14992. expand: function( value ) {
  14993. var i = 0,
  14994. expanded = {},
  14995. // Assumes a single number if not a string
  14996. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14997. for ( ; i < 4; i++ ) {
  14998. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14999. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15000. }
  15001. return expanded;
  15002. }
  15003. };
  15004. if ( prefix !== "margin" ) {
  15005. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15006. }
  15007. } );
  15008. jQuery.fn.extend( {
  15009. css: function( name, value ) {
  15010. return access( this, function( elem, name, value ) {
  15011. var styles, len,
  15012. map = {},
  15013. i = 0;
  15014. if ( Array.isArray( name ) ) {
  15015. styles = getStyles( elem );
  15016. len = name.length;
  15017. for ( ; i < len; i++ ) {
  15018. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15019. }
  15020. return map;
  15021. }
  15022. return value !== undefined ?
  15023. jQuery.style( elem, name, value ) :
  15024. jQuery.css( elem, name );
  15025. }, name, value, arguments.length > 1 );
  15026. }
  15027. } );
  15028. function Tween( elem, options, prop, end, easing ) {
  15029. return new Tween.prototype.init( elem, options, prop, end, easing );
  15030. }
  15031. jQuery.Tween = Tween;
  15032. Tween.prototype = {
  15033. constructor: Tween,
  15034. init: function( elem, options, prop, end, easing, unit ) {
  15035. this.elem = elem;
  15036. this.prop = prop;
  15037. this.easing = easing || jQuery.easing._default;
  15038. this.options = options;
  15039. this.start = this.now = this.cur();
  15040. this.end = end;
  15041. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15042. },
  15043. cur: function() {
  15044. var hooks = Tween.propHooks[ this.prop ];
  15045. return hooks && hooks.get ?
  15046. hooks.get( this ) :
  15047. Tween.propHooks._default.get( this );
  15048. },
  15049. run: function( percent ) {
  15050. var eased,
  15051. hooks = Tween.propHooks[ this.prop ];
  15052. if ( this.options.duration ) {
  15053. this.pos = eased = jQuery.easing[ this.easing ](
  15054. percent, this.options.duration * percent, 0, 1, this.options.duration
  15055. );
  15056. } else {
  15057. this.pos = eased = percent;
  15058. }
  15059. this.now = ( this.end - this.start ) * eased + this.start;
  15060. if ( this.options.step ) {
  15061. this.options.step.call( this.elem, this.now, this );
  15062. }
  15063. if ( hooks && hooks.set ) {
  15064. hooks.set( this );
  15065. } else {
  15066. Tween.propHooks._default.set( this );
  15067. }
  15068. return this;
  15069. }
  15070. };
  15071. Tween.prototype.init.prototype = Tween.prototype;
  15072. Tween.propHooks = {
  15073. _default: {
  15074. get: function( tween ) {
  15075. var result;
  15076. // Use a property on the element directly when it is not a DOM element,
  15077. // or when there is no matching style property that exists.
  15078. if ( tween.elem.nodeType !== 1 ||
  15079. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15080. return tween.elem[ tween.prop ];
  15081. }
  15082. // Passing an empty string as a 3rd parameter to .css will automatically
  15083. // attempt a parseFloat and fallback to a string if the parse fails.
  15084. // Simple values such as "10px" are parsed to Float;
  15085. // complex values such as "rotate(1rad)" are returned as-is.
  15086. result = jQuery.css( tween.elem, tween.prop, "" );
  15087. // Empty strings, null, undefined and "auto" are converted to 0.
  15088. return !result || result === "auto" ? 0 : result;
  15089. },
  15090. set: function( tween ) {
  15091. // Use step hook for back compat.
  15092. // Use cssHook if its there.
  15093. // Use .style if available and use plain properties where available.
  15094. if ( jQuery.fx.step[ tween.prop ] ) {
  15095. jQuery.fx.step[ tween.prop ]( tween );
  15096. } else if ( tween.elem.nodeType === 1 && (
  15097. jQuery.cssHooks[ tween.prop ] ||
  15098. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15099. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15100. } else {
  15101. tween.elem[ tween.prop ] = tween.now;
  15102. }
  15103. }
  15104. }
  15105. };
  15106. // Support: IE <=9 only
  15107. // Panic based approach to setting things on disconnected nodes
  15108. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15109. set: function( tween ) {
  15110. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15111. tween.elem[ tween.prop ] = tween.now;
  15112. }
  15113. }
  15114. };
  15115. jQuery.easing = {
  15116. linear: function( p ) {
  15117. return p;
  15118. },
  15119. swing: function( p ) {
  15120. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15121. },
  15122. _default: "swing"
  15123. };
  15124. jQuery.fx = Tween.prototype.init;
  15125. // Back compat <1.8 extension point
  15126. jQuery.fx.step = {};
  15127. var
  15128. fxNow, inProgress,
  15129. rfxtypes = /^(?:toggle|show|hide)$/,
  15130. rrun = /queueHooks$/;
  15131. function schedule() {
  15132. if ( inProgress ) {
  15133. if ( document.hidden === false && window.requestAnimationFrame ) {
  15134. window.requestAnimationFrame( schedule );
  15135. } else {
  15136. window.setTimeout( schedule, jQuery.fx.interval );
  15137. }
  15138. jQuery.fx.tick();
  15139. }
  15140. }
  15141. // Animations created synchronously will run synchronously
  15142. function createFxNow() {
  15143. window.setTimeout( function() {
  15144. fxNow = undefined;
  15145. } );
  15146. return ( fxNow = Date.now() );
  15147. }
  15148. // Generate parameters to create a standard animation
  15149. function genFx( type, includeWidth ) {
  15150. var which,
  15151. i = 0,
  15152. attrs = { height: type };
  15153. // If we include width, step value is 1 to do all cssExpand values,
  15154. // otherwise step value is 2 to skip over Left and Right
  15155. includeWidth = includeWidth ? 1 : 0;
  15156. for ( ; i < 4; i += 2 - includeWidth ) {
  15157. which = cssExpand[ i ];
  15158. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15159. }
  15160. if ( includeWidth ) {
  15161. attrs.opacity = attrs.width = type;
  15162. }
  15163. return attrs;
  15164. }
  15165. function createTween( value, prop, animation ) {
  15166. var tween,
  15167. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15168. index = 0,
  15169. length = collection.length;
  15170. for ( ; index < length; index++ ) {
  15171. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15172. // We're done with this property
  15173. return tween;
  15174. }
  15175. }
  15176. }
  15177. function defaultPrefilter( elem, props, opts ) {
  15178. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15179. isBox = "width" in props || "height" in props,
  15180. anim = this,
  15181. orig = {},
  15182. style = elem.style,
  15183. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15184. dataShow = dataPriv.get( elem, "fxshow" );
  15185. // Queue-skipping animations hijack the fx hooks
  15186. if ( !opts.queue ) {
  15187. hooks = jQuery._queueHooks( elem, "fx" );
  15188. if ( hooks.unqueued == null ) {
  15189. hooks.unqueued = 0;
  15190. oldfire = hooks.empty.fire;
  15191. hooks.empty.fire = function() {
  15192. if ( !hooks.unqueued ) {
  15193. oldfire();
  15194. }
  15195. };
  15196. }
  15197. hooks.unqueued++;
  15198. anim.always( function() {
  15199. // Ensure the complete handler is called before this completes
  15200. anim.always( function() {
  15201. hooks.unqueued--;
  15202. if ( !jQuery.queue( elem, "fx" ).length ) {
  15203. hooks.empty.fire();
  15204. }
  15205. } );
  15206. } );
  15207. }
  15208. // Detect show/hide animations
  15209. for ( prop in props ) {
  15210. value = props[ prop ];
  15211. if ( rfxtypes.test( value ) ) {
  15212. delete props[ prop ];
  15213. toggle = toggle || value === "toggle";
  15214. if ( value === ( hidden ? "hide" : "show" ) ) {
  15215. // Pretend to be hidden if this is a "show" and
  15216. // there is still data from a stopped show/hide
  15217. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15218. hidden = true;
  15219. // Ignore all other no-op show/hide data
  15220. } else {
  15221. continue;
  15222. }
  15223. }
  15224. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15225. }
  15226. }
  15227. // Bail out if this is a no-op like .hide().hide()
  15228. propTween = !jQuery.isEmptyObject( props );
  15229. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15230. return;
  15231. }
  15232. // Restrict "overflow" and "display" styles during box animations
  15233. if ( isBox && elem.nodeType === 1 ) {
  15234. // Support: IE <=9 - 11, Edge 12 - 15
  15235. // Record all 3 overflow attributes because IE does not infer the shorthand
  15236. // from identically-valued overflowX and overflowY and Edge just mirrors
  15237. // the overflowX value there.
  15238. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15239. // Identify a display type, preferring old show/hide data over the CSS cascade
  15240. restoreDisplay = dataShow && dataShow.display;
  15241. if ( restoreDisplay == null ) {
  15242. restoreDisplay = dataPriv.get( elem, "display" );
  15243. }
  15244. display = jQuery.css( elem, "display" );
  15245. if ( display === "none" ) {
  15246. if ( restoreDisplay ) {
  15247. display = restoreDisplay;
  15248. } else {
  15249. // Get nonempty value(s) by temporarily forcing visibility
  15250. showHide( [ elem ], true );
  15251. restoreDisplay = elem.style.display || restoreDisplay;
  15252. display = jQuery.css( elem, "display" );
  15253. showHide( [ elem ] );
  15254. }
  15255. }
  15256. // Animate inline elements as inline-block
  15257. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15258. if ( jQuery.css( elem, "float" ) === "none" ) {
  15259. // Restore the original display value at the end of pure show/hide animations
  15260. if ( !propTween ) {
  15261. anim.done( function() {
  15262. style.display = restoreDisplay;
  15263. } );
  15264. if ( restoreDisplay == null ) {
  15265. display = style.display;
  15266. restoreDisplay = display === "none" ? "" : display;
  15267. }
  15268. }
  15269. style.display = "inline-block";
  15270. }
  15271. }
  15272. }
  15273. if ( opts.overflow ) {
  15274. style.overflow = "hidden";
  15275. anim.always( function() {
  15276. style.overflow = opts.overflow[ 0 ];
  15277. style.overflowX = opts.overflow[ 1 ];
  15278. style.overflowY = opts.overflow[ 2 ];
  15279. } );
  15280. }
  15281. // Implement show/hide animations
  15282. propTween = false;
  15283. for ( prop in orig ) {
  15284. // General show/hide setup for this element animation
  15285. if ( !propTween ) {
  15286. if ( dataShow ) {
  15287. if ( "hidden" in dataShow ) {
  15288. hidden = dataShow.hidden;
  15289. }
  15290. } else {
  15291. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15292. }
  15293. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15294. if ( toggle ) {
  15295. dataShow.hidden = !hidden;
  15296. }
  15297. // Show elements before animating them
  15298. if ( hidden ) {
  15299. showHide( [ elem ], true );
  15300. }
  15301. /* eslint-disable no-loop-func */
  15302. anim.done( function() {
  15303. /* eslint-enable no-loop-func */
  15304. // The final step of a "hide" animation is actually hiding the element
  15305. if ( !hidden ) {
  15306. showHide( [ elem ] );
  15307. }
  15308. dataPriv.remove( elem, "fxshow" );
  15309. for ( prop in orig ) {
  15310. jQuery.style( elem, prop, orig[ prop ] );
  15311. }
  15312. } );
  15313. }
  15314. // Per-property setup
  15315. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15316. if ( !( prop in dataShow ) ) {
  15317. dataShow[ prop ] = propTween.start;
  15318. if ( hidden ) {
  15319. propTween.end = propTween.start;
  15320. propTween.start = 0;
  15321. }
  15322. }
  15323. }
  15324. }
  15325. function propFilter( props, specialEasing ) {
  15326. var index, name, easing, value, hooks;
  15327. // camelCase, specialEasing and expand cssHook pass
  15328. for ( index in props ) {
  15329. name = camelCase( index );
  15330. easing = specialEasing[ name ];
  15331. value = props[ index ];
  15332. if ( Array.isArray( value ) ) {
  15333. easing = value[ 1 ];
  15334. value = props[ index ] = value[ 0 ];
  15335. }
  15336. if ( index !== name ) {
  15337. props[ name ] = value;
  15338. delete props[ index ];
  15339. }
  15340. hooks = jQuery.cssHooks[ name ];
  15341. if ( hooks && "expand" in hooks ) {
  15342. value = hooks.expand( value );
  15343. delete props[ name ];
  15344. // Not quite $.extend, this won't overwrite existing keys.
  15345. // Reusing 'index' because we have the correct "name"
  15346. for ( index in value ) {
  15347. if ( !( index in props ) ) {
  15348. props[ index ] = value[ index ];
  15349. specialEasing[ index ] = easing;
  15350. }
  15351. }
  15352. } else {
  15353. specialEasing[ name ] = easing;
  15354. }
  15355. }
  15356. }
  15357. function Animation( elem, properties, options ) {
  15358. var result,
  15359. stopped,
  15360. index = 0,
  15361. length = Animation.prefilters.length,
  15362. deferred = jQuery.Deferred().always( function() {
  15363. // Don't match elem in the :animated selector
  15364. delete tick.elem;
  15365. } ),
  15366. tick = function() {
  15367. if ( stopped ) {
  15368. return false;
  15369. }
  15370. var currentTime = fxNow || createFxNow(),
  15371. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15372. // Support: Android 2.3 only
  15373. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15374. temp = remaining / animation.duration || 0,
  15375. percent = 1 - temp,
  15376. index = 0,
  15377. length = animation.tweens.length;
  15378. for ( ; index < length; index++ ) {
  15379. animation.tweens[ index ].run( percent );
  15380. }
  15381. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15382. // If there's more to do, yield
  15383. if ( percent < 1 && length ) {
  15384. return remaining;
  15385. }
  15386. // If this was an empty animation, synthesize a final progress notification
  15387. if ( !length ) {
  15388. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15389. }
  15390. // Resolve the animation and report its conclusion
  15391. deferred.resolveWith( elem, [ animation ] );
  15392. return false;
  15393. },
  15394. animation = deferred.promise( {
  15395. elem: elem,
  15396. props: jQuery.extend( {}, properties ),
  15397. opts: jQuery.extend( true, {
  15398. specialEasing: {},
  15399. easing: jQuery.easing._default
  15400. }, options ),
  15401. originalProperties: properties,
  15402. originalOptions: options,
  15403. startTime: fxNow || createFxNow(),
  15404. duration: options.duration,
  15405. tweens: [],
  15406. createTween: function( prop, end ) {
  15407. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15408. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15409. animation.tweens.push( tween );
  15410. return tween;
  15411. },
  15412. stop: function( gotoEnd ) {
  15413. var index = 0,
  15414. // If we are going to the end, we want to run all the tweens
  15415. // otherwise we skip this part
  15416. length = gotoEnd ? animation.tweens.length : 0;
  15417. if ( stopped ) {
  15418. return this;
  15419. }
  15420. stopped = true;
  15421. for ( ; index < length; index++ ) {
  15422. animation.tweens[ index ].run( 1 );
  15423. }
  15424. // Resolve when we played the last frame; otherwise, reject
  15425. if ( gotoEnd ) {
  15426. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15427. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15428. } else {
  15429. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15430. }
  15431. return this;
  15432. }
  15433. } ),
  15434. props = animation.props;
  15435. propFilter( props, animation.opts.specialEasing );
  15436. for ( ; index < length; index++ ) {
  15437. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15438. if ( result ) {
  15439. if ( isFunction( result.stop ) ) {
  15440. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15441. result.stop.bind( result );
  15442. }
  15443. return result;
  15444. }
  15445. }
  15446. jQuery.map( props, createTween, animation );
  15447. if ( isFunction( animation.opts.start ) ) {
  15448. animation.opts.start.call( elem, animation );
  15449. }
  15450. // Attach callbacks from options
  15451. animation
  15452. .progress( animation.opts.progress )
  15453. .done( animation.opts.done, animation.opts.complete )
  15454. .fail( animation.opts.fail )
  15455. .always( animation.opts.always );
  15456. jQuery.fx.timer(
  15457. jQuery.extend( tick, {
  15458. elem: elem,
  15459. anim: animation,
  15460. queue: animation.opts.queue
  15461. } )
  15462. );
  15463. return animation;
  15464. }
  15465. jQuery.Animation = jQuery.extend( Animation, {
  15466. tweeners: {
  15467. "*": [ function( prop, value ) {
  15468. var tween = this.createTween( prop, value );
  15469. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15470. return tween;
  15471. } ]
  15472. },
  15473. tweener: function( props, callback ) {
  15474. if ( isFunction( props ) ) {
  15475. callback = props;
  15476. props = [ "*" ];
  15477. } else {
  15478. props = props.match( rnothtmlwhite );
  15479. }
  15480. var prop,
  15481. index = 0,
  15482. length = props.length;
  15483. for ( ; index < length; index++ ) {
  15484. prop = props[ index ];
  15485. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15486. Animation.tweeners[ prop ].unshift( callback );
  15487. }
  15488. },
  15489. prefilters: [ defaultPrefilter ],
  15490. prefilter: function( callback, prepend ) {
  15491. if ( prepend ) {
  15492. Animation.prefilters.unshift( callback );
  15493. } else {
  15494. Animation.prefilters.push( callback );
  15495. }
  15496. }
  15497. } );
  15498. jQuery.speed = function( speed, easing, fn ) {
  15499. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15500. complete: fn || !fn && easing ||
  15501. isFunction( speed ) && speed,
  15502. duration: speed,
  15503. easing: fn && easing || easing && !isFunction( easing ) && easing
  15504. };
  15505. // Go to the end state if fx are off
  15506. if ( jQuery.fx.off ) {
  15507. opt.duration = 0;
  15508. } else {
  15509. if ( typeof opt.duration !== "number" ) {
  15510. if ( opt.duration in jQuery.fx.speeds ) {
  15511. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15512. } else {
  15513. opt.duration = jQuery.fx.speeds._default;
  15514. }
  15515. }
  15516. }
  15517. // Normalize opt.queue - true/undefined/null -> "fx"
  15518. if ( opt.queue == null || opt.queue === true ) {
  15519. opt.queue = "fx";
  15520. }
  15521. // Queueing
  15522. opt.old = opt.complete;
  15523. opt.complete = function() {
  15524. if ( isFunction( opt.old ) ) {
  15525. opt.old.call( this );
  15526. }
  15527. if ( opt.queue ) {
  15528. jQuery.dequeue( this, opt.queue );
  15529. }
  15530. };
  15531. return opt;
  15532. };
  15533. jQuery.fn.extend( {
  15534. fadeTo: function( speed, to, easing, callback ) {
  15535. // Show any hidden elements after setting opacity to 0
  15536. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15537. // Animate to the value specified
  15538. .end().animate( { opacity: to }, speed, easing, callback );
  15539. },
  15540. animate: function( prop, speed, easing, callback ) {
  15541. var empty = jQuery.isEmptyObject( prop ),
  15542. optall = jQuery.speed( speed, easing, callback ),
  15543. doAnimation = function() {
  15544. // Operate on a copy of prop so per-property easing won't be lost
  15545. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15546. // Empty animations, or finishing resolves immediately
  15547. if ( empty || dataPriv.get( this, "finish" ) ) {
  15548. anim.stop( true );
  15549. }
  15550. };
  15551. doAnimation.finish = doAnimation;
  15552. return empty || optall.queue === false ?
  15553. this.each( doAnimation ) :
  15554. this.queue( optall.queue, doAnimation );
  15555. },
  15556. stop: function( type, clearQueue, gotoEnd ) {
  15557. var stopQueue = function( hooks ) {
  15558. var stop = hooks.stop;
  15559. delete hooks.stop;
  15560. stop( gotoEnd );
  15561. };
  15562. if ( typeof type !== "string" ) {
  15563. gotoEnd = clearQueue;
  15564. clearQueue = type;
  15565. type = undefined;
  15566. }
  15567. if ( clearQueue && type !== false ) {
  15568. this.queue( type || "fx", [] );
  15569. }
  15570. return this.each( function() {
  15571. var dequeue = true,
  15572. index = type != null && type + "queueHooks",
  15573. timers = jQuery.timers,
  15574. data = dataPriv.get( this );
  15575. if ( index ) {
  15576. if ( data[ index ] && data[ index ].stop ) {
  15577. stopQueue( data[ index ] );
  15578. }
  15579. } else {
  15580. for ( index in data ) {
  15581. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15582. stopQueue( data[ index ] );
  15583. }
  15584. }
  15585. }
  15586. for ( index = timers.length; index--; ) {
  15587. if ( timers[ index ].elem === this &&
  15588. ( type == null || timers[ index ].queue === type ) ) {
  15589. timers[ index ].anim.stop( gotoEnd );
  15590. dequeue = false;
  15591. timers.splice( index, 1 );
  15592. }
  15593. }
  15594. // Start the next in the queue if the last step wasn't forced.
  15595. // Timers currently will call their complete callbacks, which
  15596. // will dequeue but only if they were gotoEnd.
  15597. if ( dequeue || !gotoEnd ) {
  15598. jQuery.dequeue( this, type );
  15599. }
  15600. } );
  15601. },
  15602. finish: function( type ) {
  15603. if ( type !== false ) {
  15604. type = type || "fx";
  15605. }
  15606. return this.each( function() {
  15607. var index,
  15608. data = dataPriv.get( this ),
  15609. queue = data[ type + "queue" ],
  15610. hooks = data[ type + "queueHooks" ],
  15611. timers = jQuery.timers,
  15612. length = queue ? queue.length : 0;
  15613. // Enable finishing flag on private data
  15614. data.finish = true;
  15615. // Empty the queue first
  15616. jQuery.queue( this, type, [] );
  15617. if ( hooks && hooks.stop ) {
  15618. hooks.stop.call( this, true );
  15619. }
  15620. // Look for any active animations, and finish them
  15621. for ( index = timers.length; index--; ) {
  15622. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15623. timers[ index ].anim.stop( true );
  15624. timers.splice( index, 1 );
  15625. }
  15626. }
  15627. // Look for any animations in the old queue and finish them
  15628. for ( index = 0; index < length; index++ ) {
  15629. if ( queue[ index ] && queue[ index ].finish ) {
  15630. queue[ index ].finish.call( this );
  15631. }
  15632. }
  15633. // Turn off finishing flag
  15634. delete data.finish;
  15635. } );
  15636. }
  15637. } );
  15638. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15639. var cssFn = jQuery.fn[ name ];
  15640. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15641. return speed == null || typeof speed === "boolean" ?
  15642. cssFn.apply( this, arguments ) :
  15643. this.animate( genFx( name, true ), speed, easing, callback );
  15644. };
  15645. } );
  15646. // Generate shortcuts for custom animations
  15647. jQuery.each( {
  15648. slideDown: genFx( "show" ),
  15649. slideUp: genFx( "hide" ),
  15650. slideToggle: genFx( "toggle" ),
  15651. fadeIn: { opacity: "show" },
  15652. fadeOut: { opacity: "hide" },
  15653. fadeToggle: { opacity: "toggle" }
  15654. }, function( name, props ) {
  15655. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15656. return this.animate( props, speed, easing, callback );
  15657. };
  15658. } );
  15659. jQuery.timers = [];
  15660. jQuery.fx.tick = function() {
  15661. var timer,
  15662. i = 0,
  15663. timers = jQuery.timers;
  15664. fxNow = Date.now();
  15665. for ( ; i < timers.length; i++ ) {
  15666. timer = timers[ i ];
  15667. // Run the timer and safely remove it when done (allowing for external removal)
  15668. if ( !timer() && timers[ i ] === timer ) {
  15669. timers.splice( i--, 1 );
  15670. }
  15671. }
  15672. if ( !timers.length ) {
  15673. jQuery.fx.stop();
  15674. }
  15675. fxNow = undefined;
  15676. };
  15677. jQuery.fx.timer = function( timer ) {
  15678. jQuery.timers.push( timer );
  15679. jQuery.fx.start();
  15680. };
  15681. jQuery.fx.interval = 13;
  15682. jQuery.fx.start = function() {
  15683. if ( inProgress ) {
  15684. return;
  15685. }
  15686. inProgress = true;
  15687. schedule();
  15688. };
  15689. jQuery.fx.stop = function() {
  15690. inProgress = null;
  15691. };
  15692. jQuery.fx.speeds = {
  15693. slow: 600,
  15694. fast: 200,
  15695. // Default speed
  15696. _default: 400
  15697. };
  15698. // Based off of the plugin by Clint Helfers, with permission.
  15699. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15700. jQuery.fn.delay = function( time, type ) {
  15701. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15702. type = type || "fx";
  15703. return this.queue( type, function( next, hooks ) {
  15704. var timeout = window.setTimeout( next, time );
  15705. hooks.stop = function() {
  15706. window.clearTimeout( timeout );
  15707. };
  15708. } );
  15709. };
  15710. ( function() {
  15711. var input = document.createElement( "input" ),
  15712. select = document.createElement( "select" ),
  15713. opt = select.appendChild( document.createElement( "option" ) );
  15714. input.type = "checkbox";
  15715. // Support: Android <=4.3 only
  15716. // Default value for a checkbox should be "on"
  15717. support.checkOn = input.value !== "";
  15718. // Support: IE <=11 only
  15719. // Must access selectedIndex to make default options select
  15720. support.optSelected = opt.selected;
  15721. // Support: IE <=11 only
  15722. // An input loses its value after becoming a radio
  15723. input = document.createElement( "input" );
  15724. input.value = "t";
  15725. input.type = "radio";
  15726. support.radioValue = input.value === "t";
  15727. } )();
  15728. var boolHook,
  15729. attrHandle = jQuery.expr.attrHandle;
  15730. jQuery.fn.extend( {
  15731. attr: function( name, value ) {
  15732. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15733. },
  15734. removeAttr: function( name ) {
  15735. return this.each( function() {
  15736. jQuery.removeAttr( this, name );
  15737. } );
  15738. }
  15739. } );
  15740. jQuery.extend( {
  15741. attr: function( elem, name, value ) {
  15742. var ret, hooks,
  15743. nType = elem.nodeType;
  15744. // Don't get/set attributes on text, comment and attribute nodes
  15745. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15746. return;
  15747. }
  15748. // Fallback to prop when attributes are not supported
  15749. if ( typeof elem.getAttribute === "undefined" ) {
  15750. return jQuery.prop( elem, name, value );
  15751. }
  15752. // Attribute hooks are determined by the lowercase version
  15753. // Grab necessary hook if one is defined
  15754. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15755. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15756. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15757. }
  15758. if ( value !== undefined ) {
  15759. if ( value === null ) {
  15760. jQuery.removeAttr( elem, name );
  15761. return;
  15762. }
  15763. if ( hooks && "set" in hooks &&
  15764. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15765. return ret;
  15766. }
  15767. elem.setAttribute( name, value + "" );
  15768. return value;
  15769. }
  15770. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15771. return ret;
  15772. }
  15773. ret = jQuery.find.attr( elem, name );
  15774. // Non-existent attributes return null, we normalize to undefined
  15775. return ret == null ? undefined : ret;
  15776. },
  15777. attrHooks: {
  15778. type: {
  15779. set: function( elem, value ) {
  15780. if ( !support.radioValue && value === "radio" &&
  15781. nodeName( elem, "input" ) ) {
  15782. var val = elem.value;
  15783. elem.setAttribute( "type", value );
  15784. if ( val ) {
  15785. elem.value = val;
  15786. }
  15787. return value;
  15788. }
  15789. }
  15790. }
  15791. },
  15792. removeAttr: function( elem, value ) {
  15793. var name,
  15794. i = 0,
  15795. // Attribute names can contain non-HTML whitespace characters
  15796. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15797. attrNames = value && value.match( rnothtmlwhite );
  15798. if ( attrNames && elem.nodeType === 1 ) {
  15799. while ( ( name = attrNames[ i++ ] ) ) {
  15800. elem.removeAttribute( name );
  15801. }
  15802. }
  15803. }
  15804. } );
  15805. // Hooks for boolean attributes
  15806. boolHook = {
  15807. set: function( elem, value, name ) {
  15808. if ( value === false ) {
  15809. // Remove boolean attributes when set to false
  15810. jQuery.removeAttr( elem, name );
  15811. } else {
  15812. elem.setAttribute( name, name );
  15813. }
  15814. return name;
  15815. }
  15816. };
  15817. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15818. var getter = attrHandle[ name ] || jQuery.find.attr;
  15819. attrHandle[ name ] = function( elem, name, isXML ) {
  15820. var ret, handle,
  15821. lowercaseName = name.toLowerCase();
  15822. if ( !isXML ) {
  15823. // Avoid an infinite loop by temporarily removing this function from the getter
  15824. handle = attrHandle[ lowercaseName ];
  15825. attrHandle[ lowercaseName ] = ret;
  15826. ret = getter( elem, name, isXML ) != null ?
  15827. lowercaseName :
  15828. null;
  15829. attrHandle[ lowercaseName ] = handle;
  15830. }
  15831. return ret;
  15832. };
  15833. } );
  15834. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15835. rclickable = /^(?:a|area)$/i;
  15836. jQuery.fn.extend( {
  15837. prop: function( name, value ) {
  15838. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15839. },
  15840. removeProp: function( name ) {
  15841. return this.each( function() {
  15842. delete this[ jQuery.propFix[ name ] || name ];
  15843. } );
  15844. }
  15845. } );
  15846. jQuery.extend( {
  15847. prop: function( elem, name, value ) {
  15848. var ret, hooks,
  15849. nType = elem.nodeType;
  15850. // Don't get/set properties on text, comment and attribute nodes
  15851. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15852. return;
  15853. }
  15854. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15855. // Fix name and attach hooks
  15856. name = jQuery.propFix[ name ] || name;
  15857. hooks = jQuery.propHooks[ name ];
  15858. }
  15859. if ( value !== undefined ) {
  15860. if ( hooks && "set" in hooks &&
  15861. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15862. return ret;
  15863. }
  15864. return ( elem[ name ] = value );
  15865. }
  15866. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15867. return ret;
  15868. }
  15869. return elem[ name ];
  15870. },
  15871. propHooks: {
  15872. tabIndex: {
  15873. get: function( elem ) {
  15874. // Support: IE <=9 - 11 only
  15875. // elem.tabIndex doesn't always return the
  15876. // correct value when it hasn't been explicitly set
  15877. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15878. // Use proper attribute retrieval(#12072)
  15879. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15880. if ( tabindex ) {
  15881. return parseInt( tabindex, 10 );
  15882. }
  15883. if (
  15884. rfocusable.test( elem.nodeName ) ||
  15885. rclickable.test( elem.nodeName ) &&
  15886. elem.href
  15887. ) {
  15888. return 0;
  15889. }
  15890. return -1;
  15891. }
  15892. }
  15893. },
  15894. propFix: {
  15895. "for": "htmlFor",
  15896. "class": "className"
  15897. }
  15898. } );
  15899. // Support: IE <=11 only
  15900. // Accessing the selectedIndex property
  15901. // forces the browser to respect setting selected
  15902. // on the option
  15903. // The getter ensures a default option is selected
  15904. // when in an optgroup
  15905. // eslint rule "no-unused-expressions" is disabled for this code
  15906. // since it considers such accessions noop
  15907. if ( !support.optSelected ) {
  15908. jQuery.propHooks.selected = {
  15909. get: function( elem ) {
  15910. /* eslint no-unused-expressions: "off" */
  15911. var parent = elem.parentNode;
  15912. if ( parent && parent.parentNode ) {
  15913. parent.parentNode.selectedIndex;
  15914. }
  15915. return null;
  15916. },
  15917. set: function( elem ) {
  15918. /* eslint no-unused-expressions: "off" */
  15919. var parent = elem.parentNode;
  15920. if ( parent ) {
  15921. parent.selectedIndex;
  15922. if ( parent.parentNode ) {
  15923. parent.parentNode.selectedIndex;
  15924. }
  15925. }
  15926. }
  15927. };
  15928. }
  15929. jQuery.each( [
  15930. "tabIndex",
  15931. "readOnly",
  15932. "maxLength",
  15933. "cellSpacing",
  15934. "cellPadding",
  15935. "rowSpan",
  15936. "colSpan",
  15937. "useMap",
  15938. "frameBorder",
  15939. "contentEditable"
  15940. ], function() {
  15941. jQuery.propFix[ this.toLowerCase() ] = this;
  15942. } );
  15943. // Strip and collapse whitespace according to HTML spec
  15944. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15945. function stripAndCollapse( value ) {
  15946. var tokens = value.match( rnothtmlwhite ) || [];
  15947. return tokens.join( " " );
  15948. }
  15949. function getClass( elem ) {
  15950. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15951. }
  15952. function classesToArray( value ) {
  15953. if ( Array.isArray( value ) ) {
  15954. return value;
  15955. }
  15956. if ( typeof value === "string" ) {
  15957. return value.match( rnothtmlwhite ) || [];
  15958. }
  15959. return [];
  15960. }
  15961. jQuery.fn.extend( {
  15962. addClass: function( value ) {
  15963. var classes, elem, cur, curValue, clazz, j, finalValue,
  15964. i = 0;
  15965. if ( isFunction( value ) ) {
  15966. return this.each( function( j ) {
  15967. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15968. } );
  15969. }
  15970. classes = classesToArray( value );
  15971. if ( classes.length ) {
  15972. while ( ( elem = this[ i++ ] ) ) {
  15973. curValue = getClass( elem );
  15974. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15975. if ( cur ) {
  15976. j = 0;
  15977. while ( ( clazz = classes[ j++ ] ) ) {
  15978. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15979. cur += clazz + " ";
  15980. }
  15981. }
  15982. // Only assign if different to avoid unneeded rendering.
  15983. finalValue = stripAndCollapse( cur );
  15984. if ( curValue !== finalValue ) {
  15985. elem.setAttribute( "class", finalValue );
  15986. }
  15987. }
  15988. }
  15989. }
  15990. return this;
  15991. },
  15992. removeClass: function( value ) {
  15993. var classes, elem, cur, curValue, clazz, j, finalValue,
  15994. i = 0;
  15995. if ( isFunction( value ) ) {
  15996. return this.each( function( j ) {
  15997. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15998. } );
  15999. }
  16000. if ( !arguments.length ) {
  16001. return this.attr( "class", "" );
  16002. }
  16003. classes = classesToArray( value );
  16004. if ( classes.length ) {
  16005. while ( ( elem = this[ i++ ] ) ) {
  16006. curValue = getClass( elem );
  16007. // This expression is here for better compressibility (see addClass)
  16008. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16009. if ( cur ) {
  16010. j = 0;
  16011. while ( ( clazz = classes[ j++ ] ) ) {
  16012. // Remove *all* instances
  16013. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16014. cur = cur.replace( " " + clazz + " ", " " );
  16015. }
  16016. }
  16017. // Only assign if different to avoid unneeded rendering.
  16018. finalValue = stripAndCollapse( cur );
  16019. if ( curValue !== finalValue ) {
  16020. elem.setAttribute( "class", finalValue );
  16021. }
  16022. }
  16023. }
  16024. }
  16025. return this;
  16026. },
  16027. toggleClass: function( value, stateVal ) {
  16028. var type = typeof value,
  16029. isValidValue = type === "string" || Array.isArray( value );
  16030. if ( typeof stateVal === "boolean" && isValidValue ) {
  16031. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16032. }
  16033. if ( isFunction( value ) ) {
  16034. return this.each( function( i ) {
  16035. jQuery( this ).toggleClass(
  16036. value.call( this, i, getClass( this ), stateVal ),
  16037. stateVal
  16038. );
  16039. } );
  16040. }
  16041. return this.each( function() {
  16042. var className, i, self, classNames;
  16043. if ( isValidValue ) {
  16044. // Toggle individual class names
  16045. i = 0;
  16046. self = jQuery( this );
  16047. classNames = classesToArray( value );
  16048. while ( ( className = classNames[ i++ ] ) ) {
  16049. // Check each className given, space separated list
  16050. if ( self.hasClass( className ) ) {
  16051. self.removeClass( className );
  16052. } else {
  16053. self.addClass( className );
  16054. }
  16055. }
  16056. // Toggle whole class name
  16057. } else if ( value === undefined || type === "boolean" ) {
  16058. className = getClass( this );
  16059. if ( className ) {
  16060. // Store className if set
  16061. dataPriv.set( this, "__className__", className );
  16062. }
  16063. // If the element has a class name or if we're passed `false`,
  16064. // then remove the whole classname (if there was one, the above saved it).
  16065. // Otherwise bring back whatever was previously saved (if anything),
  16066. // falling back to the empty string if nothing was stored.
  16067. if ( this.setAttribute ) {
  16068. this.setAttribute( "class",
  16069. className || value === false ?
  16070. "" :
  16071. dataPriv.get( this, "__className__" ) || ""
  16072. );
  16073. }
  16074. }
  16075. } );
  16076. },
  16077. hasClass: function( selector ) {
  16078. var className, elem,
  16079. i = 0;
  16080. className = " " + selector + " ";
  16081. while ( ( elem = this[ i++ ] ) ) {
  16082. if ( elem.nodeType === 1 &&
  16083. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16084. return true;
  16085. }
  16086. }
  16087. return false;
  16088. }
  16089. } );
  16090. var rreturn = /\r/g;
  16091. jQuery.fn.extend( {
  16092. val: function( value ) {
  16093. var hooks, ret, valueIsFunction,
  16094. elem = this[ 0 ];
  16095. if ( !arguments.length ) {
  16096. if ( elem ) {
  16097. hooks = jQuery.valHooks[ elem.type ] ||
  16098. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16099. if ( hooks &&
  16100. "get" in hooks &&
  16101. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16102. ) {
  16103. return ret;
  16104. }
  16105. ret = elem.value;
  16106. // Handle most common string cases
  16107. if ( typeof ret === "string" ) {
  16108. return ret.replace( rreturn, "" );
  16109. }
  16110. // Handle cases where value is null/undef or number
  16111. return ret == null ? "" : ret;
  16112. }
  16113. return;
  16114. }
  16115. valueIsFunction = isFunction( value );
  16116. return this.each( function( i ) {
  16117. var val;
  16118. if ( this.nodeType !== 1 ) {
  16119. return;
  16120. }
  16121. if ( valueIsFunction ) {
  16122. val = value.call( this, i, jQuery( this ).val() );
  16123. } else {
  16124. val = value;
  16125. }
  16126. // Treat null/undefined as ""; convert numbers to string
  16127. if ( val == null ) {
  16128. val = "";
  16129. } else if ( typeof val === "number" ) {
  16130. val += "";
  16131. } else if ( Array.isArray( val ) ) {
  16132. val = jQuery.map( val, function( value ) {
  16133. return value == null ? "" : value + "";
  16134. } );
  16135. }
  16136. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16137. // If set returns undefined, fall back to normal setting
  16138. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16139. this.value = val;
  16140. }
  16141. } );
  16142. }
  16143. } );
  16144. jQuery.extend( {
  16145. valHooks: {
  16146. option: {
  16147. get: function( elem ) {
  16148. var val = jQuery.find.attr( elem, "value" );
  16149. return val != null ?
  16150. val :
  16151. // Support: IE <=10 - 11 only
  16152. // option.text throws exceptions (#14686, #14858)
  16153. // Strip and collapse whitespace
  16154. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16155. stripAndCollapse( jQuery.text( elem ) );
  16156. }
  16157. },
  16158. select: {
  16159. get: function( elem ) {
  16160. var value, option, i,
  16161. options = elem.options,
  16162. index = elem.selectedIndex,
  16163. one = elem.type === "select-one",
  16164. values = one ? null : [],
  16165. max = one ? index + 1 : options.length;
  16166. if ( index < 0 ) {
  16167. i = max;
  16168. } else {
  16169. i = one ? index : 0;
  16170. }
  16171. // Loop through all the selected options
  16172. for ( ; i < max; i++ ) {
  16173. option = options[ i ];
  16174. // Support: IE <=9 only
  16175. // IE8-9 doesn't update selected after form reset (#2551)
  16176. if ( ( option.selected || i === index ) &&
  16177. // Don't return options that are disabled or in a disabled optgroup
  16178. !option.disabled &&
  16179. ( !option.parentNode.disabled ||
  16180. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16181. // Get the specific value for the option
  16182. value = jQuery( option ).val();
  16183. // We don't need an array for one selects
  16184. if ( one ) {
  16185. return value;
  16186. }
  16187. // Multi-Selects return an array
  16188. values.push( value );
  16189. }
  16190. }
  16191. return values;
  16192. },
  16193. set: function( elem, value ) {
  16194. var optionSet, option,
  16195. options = elem.options,
  16196. values = jQuery.makeArray( value ),
  16197. i = options.length;
  16198. while ( i-- ) {
  16199. option = options[ i ];
  16200. /* eslint-disable no-cond-assign */
  16201. if ( option.selected =
  16202. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16203. ) {
  16204. optionSet = true;
  16205. }
  16206. /* eslint-enable no-cond-assign */
  16207. }
  16208. // Force browsers to behave consistently when non-matching value is set
  16209. if ( !optionSet ) {
  16210. elem.selectedIndex = -1;
  16211. }
  16212. return values;
  16213. }
  16214. }
  16215. }
  16216. } );
  16217. // Radios and checkboxes getter/setter
  16218. jQuery.each( [ "radio", "checkbox" ], function() {
  16219. jQuery.valHooks[ this ] = {
  16220. set: function( elem, value ) {
  16221. if ( Array.isArray( value ) ) {
  16222. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16223. }
  16224. }
  16225. };
  16226. if ( !support.checkOn ) {
  16227. jQuery.valHooks[ this ].get = function( elem ) {
  16228. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16229. };
  16230. }
  16231. } );
  16232. // Return jQuery for attributes-only inclusion
  16233. support.focusin = "onfocusin" in window;
  16234. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16235. stopPropagationCallback = function( e ) {
  16236. e.stopPropagation();
  16237. };
  16238. jQuery.extend( jQuery.event, {
  16239. trigger: function( event, data, elem, onlyHandlers ) {
  16240. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16241. eventPath = [ elem || document ],
  16242. type = hasOwn.call( event, "type" ) ? event.type : event,
  16243. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16244. cur = lastElement = tmp = elem = elem || document;
  16245. // Don't do events on text and comment nodes
  16246. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16247. return;
  16248. }
  16249. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16250. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16251. return;
  16252. }
  16253. if ( type.indexOf( "." ) > -1 ) {
  16254. // Namespaced trigger; create a regexp to match event type in handle()
  16255. namespaces = type.split( "." );
  16256. type = namespaces.shift();
  16257. namespaces.sort();
  16258. }
  16259. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16260. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16261. event = event[ jQuery.expando ] ?
  16262. event :
  16263. new jQuery.Event( type, typeof event === "object" && event );
  16264. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16265. event.isTrigger = onlyHandlers ? 2 : 3;
  16266. event.namespace = namespaces.join( "." );
  16267. event.rnamespace = event.namespace ?
  16268. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16269. null;
  16270. // Clean up the event in case it is being reused
  16271. event.result = undefined;
  16272. if ( !event.target ) {
  16273. event.target = elem;
  16274. }
  16275. // Clone any incoming data and prepend the event, creating the handler arg list
  16276. data = data == null ?
  16277. [ event ] :
  16278. jQuery.makeArray( data, [ event ] );
  16279. // Allow special events to draw outside the lines
  16280. special = jQuery.event.special[ type ] || {};
  16281. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16282. return;
  16283. }
  16284. // Determine event propagation path in advance, per W3C events spec (#9951)
  16285. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16286. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16287. bubbleType = special.delegateType || type;
  16288. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16289. cur = cur.parentNode;
  16290. }
  16291. for ( ; cur; cur = cur.parentNode ) {
  16292. eventPath.push( cur );
  16293. tmp = cur;
  16294. }
  16295. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16296. if ( tmp === ( elem.ownerDocument || document ) ) {
  16297. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16298. }
  16299. }
  16300. // Fire handlers on the event path
  16301. i = 0;
  16302. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16303. lastElement = cur;
  16304. event.type = i > 1 ?
  16305. bubbleType :
  16306. special.bindType || type;
  16307. // jQuery handler
  16308. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16309. dataPriv.get( cur, "handle" );
  16310. if ( handle ) {
  16311. handle.apply( cur, data );
  16312. }
  16313. // Native handler
  16314. handle = ontype && cur[ ontype ];
  16315. if ( handle && handle.apply && acceptData( cur ) ) {
  16316. event.result = handle.apply( cur, data );
  16317. if ( event.result === false ) {
  16318. event.preventDefault();
  16319. }
  16320. }
  16321. }
  16322. event.type = type;
  16323. // If nobody prevented the default action, do it now
  16324. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16325. if ( ( !special._default ||
  16326. special._default.apply( eventPath.pop(), data ) === false ) &&
  16327. acceptData( elem ) ) {
  16328. // Call a native DOM method on the target with the same name as the event.
  16329. // Don't do default actions on window, that's where global variables be (#6170)
  16330. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16331. // Don't re-trigger an onFOO event when we call its FOO() method
  16332. tmp = elem[ ontype ];
  16333. if ( tmp ) {
  16334. elem[ ontype ] = null;
  16335. }
  16336. // Prevent re-triggering of the same event, since we already bubbled it above
  16337. jQuery.event.triggered = type;
  16338. if ( event.isPropagationStopped() ) {
  16339. lastElement.addEventListener( type, stopPropagationCallback );
  16340. }
  16341. elem[ type ]();
  16342. if ( event.isPropagationStopped() ) {
  16343. lastElement.removeEventListener( type, stopPropagationCallback );
  16344. }
  16345. jQuery.event.triggered = undefined;
  16346. if ( tmp ) {
  16347. elem[ ontype ] = tmp;
  16348. }
  16349. }
  16350. }
  16351. }
  16352. return event.result;
  16353. },
  16354. // Piggyback on a donor event to simulate a different one
  16355. // Used only for `focus(in | out)` events
  16356. simulate: function( type, elem, event ) {
  16357. var e = jQuery.extend(
  16358. new jQuery.Event(),
  16359. event,
  16360. {
  16361. type: type,
  16362. isSimulated: true
  16363. }
  16364. );
  16365. jQuery.event.trigger( e, null, elem );
  16366. }
  16367. } );
  16368. jQuery.fn.extend( {
  16369. trigger: function( type, data ) {
  16370. return this.each( function() {
  16371. jQuery.event.trigger( type, data, this );
  16372. } );
  16373. },
  16374. triggerHandler: function( type, data ) {
  16375. var elem = this[ 0 ];
  16376. if ( elem ) {
  16377. return jQuery.event.trigger( type, data, elem, true );
  16378. }
  16379. }
  16380. } );
  16381. // Support: Firefox <=44
  16382. // Firefox doesn't have focus(in | out) events
  16383. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16384. //
  16385. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16386. // focus(in | out) events fire after focus & blur events,
  16387. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16388. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16389. if ( !support.focusin ) {
  16390. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16391. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16392. var handler = function( event ) {
  16393. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16394. };
  16395. jQuery.event.special[ fix ] = {
  16396. setup: function() {
  16397. var doc = this.ownerDocument || this,
  16398. attaches = dataPriv.access( doc, fix );
  16399. if ( !attaches ) {
  16400. doc.addEventListener( orig, handler, true );
  16401. }
  16402. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16403. },
  16404. teardown: function() {
  16405. var doc = this.ownerDocument || this,
  16406. attaches = dataPriv.access( doc, fix ) - 1;
  16407. if ( !attaches ) {
  16408. doc.removeEventListener( orig, handler, true );
  16409. dataPriv.remove( doc, fix );
  16410. } else {
  16411. dataPriv.access( doc, fix, attaches );
  16412. }
  16413. }
  16414. };
  16415. } );
  16416. }
  16417. var location = window.location;
  16418. var nonce = Date.now();
  16419. var rquery = ( /\?/ );
  16420. // Cross-browser xml parsing
  16421. jQuery.parseXML = function( data ) {
  16422. var xml;
  16423. if ( !data || typeof data !== "string" ) {
  16424. return null;
  16425. }
  16426. // Support: IE 9 - 11 only
  16427. // IE throws on parseFromString with invalid input.
  16428. try {
  16429. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16430. } catch ( e ) {
  16431. xml = undefined;
  16432. }
  16433. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16434. jQuery.error( "Invalid XML: " + data );
  16435. }
  16436. return xml;
  16437. };
  16438. var
  16439. rbracket = /\[\]$/,
  16440. rCRLF = /\r?\n/g,
  16441. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16442. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16443. function buildParams( prefix, obj, traditional, add ) {
  16444. var name;
  16445. if ( Array.isArray( obj ) ) {
  16446. // Serialize array item.
  16447. jQuery.each( obj, function( i, v ) {
  16448. if ( traditional || rbracket.test( prefix ) ) {
  16449. // Treat each array item as a scalar.
  16450. add( prefix, v );
  16451. } else {
  16452. // Item is non-scalar (array or object), encode its numeric index.
  16453. buildParams(
  16454. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16455. v,
  16456. traditional,
  16457. add
  16458. );
  16459. }
  16460. } );
  16461. } else if ( !traditional && toType( obj ) === "object" ) {
  16462. // Serialize object item.
  16463. for ( name in obj ) {
  16464. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16465. }
  16466. } else {
  16467. // Serialize scalar item.
  16468. add( prefix, obj );
  16469. }
  16470. }
  16471. // Serialize an array of form elements or a set of
  16472. // key/values into a query string
  16473. jQuery.param = function( a, traditional ) {
  16474. var prefix,
  16475. s = [],
  16476. add = function( key, valueOrFunction ) {
  16477. // If value is a function, invoke it and use its return value
  16478. var value = isFunction( valueOrFunction ) ?
  16479. valueOrFunction() :
  16480. valueOrFunction;
  16481. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16482. encodeURIComponent( value == null ? "" : value );
  16483. };
  16484. if ( a == null ) {
  16485. return "";
  16486. }
  16487. // If an array was passed in, assume that it is an array of form elements.
  16488. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16489. // Serialize the form elements
  16490. jQuery.each( a, function() {
  16491. add( this.name, this.value );
  16492. } );
  16493. } else {
  16494. // If traditional, encode the "old" way (the way 1.3.2 or older
  16495. // did it), otherwise encode params recursively.
  16496. for ( prefix in a ) {
  16497. buildParams( prefix, a[ prefix ], traditional, add );
  16498. }
  16499. }
  16500. // Return the resulting serialization
  16501. return s.join( "&" );
  16502. };
  16503. jQuery.fn.extend( {
  16504. serialize: function() {
  16505. return jQuery.param( this.serializeArray() );
  16506. },
  16507. serializeArray: function() {
  16508. return this.map( function() {
  16509. // Can add propHook for "elements" to filter or add form elements
  16510. var elements = jQuery.prop( this, "elements" );
  16511. return elements ? jQuery.makeArray( elements ) : this;
  16512. } )
  16513. .filter( function() {
  16514. var type = this.type;
  16515. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16516. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16517. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16518. ( this.checked || !rcheckableType.test( type ) );
  16519. } )
  16520. .map( function( i, elem ) {
  16521. var val = jQuery( this ).val();
  16522. if ( val == null ) {
  16523. return null;
  16524. }
  16525. if ( Array.isArray( val ) ) {
  16526. return jQuery.map( val, function( val ) {
  16527. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16528. } );
  16529. }
  16530. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16531. } ).get();
  16532. }
  16533. } );
  16534. var
  16535. r20 = /%20/g,
  16536. rhash = /#.*$/,
  16537. rantiCache = /([?&])_=[^&]*/,
  16538. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16539. // #7653, #8125, #8152: local protocol detection
  16540. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16541. rnoContent = /^(?:GET|HEAD)$/,
  16542. rprotocol = /^\/\//,
  16543. /* Prefilters
  16544. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16545. * 2) These are called:
  16546. * - BEFORE asking for a transport
  16547. * - AFTER param serialization (s.data is a string if s.processData is true)
  16548. * 3) key is the dataType
  16549. * 4) the catchall symbol "*" can be used
  16550. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16551. */
  16552. prefilters = {},
  16553. /* Transports bindings
  16554. * 1) key is the dataType
  16555. * 2) the catchall symbol "*" can be used
  16556. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16557. */
  16558. transports = {},
  16559. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16560. allTypes = "*/".concat( "*" ),
  16561. // Anchor tag for parsing the document origin
  16562. originAnchor = document.createElement( "a" );
  16563. originAnchor.href = location.href;
  16564. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16565. function addToPrefiltersOrTransports( structure ) {
  16566. // dataTypeExpression is optional and defaults to "*"
  16567. return function( dataTypeExpression, func ) {
  16568. if ( typeof dataTypeExpression !== "string" ) {
  16569. func = dataTypeExpression;
  16570. dataTypeExpression = "*";
  16571. }
  16572. var dataType,
  16573. i = 0,
  16574. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16575. if ( isFunction( func ) ) {
  16576. // For each dataType in the dataTypeExpression
  16577. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16578. // Prepend if requested
  16579. if ( dataType[ 0 ] === "+" ) {
  16580. dataType = dataType.slice( 1 ) || "*";
  16581. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16582. // Otherwise append
  16583. } else {
  16584. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16585. }
  16586. }
  16587. }
  16588. };
  16589. }
  16590. // Base inspection function for prefilters and transports
  16591. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16592. var inspected = {},
  16593. seekingTransport = ( structure === transports );
  16594. function inspect( dataType ) {
  16595. var selected;
  16596. inspected[ dataType ] = true;
  16597. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16598. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16599. if ( typeof dataTypeOrTransport === "string" &&
  16600. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16601. options.dataTypes.unshift( dataTypeOrTransport );
  16602. inspect( dataTypeOrTransport );
  16603. return false;
  16604. } else if ( seekingTransport ) {
  16605. return !( selected = dataTypeOrTransport );
  16606. }
  16607. } );
  16608. return selected;
  16609. }
  16610. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16611. }
  16612. // A special extend for ajax options
  16613. // that takes "flat" options (not to be deep extended)
  16614. // Fixes #9887
  16615. function ajaxExtend( target, src ) {
  16616. var key, deep,
  16617. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16618. for ( key in src ) {
  16619. if ( src[ key ] !== undefined ) {
  16620. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16621. }
  16622. }
  16623. if ( deep ) {
  16624. jQuery.extend( true, target, deep );
  16625. }
  16626. return target;
  16627. }
  16628. /* Handles responses to an ajax request:
  16629. * - finds the right dataType (mediates between content-type and expected dataType)
  16630. * - returns the corresponding response
  16631. */
  16632. function ajaxHandleResponses( s, jqXHR, responses ) {
  16633. var ct, type, finalDataType, firstDataType,
  16634. contents = s.contents,
  16635. dataTypes = s.dataTypes;
  16636. // Remove auto dataType and get content-type in the process
  16637. while ( dataTypes[ 0 ] === "*" ) {
  16638. dataTypes.shift();
  16639. if ( ct === undefined ) {
  16640. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16641. }
  16642. }
  16643. // Check if we're dealing with a known content-type
  16644. if ( ct ) {
  16645. for ( type in contents ) {
  16646. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16647. dataTypes.unshift( type );
  16648. break;
  16649. }
  16650. }
  16651. }
  16652. // Check to see if we have a response for the expected dataType
  16653. if ( dataTypes[ 0 ] in responses ) {
  16654. finalDataType = dataTypes[ 0 ];
  16655. } else {
  16656. // Try convertible dataTypes
  16657. for ( type in responses ) {
  16658. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16659. finalDataType = type;
  16660. break;
  16661. }
  16662. if ( !firstDataType ) {
  16663. firstDataType = type;
  16664. }
  16665. }
  16666. // Or just use first one
  16667. finalDataType = finalDataType || firstDataType;
  16668. }
  16669. // If we found a dataType
  16670. // We add the dataType to the list if needed
  16671. // and return the corresponding response
  16672. if ( finalDataType ) {
  16673. if ( finalDataType !== dataTypes[ 0 ] ) {
  16674. dataTypes.unshift( finalDataType );
  16675. }
  16676. return responses[ finalDataType ];
  16677. }
  16678. }
  16679. /* Chain conversions given the request and the original response
  16680. * Also sets the responseXXX fields on the jqXHR instance
  16681. */
  16682. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16683. var conv2, current, conv, tmp, prev,
  16684. converters = {},
  16685. // Work with a copy of dataTypes in case we need to modify it for conversion
  16686. dataTypes = s.dataTypes.slice();
  16687. // Create converters map with lowercased keys
  16688. if ( dataTypes[ 1 ] ) {
  16689. for ( conv in s.converters ) {
  16690. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16691. }
  16692. }
  16693. current = dataTypes.shift();
  16694. // Convert to each sequential dataType
  16695. while ( current ) {
  16696. if ( s.responseFields[ current ] ) {
  16697. jqXHR[ s.responseFields[ current ] ] = response;
  16698. }
  16699. // Apply the dataFilter if provided
  16700. if ( !prev && isSuccess && s.dataFilter ) {
  16701. response = s.dataFilter( response, s.dataType );
  16702. }
  16703. prev = current;
  16704. current = dataTypes.shift();
  16705. if ( current ) {
  16706. // There's only work to do if current dataType is non-auto
  16707. if ( current === "*" ) {
  16708. current = prev;
  16709. // Convert response if prev dataType is non-auto and differs from current
  16710. } else if ( prev !== "*" && prev !== current ) {
  16711. // Seek a direct converter
  16712. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16713. // If none found, seek a pair
  16714. if ( !conv ) {
  16715. for ( conv2 in converters ) {
  16716. // If conv2 outputs current
  16717. tmp = conv2.split( " " );
  16718. if ( tmp[ 1 ] === current ) {
  16719. // If prev can be converted to accepted input
  16720. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16721. converters[ "* " + tmp[ 0 ] ];
  16722. if ( conv ) {
  16723. // Condense equivalence converters
  16724. if ( conv === true ) {
  16725. conv = converters[ conv2 ];
  16726. // Otherwise, insert the intermediate dataType
  16727. } else if ( converters[ conv2 ] !== true ) {
  16728. current = tmp[ 0 ];
  16729. dataTypes.unshift( tmp[ 1 ] );
  16730. }
  16731. break;
  16732. }
  16733. }
  16734. }
  16735. }
  16736. // Apply converter (if not an equivalence)
  16737. if ( conv !== true ) {
  16738. // Unless errors are allowed to bubble, catch and return them
  16739. if ( conv && s.throws ) {
  16740. response = conv( response );
  16741. } else {
  16742. try {
  16743. response = conv( response );
  16744. } catch ( e ) {
  16745. return {
  16746. state: "parsererror",
  16747. error: conv ? e : "No conversion from " + prev + " to " + current
  16748. };
  16749. }
  16750. }
  16751. }
  16752. }
  16753. }
  16754. }
  16755. return { state: "success", data: response };
  16756. }
  16757. jQuery.extend( {
  16758. // Counter for holding the number of active queries
  16759. active: 0,
  16760. // Last-Modified header cache for next request
  16761. lastModified: {},
  16762. etag: {},
  16763. ajaxSettings: {
  16764. url: location.href,
  16765. type: "GET",
  16766. isLocal: rlocalProtocol.test( location.protocol ),
  16767. global: true,
  16768. processData: true,
  16769. async: true,
  16770. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16771. /*
  16772. timeout: 0,
  16773. data: null,
  16774. dataType: null,
  16775. username: null,
  16776. password: null,
  16777. cache: null,
  16778. throws: false,
  16779. traditional: false,
  16780. headers: {},
  16781. */
  16782. accepts: {
  16783. "*": allTypes,
  16784. text: "text/plain",
  16785. html: "text/html",
  16786. xml: "application/xml, text/xml",
  16787. json: "application/json, text/javascript"
  16788. },
  16789. contents: {
  16790. xml: /\bxml\b/,
  16791. html: /\bhtml/,
  16792. json: /\bjson\b/
  16793. },
  16794. responseFields: {
  16795. xml: "responseXML",
  16796. text: "responseText",
  16797. json: "responseJSON"
  16798. },
  16799. // Data converters
  16800. // Keys separate source (or catchall "*") and destination types with a single space
  16801. converters: {
  16802. // Convert anything to text
  16803. "* text": String,
  16804. // Text to html (true = no transformation)
  16805. "text html": true,
  16806. // Evaluate text as a json expression
  16807. "text json": JSON.parse,
  16808. // Parse text as xml
  16809. "text xml": jQuery.parseXML
  16810. },
  16811. // For options that shouldn't be deep extended:
  16812. // you can add your own custom options here if
  16813. // and when you create one that shouldn't be
  16814. // deep extended (see ajaxExtend)
  16815. flatOptions: {
  16816. url: true,
  16817. context: true
  16818. }
  16819. },
  16820. // Creates a full fledged settings object into target
  16821. // with both ajaxSettings and settings fields.
  16822. // If target is omitted, writes into ajaxSettings.
  16823. ajaxSetup: function( target, settings ) {
  16824. return settings ?
  16825. // Building a settings object
  16826. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16827. // Extending ajaxSettings
  16828. ajaxExtend( jQuery.ajaxSettings, target );
  16829. },
  16830. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16831. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16832. // Main method
  16833. ajax: function( url, options ) {
  16834. // If url is an object, simulate pre-1.5 signature
  16835. if ( typeof url === "object" ) {
  16836. options = url;
  16837. url = undefined;
  16838. }
  16839. // Force options to be an object
  16840. options = options || {};
  16841. var transport,
  16842. // URL without anti-cache param
  16843. cacheURL,
  16844. // Response headers
  16845. responseHeadersString,
  16846. responseHeaders,
  16847. // timeout handle
  16848. timeoutTimer,
  16849. // Url cleanup var
  16850. urlAnchor,
  16851. // Request state (becomes false upon send and true upon completion)
  16852. completed,
  16853. // To know if global events are to be dispatched
  16854. fireGlobals,
  16855. // Loop variable
  16856. i,
  16857. // uncached part of the url
  16858. uncached,
  16859. // Create the final options object
  16860. s = jQuery.ajaxSetup( {}, options ),
  16861. // Callbacks context
  16862. callbackContext = s.context || s,
  16863. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16864. globalEventContext = s.context &&
  16865. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16866. jQuery( callbackContext ) :
  16867. jQuery.event,
  16868. // Deferreds
  16869. deferred = jQuery.Deferred(),
  16870. completeDeferred = jQuery.Callbacks( "once memory" ),
  16871. // Status-dependent callbacks
  16872. statusCode = s.statusCode || {},
  16873. // Headers (they are sent all at once)
  16874. requestHeaders = {},
  16875. requestHeadersNames = {},
  16876. // Default abort message
  16877. strAbort = "canceled",
  16878. // Fake xhr
  16879. jqXHR = {
  16880. readyState: 0,
  16881. // Builds headers hashtable if needed
  16882. getResponseHeader: function( key ) {
  16883. var match;
  16884. if ( completed ) {
  16885. if ( !responseHeaders ) {
  16886. responseHeaders = {};
  16887. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16888. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16889. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16890. .concat( match[ 2 ] );
  16891. }
  16892. }
  16893. match = responseHeaders[ key.toLowerCase() + " " ];
  16894. }
  16895. return match == null ? null : match.join( ", " );
  16896. },
  16897. // Raw string
  16898. getAllResponseHeaders: function() {
  16899. return completed ? responseHeadersString : null;
  16900. },
  16901. // Caches the header
  16902. setRequestHeader: function( name, value ) {
  16903. if ( completed == null ) {
  16904. name = requestHeadersNames[ name.toLowerCase() ] =
  16905. requestHeadersNames[ name.toLowerCase() ] || name;
  16906. requestHeaders[ name ] = value;
  16907. }
  16908. return this;
  16909. },
  16910. // Overrides response content-type header
  16911. overrideMimeType: function( type ) {
  16912. if ( completed == null ) {
  16913. s.mimeType = type;
  16914. }
  16915. return this;
  16916. },
  16917. // Status-dependent callbacks
  16918. statusCode: function( map ) {
  16919. var code;
  16920. if ( map ) {
  16921. if ( completed ) {
  16922. // Execute the appropriate callbacks
  16923. jqXHR.always( map[ jqXHR.status ] );
  16924. } else {
  16925. // Lazy-add the new callbacks in a way that preserves old ones
  16926. for ( code in map ) {
  16927. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16928. }
  16929. }
  16930. }
  16931. return this;
  16932. },
  16933. // Cancel the request
  16934. abort: function( statusText ) {
  16935. var finalText = statusText || strAbort;
  16936. if ( transport ) {
  16937. transport.abort( finalText );
  16938. }
  16939. done( 0, finalText );
  16940. return this;
  16941. }
  16942. };
  16943. // Attach deferreds
  16944. deferred.promise( jqXHR );
  16945. // Add protocol if not provided (prefilters might expect it)
  16946. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16947. // We also use the url parameter if available
  16948. s.url = ( ( url || s.url || location.href ) + "" )
  16949. .replace( rprotocol, location.protocol + "//" );
  16950. // Alias method option to type as per ticket #12004
  16951. s.type = options.method || options.type || s.method || s.type;
  16952. // Extract dataTypes list
  16953. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16954. // A cross-domain request is in order when the origin doesn't match the current origin.
  16955. if ( s.crossDomain == null ) {
  16956. urlAnchor = document.createElement( "a" );
  16957. // Support: IE <=8 - 11, Edge 12 - 15
  16958. // IE throws exception on accessing the href property if url is malformed,
  16959. // e.g. http://example.com:80x/
  16960. try {
  16961. urlAnchor.href = s.url;
  16962. // Support: IE <=8 - 11 only
  16963. // Anchor's host property isn't correctly set when s.url is relative
  16964. urlAnchor.href = urlAnchor.href;
  16965. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16966. urlAnchor.protocol + "//" + urlAnchor.host;
  16967. } catch ( e ) {
  16968. // If there is an error parsing the URL, assume it is crossDomain,
  16969. // it can be rejected by the transport if it is invalid
  16970. s.crossDomain = true;
  16971. }
  16972. }
  16973. // Convert data if not already a string
  16974. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16975. s.data = jQuery.param( s.data, s.traditional );
  16976. }
  16977. // Apply prefilters
  16978. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16979. // If request was aborted inside a prefilter, stop there
  16980. if ( completed ) {
  16981. return jqXHR;
  16982. }
  16983. // We can fire global events as of now if asked to
  16984. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16985. fireGlobals = jQuery.event && s.global;
  16986. // Watch for a new set of requests
  16987. if ( fireGlobals && jQuery.active++ === 0 ) {
  16988. jQuery.event.trigger( "ajaxStart" );
  16989. }
  16990. // Uppercase the type
  16991. s.type = s.type.toUpperCase();
  16992. // Determine if request has content
  16993. s.hasContent = !rnoContent.test( s.type );
  16994. // Save the URL in case we're toying with the If-Modified-Since
  16995. // and/or If-None-Match header later on
  16996. // Remove hash to simplify url manipulation
  16997. cacheURL = s.url.replace( rhash, "" );
  16998. // More options handling for requests with no content
  16999. if ( !s.hasContent ) {
  17000. // Remember the hash so we can put it back
  17001. uncached = s.url.slice( cacheURL.length );
  17002. // If data is available and should be processed, append data to url
  17003. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17004. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17005. // #9682: remove data so that it's not used in an eventual retry
  17006. delete s.data;
  17007. }
  17008. // Add or update anti-cache param if needed
  17009. if ( s.cache === false ) {
  17010. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17011. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17012. }
  17013. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17014. s.url = cacheURL + uncached;
  17015. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17016. } else if ( s.data && s.processData &&
  17017. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17018. s.data = s.data.replace( r20, "+" );
  17019. }
  17020. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17021. if ( s.ifModified ) {
  17022. if ( jQuery.lastModified[ cacheURL ] ) {
  17023. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17024. }
  17025. if ( jQuery.etag[ cacheURL ] ) {
  17026. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17027. }
  17028. }
  17029. // Set the correct header, if data is being sent
  17030. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17031. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17032. }
  17033. // Set the Accepts header for the server, depending on the dataType
  17034. jqXHR.setRequestHeader(
  17035. "Accept",
  17036. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17037. s.accepts[ s.dataTypes[ 0 ] ] +
  17038. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17039. s.accepts[ "*" ]
  17040. );
  17041. // Check for headers option
  17042. for ( i in s.headers ) {
  17043. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17044. }
  17045. // Allow custom headers/mimetypes and early abort
  17046. if ( s.beforeSend &&
  17047. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17048. // Abort if not done already and return
  17049. return jqXHR.abort();
  17050. }
  17051. // Aborting is no longer a cancellation
  17052. strAbort = "abort";
  17053. // Install callbacks on deferreds
  17054. completeDeferred.add( s.complete );
  17055. jqXHR.done( s.success );
  17056. jqXHR.fail( s.error );
  17057. // Get transport
  17058. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17059. // If no transport, we auto-abort
  17060. if ( !transport ) {
  17061. done( -1, "No Transport" );
  17062. } else {
  17063. jqXHR.readyState = 1;
  17064. // Send global event
  17065. if ( fireGlobals ) {
  17066. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17067. }
  17068. // If request was aborted inside ajaxSend, stop there
  17069. if ( completed ) {
  17070. return jqXHR;
  17071. }
  17072. // Timeout
  17073. if ( s.async && s.timeout > 0 ) {
  17074. timeoutTimer = window.setTimeout( function() {
  17075. jqXHR.abort( "timeout" );
  17076. }, s.timeout );
  17077. }
  17078. try {
  17079. completed = false;
  17080. transport.send( requestHeaders, done );
  17081. } catch ( e ) {
  17082. // Rethrow post-completion exceptions
  17083. if ( completed ) {
  17084. throw e;
  17085. }
  17086. // Propagate others as results
  17087. done( -1, e );
  17088. }
  17089. }
  17090. // Callback for when everything is done
  17091. function done( status, nativeStatusText, responses, headers ) {
  17092. var isSuccess, success, error, response, modified,
  17093. statusText = nativeStatusText;
  17094. // Ignore repeat invocations
  17095. if ( completed ) {
  17096. return;
  17097. }
  17098. completed = true;
  17099. // Clear timeout if it exists
  17100. if ( timeoutTimer ) {
  17101. window.clearTimeout( timeoutTimer );
  17102. }
  17103. // Dereference transport for early garbage collection
  17104. // (no matter how long the jqXHR object will be used)
  17105. transport = undefined;
  17106. // Cache response headers
  17107. responseHeadersString = headers || "";
  17108. // Set readyState
  17109. jqXHR.readyState = status > 0 ? 4 : 0;
  17110. // Determine if successful
  17111. isSuccess = status >= 200 && status < 300 || status === 304;
  17112. // Get response data
  17113. if ( responses ) {
  17114. response = ajaxHandleResponses( s, jqXHR, responses );
  17115. }
  17116. // Convert no matter what (that way responseXXX fields are always set)
  17117. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17118. // If successful, handle type chaining
  17119. if ( isSuccess ) {
  17120. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17121. if ( s.ifModified ) {
  17122. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17123. if ( modified ) {
  17124. jQuery.lastModified[ cacheURL ] = modified;
  17125. }
  17126. modified = jqXHR.getResponseHeader( "etag" );
  17127. if ( modified ) {
  17128. jQuery.etag[ cacheURL ] = modified;
  17129. }
  17130. }
  17131. // if no content
  17132. if ( status === 204 || s.type === "HEAD" ) {
  17133. statusText = "nocontent";
  17134. // if not modified
  17135. } else if ( status === 304 ) {
  17136. statusText = "notmodified";
  17137. // If we have data, let's convert it
  17138. } else {
  17139. statusText = response.state;
  17140. success = response.data;
  17141. error = response.error;
  17142. isSuccess = !error;
  17143. }
  17144. } else {
  17145. // Extract error from statusText and normalize for non-aborts
  17146. error = statusText;
  17147. if ( status || !statusText ) {
  17148. statusText = "error";
  17149. if ( status < 0 ) {
  17150. status = 0;
  17151. }
  17152. }
  17153. }
  17154. // Set data for the fake xhr object
  17155. jqXHR.status = status;
  17156. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17157. // Success/Error
  17158. if ( isSuccess ) {
  17159. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17160. } else {
  17161. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17162. }
  17163. // Status-dependent callbacks
  17164. jqXHR.statusCode( statusCode );
  17165. statusCode = undefined;
  17166. if ( fireGlobals ) {
  17167. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17168. [ jqXHR, s, isSuccess ? success : error ] );
  17169. }
  17170. // Complete
  17171. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17172. if ( fireGlobals ) {
  17173. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17174. // Handle the global AJAX counter
  17175. if ( !( --jQuery.active ) ) {
  17176. jQuery.event.trigger( "ajaxStop" );
  17177. }
  17178. }
  17179. }
  17180. return jqXHR;
  17181. },
  17182. getJSON: function( url, data, callback ) {
  17183. return jQuery.get( url, data, callback, "json" );
  17184. },
  17185. getScript: function( url, callback ) {
  17186. return jQuery.get( url, undefined, callback, "script" );
  17187. }
  17188. } );
  17189. jQuery.each( [ "get", "post" ], function( i, method ) {
  17190. jQuery[ method ] = function( url, data, callback, type ) {
  17191. // Shift arguments if data argument was omitted
  17192. if ( isFunction( data ) ) {
  17193. type = type || callback;
  17194. callback = data;
  17195. data = undefined;
  17196. }
  17197. // The url can be an options object (which then must have .url)
  17198. return jQuery.ajax( jQuery.extend( {
  17199. url: url,
  17200. type: method,
  17201. dataType: type,
  17202. data: data,
  17203. success: callback
  17204. }, jQuery.isPlainObject( url ) && url ) );
  17205. };
  17206. } );
  17207. jQuery._evalUrl = function( url, options ) {
  17208. return jQuery.ajax( {
  17209. url: url,
  17210. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17211. type: "GET",
  17212. dataType: "script",
  17213. cache: true,
  17214. async: false,
  17215. global: false,
  17216. // Only evaluate the response if it is successful (gh-4126)
  17217. // dataFilter is not invoked for failure responses, so using it instead
  17218. // of the default converter is kludgy but it works.
  17219. converters: {
  17220. "text script": function() {}
  17221. },
  17222. dataFilter: function( response ) {
  17223. jQuery.globalEval( response, options );
  17224. }
  17225. } );
  17226. };
  17227. jQuery.fn.extend( {
  17228. wrapAll: function( html ) {
  17229. var wrap;
  17230. if ( this[ 0 ] ) {
  17231. if ( isFunction( html ) ) {
  17232. html = html.call( this[ 0 ] );
  17233. }
  17234. // The elements to wrap the target around
  17235. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17236. if ( this[ 0 ].parentNode ) {
  17237. wrap.insertBefore( this[ 0 ] );
  17238. }
  17239. wrap.map( function() {
  17240. var elem = this;
  17241. while ( elem.firstElementChild ) {
  17242. elem = elem.firstElementChild;
  17243. }
  17244. return elem;
  17245. } ).append( this );
  17246. }
  17247. return this;
  17248. },
  17249. wrapInner: function( html ) {
  17250. if ( isFunction( html ) ) {
  17251. return this.each( function( i ) {
  17252. jQuery( this ).wrapInner( html.call( this, i ) );
  17253. } );
  17254. }
  17255. return this.each( function() {
  17256. var self = jQuery( this ),
  17257. contents = self.contents();
  17258. if ( contents.length ) {
  17259. contents.wrapAll( html );
  17260. } else {
  17261. self.append( html );
  17262. }
  17263. } );
  17264. },
  17265. wrap: function( html ) {
  17266. var htmlIsFunction = isFunction( html );
  17267. return this.each( function( i ) {
  17268. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17269. } );
  17270. },
  17271. unwrap: function( selector ) {
  17272. this.parent( selector ).not( "body" ).each( function() {
  17273. jQuery( this ).replaceWith( this.childNodes );
  17274. } );
  17275. return this;
  17276. }
  17277. } );
  17278. jQuery.expr.pseudos.hidden = function( elem ) {
  17279. return !jQuery.expr.pseudos.visible( elem );
  17280. };
  17281. jQuery.expr.pseudos.visible = function( elem ) {
  17282. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17283. };
  17284. jQuery.ajaxSettings.xhr = function() {
  17285. try {
  17286. return new window.XMLHttpRequest();
  17287. } catch ( e ) {}
  17288. };
  17289. var xhrSuccessStatus = {
  17290. // File protocol always yields status code 0, assume 200
  17291. 0: 200,
  17292. // Support: IE <=9 only
  17293. // #1450: sometimes IE returns 1223 when it should be 204
  17294. 1223: 204
  17295. },
  17296. xhrSupported = jQuery.ajaxSettings.xhr();
  17297. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17298. support.ajax = xhrSupported = !!xhrSupported;
  17299. jQuery.ajaxTransport( function( options ) {
  17300. var callback, errorCallback;
  17301. // Cross domain only allowed if supported through XMLHttpRequest
  17302. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17303. return {
  17304. send: function( headers, complete ) {
  17305. var i,
  17306. xhr = options.xhr();
  17307. xhr.open(
  17308. options.type,
  17309. options.url,
  17310. options.async,
  17311. options.username,
  17312. options.password
  17313. );
  17314. // Apply custom fields if provided
  17315. if ( options.xhrFields ) {
  17316. for ( i in options.xhrFields ) {
  17317. xhr[ i ] = options.xhrFields[ i ];
  17318. }
  17319. }
  17320. // Override mime type if needed
  17321. if ( options.mimeType && xhr.overrideMimeType ) {
  17322. xhr.overrideMimeType( options.mimeType );
  17323. }
  17324. // X-Requested-With header
  17325. // For cross-domain requests, seeing as conditions for a preflight are
  17326. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17327. // (it can always be set on a per-request basis or even using ajaxSetup)
  17328. // For same-domain requests, won't change header if already provided.
  17329. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17330. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17331. }
  17332. // Set headers
  17333. for ( i in headers ) {
  17334. xhr.setRequestHeader( i, headers[ i ] );
  17335. }
  17336. // Callback
  17337. callback = function( type ) {
  17338. return function() {
  17339. if ( callback ) {
  17340. callback = errorCallback = xhr.onload =
  17341. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17342. xhr.onreadystatechange = null;
  17343. if ( type === "abort" ) {
  17344. xhr.abort();
  17345. } else if ( type === "error" ) {
  17346. // Support: IE <=9 only
  17347. // On a manual native abort, IE9 throws
  17348. // errors on any property access that is not readyState
  17349. if ( typeof xhr.status !== "number" ) {
  17350. complete( 0, "error" );
  17351. } else {
  17352. complete(
  17353. // File: protocol always yields status 0; see #8605, #14207
  17354. xhr.status,
  17355. xhr.statusText
  17356. );
  17357. }
  17358. } else {
  17359. complete(
  17360. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17361. xhr.statusText,
  17362. // Support: IE <=9 only
  17363. // IE9 has no XHR2 but throws on binary (trac-11426)
  17364. // For XHR2 non-text, let the caller handle it (gh-2498)
  17365. ( xhr.responseType || "text" ) !== "text" ||
  17366. typeof xhr.responseText !== "string" ?
  17367. { binary: xhr.response } :
  17368. { text: xhr.responseText },
  17369. xhr.getAllResponseHeaders()
  17370. );
  17371. }
  17372. }
  17373. };
  17374. };
  17375. // Listen to events
  17376. xhr.onload = callback();
  17377. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17378. // Support: IE 9 only
  17379. // Use onreadystatechange to replace onabort
  17380. // to handle uncaught aborts
  17381. if ( xhr.onabort !== undefined ) {
  17382. xhr.onabort = errorCallback;
  17383. } else {
  17384. xhr.onreadystatechange = function() {
  17385. // Check readyState before timeout as it changes
  17386. if ( xhr.readyState === 4 ) {
  17387. // Allow onerror to be called first,
  17388. // but that will not handle a native abort
  17389. // Also, save errorCallback to a variable
  17390. // as xhr.onerror cannot be accessed
  17391. window.setTimeout( function() {
  17392. if ( callback ) {
  17393. errorCallback();
  17394. }
  17395. } );
  17396. }
  17397. };
  17398. }
  17399. // Create the abort callback
  17400. callback = callback( "abort" );
  17401. try {
  17402. // Do send the request (this may raise an exception)
  17403. xhr.send( options.hasContent && options.data || null );
  17404. } catch ( e ) {
  17405. // #14683: Only rethrow if this hasn't been notified as an error yet
  17406. if ( callback ) {
  17407. throw e;
  17408. }
  17409. }
  17410. },
  17411. abort: function() {
  17412. if ( callback ) {
  17413. callback();
  17414. }
  17415. }
  17416. };
  17417. }
  17418. } );
  17419. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17420. jQuery.ajaxPrefilter( function( s ) {
  17421. if ( s.crossDomain ) {
  17422. s.contents.script = false;
  17423. }
  17424. } );
  17425. // Install script dataType
  17426. jQuery.ajaxSetup( {
  17427. accepts: {
  17428. script: "text/javascript, application/javascript, " +
  17429. "application/ecmascript, application/x-ecmascript"
  17430. },
  17431. contents: {
  17432. script: /\b(?:java|ecma)script\b/
  17433. },
  17434. converters: {
  17435. "text script": function( text ) {
  17436. jQuery.globalEval( text );
  17437. return text;
  17438. }
  17439. }
  17440. } );
  17441. // Handle cache's special case and crossDomain
  17442. jQuery.ajaxPrefilter( "script", function( s ) {
  17443. if ( s.cache === undefined ) {
  17444. s.cache = false;
  17445. }
  17446. if ( s.crossDomain ) {
  17447. s.type = "GET";
  17448. }
  17449. } );
  17450. // Bind script tag hack transport
  17451. jQuery.ajaxTransport( "script", function( s ) {
  17452. // This transport only deals with cross domain or forced-by-attrs requests
  17453. if ( s.crossDomain || s.scriptAttrs ) {
  17454. var script, callback;
  17455. return {
  17456. send: function( _, complete ) {
  17457. script = jQuery( "<script>" )
  17458. .attr( s.scriptAttrs || {} )
  17459. .prop( { charset: s.scriptCharset, src: s.url } )
  17460. .on( "load error", callback = function( evt ) {
  17461. script.remove();
  17462. callback = null;
  17463. if ( evt ) {
  17464. complete( evt.type === "error" ? 404 : 200, evt.type );
  17465. }
  17466. } );
  17467. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17468. document.head.appendChild( script[ 0 ] );
  17469. },
  17470. abort: function() {
  17471. if ( callback ) {
  17472. callback();
  17473. }
  17474. }
  17475. };
  17476. }
  17477. } );
  17478. var oldCallbacks = [],
  17479. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17480. // Default jsonp settings
  17481. jQuery.ajaxSetup( {
  17482. jsonp: "callback",
  17483. jsonpCallback: function() {
  17484. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17485. this[ callback ] = true;
  17486. return callback;
  17487. }
  17488. } );
  17489. // Detect, normalize options and install callbacks for jsonp requests
  17490. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17491. var callbackName, overwritten, responseContainer,
  17492. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17493. "url" :
  17494. typeof s.data === "string" &&
  17495. ( s.contentType || "" )
  17496. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17497. rjsonp.test( s.data ) && "data"
  17498. );
  17499. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17500. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17501. // Get callback name, remembering preexisting value associated with it
  17502. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17503. s.jsonpCallback() :
  17504. s.jsonpCallback;
  17505. // Insert callback into url or form data
  17506. if ( jsonProp ) {
  17507. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17508. } else if ( s.jsonp !== false ) {
  17509. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17510. }
  17511. // Use data converter to retrieve json after script execution
  17512. s.converters[ "script json" ] = function() {
  17513. if ( !responseContainer ) {
  17514. jQuery.error( callbackName + " was not called" );
  17515. }
  17516. return responseContainer[ 0 ];
  17517. };
  17518. // Force json dataType
  17519. s.dataTypes[ 0 ] = "json";
  17520. // Install callback
  17521. overwritten = window[ callbackName ];
  17522. window[ callbackName ] = function() {
  17523. responseContainer = arguments;
  17524. };
  17525. // Clean-up function (fires after converters)
  17526. jqXHR.always( function() {
  17527. // If previous value didn't exist - remove it
  17528. if ( overwritten === undefined ) {
  17529. jQuery( window ).removeProp( callbackName );
  17530. // Otherwise restore preexisting value
  17531. } else {
  17532. window[ callbackName ] = overwritten;
  17533. }
  17534. // Save back as free
  17535. if ( s[ callbackName ] ) {
  17536. // Make sure that re-using the options doesn't screw things around
  17537. s.jsonpCallback = originalSettings.jsonpCallback;
  17538. // Save the callback name for future use
  17539. oldCallbacks.push( callbackName );
  17540. }
  17541. // Call if it was a function and we have a response
  17542. if ( responseContainer && isFunction( overwritten ) ) {
  17543. overwritten( responseContainer[ 0 ] );
  17544. }
  17545. responseContainer = overwritten = undefined;
  17546. } );
  17547. // Delegate to script
  17548. return "script";
  17549. }
  17550. } );
  17551. // Support: Safari 8 only
  17552. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17553. // collapse sibling forms: the second one becomes a child of the first one.
  17554. // Because of that, this security measure has to be disabled in Safari 8.
  17555. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17556. support.createHTMLDocument = ( function() {
  17557. var body = document.implementation.createHTMLDocument( "" ).body;
  17558. body.innerHTML = "<form></form><form></form>";
  17559. return body.childNodes.length === 2;
  17560. } )();
  17561. // Argument "data" should be string of html
  17562. // context (optional): If specified, the fragment will be created in this context,
  17563. // defaults to document
  17564. // keepScripts (optional): If true, will include scripts passed in the html string
  17565. jQuery.parseHTML = function( data, context, keepScripts ) {
  17566. if ( typeof data !== "string" ) {
  17567. return [];
  17568. }
  17569. if ( typeof context === "boolean" ) {
  17570. keepScripts = context;
  17571. context = false;
  17572. }
  17573. var base, parsed, scripts;
  17574. if ( !context ) {
  17575. // Stop scripts or inline event handlers from being executed immediately
  17576. // by using document.implementation
  17577. if ( support.createHTMLDocument ) {
  17578. context = document.implementation.createHTMLDocument( "" );
  17579. // Set the base href for the created document
  17580. // so any parsed elements with URLs
  17581. // are based on the document's URL (gh-2965)
  17582. base = context.createElement( "base" );
  17583. base.href = document.location.href;
  17584. context.head.appendChild( base );
  17585. } else {
  17586. context = document;
  17587. }
  17588. }
  17589. parsed = rsingleTag.exec( data );
  17590. scripts = !keepScripts && [];
  17591. // Single tag
  17592. if ( parsed ) {
  17593. return [ context.createElement( parsed[ 1 ] ) ];
  17594. }
  17595. parsed = buildFragment( [ data ], context, scripts );
  17596. if ( scripts && scripts.length ) {
  17597. jQuery( scripts ).remove();
  17598. }
  17599. return jQuery.merge( [], parsed.childNodes );
  17600. };
  17601. /**
  17602. * Load a url into a page
  17603. */
  17604. jQuery.fn.load = function( url, params, callback ) {
  17605. var selector, type, response,
  17606. self = this,
  17607. off = url.indexOf( " " );
  17608. if ( off > -1 ) {
  17609. selector = stripAndCollapse( url.slice( off ) );
  17610. url = url.slice( 0, off );
  17611. }
  17612. // If it's a function
  17613. if ( isFunction( params ) ) {
  17614. // We assume that it's the callback
  17615. callback = params;
  17616. params = undefined;
  17617. // Otherwise, build a param string
  17618. } else if ( params && typeof params === "object" ) {
  17619. type = "POST";
  17620. }
  17621. // If we have elements to modify, make the request
  17622. if ( self.length > 0 ) {
  17623. jQuery.ajax( {
  17624. url: url,
  17625. // If "type" variable is undefined, then "GET" method will be used.
  17626. // Make value of this field explicit since
  17627. // user can override it through ajaxSetup method
  17628. type: type || "GET",
  17629. dataType: "html",
  17630. data: params
  17631. } ).done( function( responseText ) {
  17632. // Save response for use in complete callback
  17633. response = arguments;
  17634. self.html( selector ?
  17635. // If a selector was specified, locate the right elements in a dummy div
  17636. // Exclude scripts to avoid IE 'Permission Denied' errors
  17637. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17638. // Otherwise use the full result
  17639. responseText );
  17640. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17641. // but they are ignored because response was set above.
  17642. // If it fails, this function gets "jqXHR", "status", "error"
  17643. } ).always( callback && function( jqXHR, status ) {
  17644. self.each( function() {
  17645. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17646. } );
  17647. } );
  17648. }
  17649. return this;
  17650. };
  17651. // Attach a bunch of functions for handling common AJAX events
  17652. jQuery.each( [
  17653. "ajaxStart",
  17654. "ajaxStop",
  17655. "ajaxComplete",
  17656. "ajaxError",
  17657. "ajaxSuccess",
  17658. "ajaxSend"
  17659. ], function( i, type ) {
  17660. jQuery.fn[ type ] = function( fn ) {
  17661. return this.on( type, fn );
  17662. };
  17663. } );
  17664. jQuery.expr.pseudos.animated = function( elem ) {
  17665. return jQuery.grep( jQuery.timers, function( fn ) {
  17666. return elem === fn.elem;
  17667. } ).length;
  17668. };
  17669. jQuery.offset = {
  17670. setOffset: function( elem, options, i ) {
  17671. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17672. position = jQuery.css( elem, "position" ),
  17673. curElem = jQuery( elem ),
  17674. props = {};
  17675. // Set position first, in-case top/left are set even on static elem
  17676. if ( position === "static" ) {
  17677. elem.style.position = "relative";
  17678. }
  17679. curOffset = curElem.offset();
  17680. curCSSTop = jQuery.css( elem, "top" );
  17681. curCSSLeft = jQuery.css( elem, "left" );
  17682. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17683. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17684. // Need to be able to calculate position if either
  17685. // top or left is auto and position is either absolute or fixed
  17686. if ( calculatePosition ) {
  17687. curPosition = curElem.position();
  17688. curTop = curPosition.top;
  17689. curLeft = curPosition.left;
  17690. } else {
  17691. curTop = parseFloat( curCSSTop ) || 0;
  17692. curLeft = parseFloat( curCSSLeft ) || 0;
  17693. }
  17694. if ( isFunction( options ) ) {
  17695. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17696. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17697. }
  17698. if ( options.top != null ) {
  17699. props.top = ( options.top - curOffset.top ) + curTop;
  17700. }
  17701. if ( options.left != null ) {
  17702. props.left = ( options.left - curOffset.left ) + curLeft;
  17703. }
  17704. if ( "using" in options ) {
  17705. options.using.call( elem, props );
  17706. } else {
  17707. curElem.css( props );
  17708. }
  17709. }
  17710. };
  17711. jQuery.fn.extend( {
  17712. // offset() relates an element's border box to the document origin
  17713. offset: function( options ) {
  17714. // Preserve chaining for setter
  17715. if ( arguments.length ) {
  17716. return options === undefined ?
  17717. this :
  17718. this.each( function( i ) {
  17719. jQuery.offset.setOffset( this, options, i );
  17720. } );
  17721. }
  17722. var rect, win,
  17723. elem = this[ 0 ];
  17724. if ( !elem ) {
  17725. return;
  17726. }
  17727. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17728. // Support: IE <=11 only
  17729. // Running getBoundingClientRect on a
  17730. // disconnected node in IE throws an error
  17731. if ( !elem.getClientRects().length ) {
  17732. return { top: 0, left: 0 };
  17733. }
  17734. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17735. rect = elem.getBoundingClientRect();
  17736. win = elem.ownerDocument.defaultView;
  17737. return {
  17738. top: rect.top + win.pageYOffset,
  17739. left: rect.left + win.pageXOffset
  17740. };
  17741. },
  17742. // position() relates an element's margin box to its offset parent's padding box
  17743. // This corresponds to the behavior of CSS absolute positioning
  17744. position: function() {
  17745. if ( !this[ 0 ] ) {
  17746. return;
  17747. }
  17748. var offsetParent, offset, doc,
  17749. elem = this[ 0 ],
  17750. parentOffset = { top: 0, left: 0 };
  17751. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17752. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17753. // Assume position:fixed implies availability of getBoundingClientRect
  17754. offset = elem.getBoundingClientRect();
  17755. } else {
  17756. offset = this.offset();
  17757. // Account for the *real* offset parent, which can be the document or its root element
  17758. // when a statically positioned element is identified
  17759. doc = elem.ownerDocument;
  17760. offsetParent = elem.offsetParent || doc.documentElement;
  17761. while ( offsetParent &&
  17762. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17763. jQuery.css( offsetParent, "position" ) === "static" ) {
  17764. offsetParent = offsetParent.parentNode;
  17765. }
  17766. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17767. // Incorporate borders into its offset, since they are outside its content origin
  17768. parentOffset = jQuery( offsetParent ).offset();
  17769. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17770. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17771. }
  17772. }
  17773. // Subtract parent offsets and element margins
  17774. return {
  17775. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17776. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17777. };
  17778. },
  17779. // This method will return documentElement in the following cases:
  17780. // 1) For the element inside the iframe without offsetParent, this method will return
  17781. // documentElement of the parent window
  17782. // 2) For the hidden or detached element
  17783. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17784. //
  17785. // but those exceptions were never presented as a real life use-cases
  17786. // and might be considered as more preferable results.
  17787. //
  17788. // This logic, however, is not guaranteed and can change at any point in the future
  17789. offsetParent: function() {
  17790. return this.map( function() {
  17791. var offsetParent = this.offsetParent;
  17792. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17793. offsetParent = offsetParent.offsetParent;
  17794. }
  17795. return offsetParent || documentElement;
  17796. } );
  17797. }
  17798. } );
  17799. // Create scrollLeft and scrollTop methods
  17800. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17801. var top = "pageYOffset" === prop;
  17802. jQuery.fn[ method ] = function( val ) {
  17803. return access( this, function( elem, method, val ) {
  17804. // Coalesce documents and windows
  17805. var win;
  17806. if ( isWindow( elem ) ) {
  17807. win = elem;
  17808. } else if ( elem.nodeType === 9 ) {
  17809. win = elem.defaultView;
  17810. }
  17811. if ( val === undefined ) {
  17812. return win ? win[ prop ] : elem[ method ];
  17813. }
  17814. if ( win ) {
  17815. win.scrollTo(
  17816. !top ? val : win.pageXOffset,
  17817. top ? val : win.pageYOffset
  17818. );
  17819. } else {
  17820. elem[ method ] = val;
  17821. }
  17822. }, method, val, arguments.length );
  17823. };
  17824. } );
  17825. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17826. // Add the top/left cssHooks using jQuery.fn.position
  17827. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17828. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17829. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17830. // rather than make the css module depend on the offset module, just check for it here
  17831. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17832. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17833. function( elem, computed ) {
  17834. if ( computed ) {
  17835. computed = curCSS( elem, prop );
  17836. // If curCSS returns percentage, fallback to offset
  17837. return rnumnonpx.test( computed ) ?
  17838. jQuery( elem ).position()[ prop ] + "px" :
  17839. computed;
  17840. }
  17841. }
  17842. );
  17843. } );
  17844. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17845. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17846. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17847. function( defaultExtra, funcName ) {
  17848. // Margin is only for outerHeight, outerWidth
  17849. jQuery.fn[ funcName ] = function( margin, value ) {
  17850. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17851. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17852. return access( this, function( elem, type, value ) {
  17853. var doc;
  17854. if ( isWindow( elem ) ) {
  17855. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17856. return funcName.indexOf( "outer" ) === 0 ?
  17857. elem[ "inner" + name ] :
  17858. elem.document.documentElement[ "client" + name ];
  17859. }
  17860. // Get document width or height
  17861. if ( elem.nodeType === 9 ) {
  17862. doc = elem.documentElement;
  17863. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17864. // whichever is greatest
  17865. return Math.max(
  17866. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17867. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17868. doc[ "client" + name ]
  17869. );
  17870. }
  17871. return value === undefined ?
  17872. // Get width or height on the element, requesting but not forcing parseFloat
  17873. jQuery.css( elem, type, extra ) :
  17874. // Set width or height on the element
  17875. jQuery.style( elem, type, value, extra );
  17876. }, type, chainable ? margin : undefined, chainable );
  17877. };
  17878. } );
  17879. } );
  17880. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17881. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17882. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17883. function( i, name ) {
  17884. // Handle event binding
  17885. jQuery.fn[ name ] = function( data, fn ) {
  17886. return arguments.length > 0 ?
  17887. this.on( name, null, data, fn ) :
  17888. this.trigger( name );
  17889. };
  17890. } );
  17891. jQuery.fn.extend( {
  17892. hover: function( fnOver, fnOut ) {
  17893. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17894. }
  17895. } );
  17896. jQuery.fn.extend( {
  17897. bind: function( types, data, fn ) {
  17898. return this.on( types, null, data, fn );
  17899. },
  17900. unbind: function( types, fn ) {
  17901. return this.off( types, null, fn );
  17902. },
  17903. delegate: function( selector, types, data, fn ) {
  17904. return this.on( types, selector, data, fn );
  17905. },
  17906. undelegate: function( selector, types, fn ) {
  17907. // ( namespace ) or ( selector, types [, fn] )
  17908. return arguments.length === 1 ?
  17909. this.off( selector, "**" ) :
  17910. this.off( types, selector || "**", fn );
  17911. }
  17912. } );
  17913. // Bind a function to a context, optionally partially applying any
  17914. // arguments.
  17915. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17916. // However, it is not slated for removal any time soon
  17917. jQuery.proxy = function( fn, context ) {
  17918. var tmp, args, proxy;
  17919. if ( typeof context === "string" ) {
  17920. tmp = fn[ context ];
  17921. context = fn;
  17922. fn = tmp;
  17923. }
  17924. // Quick check to determine if target is callable, in the spec
  17925. // this throws a TypeError, but we will just return undefined.
  17926. if ( !isFunction( fn ) ) {
  17927. return undefined;
  17928. }
  17929. // Simulated bind
  17930. args = slice.call( arguments, 2 );
  17931. proxy = function() {
  17932. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17933. };
  17934. // Set the guid of unique handler to the same of original handler, so it can be removed
  17935. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17936. return proxy;
  17937. };
  17938. jQuery.holdReady = function( hold ) {
  17939. if ( hold ) {
  17940. jQuery.readyWait++;
  17941. } else {
  17942. jQuery.ready( true );
  17943. }
  17944. };
  17945. jQuery.isArray = Array.isArray;
  17946. jQuery.parseJSON = JSON.parse;
  17947. jQuery.nodeName = nodeName;
  17948. jQuery.isFunction = isFunction;
  17949. jQuery.isWindow = isWindow;
  17950. jQuery.camelCase = camelCase;
  17951. jQuery.type = toType;
  17952. jQuery.now = Date.now;
  17953. jQuery.isNumeric = function( obj ) {
  17954. // As of jQuery 3.0, isNumeric is limited to
  17955. // strings and numbers (primitives or objects)
  17956. // that can be coerced to finite numbers (gh-2662)
  17957. var type = jQuery.type( obj );
  17958. return ( type === "number" || type === "string" ) &&
  17959. // parseFloat NaNs numeric-cast false positives ("")
  17960. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17961. // subtraction forces infinities to NaN
  17962. !isNaN( obj - parseFloat( obj ) );
  17963. };
  17964. // Register as a named AMD module, since jQuery can be concatenated with other
  17965. // files that may use define, but not via a proper concatenation script that
  17966. // understands anonymous AMD modules. A named AMD is safest and most robust
  17967. // way to register. Lowercase jquery is used because AMD module names are
  17968. // derived from file names, and jQuery is normally delivered in a lowercase
  17969. // file name. Do this after creating the global so that if an AMD module wants
  17970. // to call noConflict to hide this version of jQuery, it will work.
  17971. // Note that for maximum portability, libraries that are not jQuery should
  17972. // declare themselves as anonymous modules, and avoid setting a global if an
  17973. // AMD loader is present. jQuery is a special case. For more information, see
  17974. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17975. if ( true ) {
  17976. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17977. return jQuery;
  17978. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17979. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17980. }
  17981. var
  17982. // Map over jQuery in case of overwrite
  17983. _jQuery = window.jQuery,
  17984. // Map over the $ in case of overwrite
  17985. _$ = window.$;
  17986. jQuery.noConflict = function( deep ) {
  17987. if ( window.$ === jQuery ) {
  17988. window.$ = _$;
  17989. }
  17990. if ( deep && window.jQuery === jQuery ) {
  17991. window.jQuery = _jQuery;
  17992. }
  17993. return jQuery;
  17994. };
  17995. // Expose jQuery and $ identifiers, even in AMD
  17996. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17997. // and CommonJS for browser emulators (#13566)
  17998. if ( !noGlobal ) {
  17999. window.jQuery = window.$ = jQuery;
  18000. }
  18001. return jQuery;
  18002. } );
  18003. /***/ }),
  18004. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18005. /*!************************************************!*\
  18006. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18007. \************************************************/
  18008. /*! exports provided: default */
  18009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18010. "use strict";
  18011. __webpack_require__.r(__webpack_exports__);
  18012. var classCallCheck = function (instance, Constructor) {
  18013. if (!(instance instanceof Constructor)) {
  18014. throw new TypeError("Cannot call a class as a function");
  18015. }
  18016. };
  18017. var createClass = function () {
  18018. function defineProperties(target, props) {
  18019. for (var i = 0; i < props.length; i++) {
  18020. var descriptor = props[i];
  18021. descriptor.enumerable = descriptor.enumerable || false;
  18022. descriptor.configurable = true;
  18023. if ("value" in descriptor) descriptor.writable = true;
  18024. Object.defineProperty(target, descriptor.key, descriptor);
  18025. }
  18026. }
  18027. return function (Constructor, protoProps, staticProps) {
  18028. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18029. if (staticProps) defineProperties(Constructor, staticProps);
  18030. return Constructor;
  18031. };
  18032. }();
  18033. var _extends = Object.assign || function (target) {
  18034. for (var i = 1; i < arguments.length; i++) {
  18035. var source = arguments[i];
  18036. for (var key in source) {
  18037. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18038. target[key] = source[key];
  18039. }
  18040. }
  18041. }
  18042. return target;
  18043. };
  18044. var inherits = function (subClass, superClass) {
  18045. if (typeof superClass !== "function" && superClass !== null) {
  18046. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18047. }
  18048. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18049. constructor: {
  18050. value: subClass,
  18051. enumerable: false,
  18052. writable: true,
  18053. configurable: true
  18054. }
  18055. });
  18056. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18057. };
  18058. var possibleConstructorReturn = function (self, call) {
  18059. if (!self) {
  18060. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18061. }
  18062. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18063. };
  18064. var Connector = function () {
  18065. /**
  18066. * Create a new class instance.
  18067. */
  18068. function Connector(options) {
  18069. classCallCheck(this, Connector);
  18070. /**
  18071. * Default connector options.
  18072. */
  18073. this._defaultOptions = {
  18074. auth: {
  18075. headers: {}
  18076. },
  18077. authEndpoint: '/broadcasting/auth',
  18078. broadcaster: 'pusher',
  18079. csrfToken: null,
  18080. host: null,
  18081. key: null,
  18082. namespace: 'App.Events'
  18083. };
  18084. this.setOptions(options);
  18085. this.connect();
  18086. }
  18087. /**
  18088. * Merge the custom options with the defaults.
  18089. */
  18090. createClass(Connector, [{
  18091. key: 'setOptions',
  18092. value: function setOptions(options) {
  18093. this.options = _extends(this._defaultOptions, options);
  18094. if (this.csrfToken()) {
  18095. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18096. }
  18097. return options;
  18098. }
  18099. /**
  18100. * Extract the CSRF token from the page.
  18101. */
  18102. }, {
  18103. key: 'csrfToken',
  18104. value: function csrfToken() {
  18105. var selector = void 0;
  18106. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18107. return window['Laravel'].csrfToken;
  18108. } else if (this.options.csrfToken) {
  18109. return this.options.csrfToken;
  18110. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18111. return selector.getAttribute('content');
  18112. }
  18113. return null;
  18114. }
  18115. }]);
  18116. return Connector;
  18117. }();
  18118. /**
  18119. * This class represents a basic channel.
  18120. */
  18121. var Channel = function () {
  18122. function Channel() {
  18123. classCallCheck(this, Channel);
  18124. }
  18125. createClass(Channel, [{
  18126. key: 'listenForWhisper',
  18127. /**
  18128. * Listen for a whisper event on the channel instance.
  18129. */
  18130. value: function listenForWhisper(event, callback) {
  18131. return this.listen('.client-' + event, callback);
  18132. }
  18133. /**
  18134. * Listen for an event on the channel instance.
  18135. */
  18136. }, {
  18137. key: 'notification',
  18138. value: function notification(callback) {
  18139. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18140. }
  18141. /**
  18142. * Stop listening for a whispser event on the channel instance.
  18143. */
  18144. }, {
  18145. key: 'stopListeningForWhisper',
  18146. value: function stopListeningForWhisper(event) {
  18147. return this.stopListening('.client-' + event);
  18148. }
  18149. }]);
  18150. return Channel;
  18151. }();
  18152. /**
  18153. * Event name formatter
  18154. */
  18155. var EventFormatter = function () {
  18156. /**
  18157. * Create a new class instance.
  18158. */
  18159. function EventFormatter(namespace) {
  18160. classCallCheck(this, EventFormatter);
  18161. this.setNamespace(namespace);
  18162. }
  18163. /**
  18164. * Format the given event name.
  18165. */
  18166. createClass(EventFormatter, [{
  18167. key: 'format',
  18168. value: function format(event) {
  18169. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18170. return event.substr(1);
  18171. } else if (this.namespace) {
  18172. event = this.namespace + '.' + event;
  18173. }
  18174. return event.replace(/\./g, '\\');
  18175. }
  18176. /**
  18177. * Set the event namespace.
  18178. */
  18179. }, {
  18180. key: 'setNamespace',
  18181. value: function setNamespace(value) {
  18182. this.namespace = value;
  18183. }
  18184. }]);
  18185. return EventFormatter;
  18186. }();
  18187. /**
  18188. * This class represents a Pusher channel.
  18189. */
  18190. var PusherChannel = function (_Channel) {
  18191. inherits(PusherChannel, _Channel);
  18192. /**
  18193. * Create a new class instance.
  18194. */
  18195. function PusherChannel(pusher, name, options) {
  18196. classCallCheck(this, PusherChannel);
  18197. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18198. _this.name = name;
  18199. _this.pusher = pusher;
  18200. _this.options = options;
  18201. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18202. _this.subscribe();
  18203. return _this;
  18204. }
  18205. /**
  18206. * Subscribe to a Pusher channel.
  18207. */
  18208. createClass(PusherChannel, [{
  18209. key: 'subscribe',
  18210. value: function subscribe() {
  18211. this.subscription = this.pusher.subscribe(this.name);
  18212. }
  18213. /**
  18214. * Unsubscribe from a Pusher channel.
  18215. */
  18216. }, {
  18217. key: 'unsubscribe',
  18218. value: function unsubscribe() {
  18219. this.pusher.unsubscribe(this.name);
  18220. }
  18221. /**
  18222. * Listen for an event on the channel instance.
  18223. */
  18224. }, {
  18225. key: 'listen',
  18226. value: function listen(event, callback) {
  18227. this.on(this.eventFormatter.format(event), callback);
  18228. return this;
  18229. }
  18230. /**
  18231. * Stop listening for an event on the channel instance.
  18232. */
  18233. }, {
  18234. key: 'stopListening',
  18235. value: function stopListening(event) {
  18236. this.subscription.unbind(this.eventFormatter.format(event));
  18237. return this;
  18238. }
  18239. /**
  18240. * Bind a channel to an event.
  18241. */
  18242. }, {
  18243. key: 'on',
  18244. value: function on(event, callback) {
  18245. this.subscription.bind(event, callback);
  18246. return this;
  18247. }
  18248. }]);
  18249. return PusherChannel;
  18250. }(Channel);
  18251. /**
  18252. * This class represents a Pusher private channel.
  18253. */
  18254. var PusherPrivateChannel = function (_PusherChannel) {
  18255. inherits(PusherPrivateChannel, _PusherChannel);
  18256. function PusherPrivateChannel() {
  18257. classCallCheck(this, PusherPrivateChannel);
  18258. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18259. }
  18260. createClass(PusherPrivateChannel, [{
  18261. key: 'whisper',
  18262. /**
  18263. * Trigger client event on the channel.
  18264. */
  18265. value: function whisper(eventName, data) {
  18266. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18267. return this;
  18268. }
  18269. }]);
  18270. return PusherPrivateChannel;
  18271. }(PusherChannel);
  18272. /**
  18273. * This class represents a Pusher presence channel.
  18274. */
  18275. var PusherPresenceChannel = function (_PusherChannel) {
  18276. inherits(PusherPresenceChannel, _PusherChannel);
  18277. function PusherPresenceChannel() {
  18278. classCallCheck(this, PusherPresenceChannel);
  18279. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18280. }
  18281. createClass(PusherPresenceChannel, [{
  18282. key: 'here',
  18283. /**
  18284. * Register a callback to be called anytime the member list changes.
  18285. */
  18286. value: function here(callback) {
  18287. this.on('pusher:subscription_succeeded', function (data) {
  18288. callback(Object.keys(data.members).map(function (k) {
  18289. return data.members[k];
  18290. }));
  18291. });
  18292. return this;
  18293. }
  18294. /**
  18295. * Listen for someone joining the channel.
  18296. */
  18297. }, {
  18298. key: 'joining',
  18299. value: function joining(callback) {
  18300. this.on('pusher:member_added', function (member) {
  18301. callback(member.info);
  18302. });
  18303. return this;
  18304. }
  18305. /**
  18306. * Listen for someone leaving the channel.
  18307. */
  18308. }, {
  18309. key: 'leaving',
  18310. value: function leaving(callback) {
  18311. this.on('pusher:member_removed', function (member) {
  18312. callback(member.info);
  18313. });
  18314. return this;
  18315. }
  18316. /**
  18317. * Trigger client event on the channel.
  18318. */
  18319. }, {
  18320. key: 'whisper',
  18321. value: function whisper(eventName, data) {
  18322. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18323. return this;
  18324. }
  18325. }]);
  18326. return PusherPresenceChannel;
  18327. }(PusherChannel);
  18328. /**
  18329. * This class represents a Socket.io channel.
  18330. */
  18331. var SocketIoChannel = function (_Channel) {
  18332. inherits(SocketIoChannel, _Channel);
  18333. /**
  18334. * Create a new class instance.
  18335. */
  18336. function SocketIoChannel(socket, name, options) {
  18337. classCallCheck(this, SocketIoChannel);
  18338. /**
  18339. * The event callbacks applied to the channel.
  18340. */
  18341. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18342. _this.events = {};
  18343. _this.name = name;
  18344. _this.socket = socket;
  18345. _this.options = options;
  18346. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18347. _this.subscribe();
  18348. _this.configureReconnector();
  18349. return _this;
  18350. }
  18351. /**
  18352. * Subscribe to a Socket.io channel.
  18353. */
  18354. createClass(SocketIoChannel, [{
  18355. key: 'subscribe',
  18356. value: function subscribe() {
  18357. this.socket.emit('subscribe', {
  18358. channel: this.name,
  18359. auth: this.options.auth || {}
  18360. });
  18361. }
  18362. /**
  18363. * Unsubscribe from channel and ubind event callbacks.
  18364. */
  18365. }, {
  18366. key: 'unsubscribe',
  18367. value: function unsubscribe() {
  18368. this.unbind();
  18369. this.socket.emit('unsubscribe', {
  18370. channel: this.name,
  18371. auth: this.options.auth || {}
  18372. });
  18373. }
  18374. /**
  18375. * Listen for an event on the channel instance.
  18376. */
  18377. }, {
  18378. key: 'listen',
  18379. value: function listen(event, callback) {
  18380. this.on(this.eventFormatter.format(event), callback);
  18381. return this;
  18382. }
  18383. /**
  18384. * Stop listening for an event on the channel instance.
  18385. */
  18386. }, {
  18387. key: 'stopListening',
  18388. value: function stopListening(event) {
  18389. var name = this.eventFormatter.format(event);
  18390. this.socket.removeListener(name);
  18391. delete this.events[name];
  18392. return this;
  18393. }
  18394. /**
  18395. * Bind the channel's socket to an event and store the callback.
  18396. */
  18397. }, {
  18398. key: 'on',
  18399. value: function on(event, callback) {
  18400. var _this2 = this;
  18401. var listener = function listener(channel, data) {
  18402. if (_this2.name == channel) {
  18403. callback(data);
  18404. }
  18405. };
  18406. this.socket.on(event, listener);
  18407. this.bind(event, listener);
  18408. }
  18409. /**
  18410. * Attach a 'reconnect' listener and bind the event.
  18411. */
  18412. }, {
  18413. key: 'configureReconnector',
  18414. value: function configureReconnector() {
  18415. var _this3 = this;
  18416. var listener = function listener() {
  18417. _this3.subscribe();
  18418. };
  18419. this.socket.on('reconnect', listener);
  18420. this.bind('reconnect', listener);
  18421. }
  18422. /**
  18423. * Bind the channel's socket to an event and store the callback.
  18424. */
  18425. }, {
  18426. key: 'bind',
  18427. value: function bind(event, callback) {
  18428. this.events[event] = this.events[event] || [];
  18429. this.events[event].push(callback);
  18430. }
  18431. /**
  18432. * Unbind the channel's socket from all stored event callbacks.
  18433. */
  18434. }, {
  18435. key: 'unbind',
  18436. value: function unbind() {
  18437. var _this4 = this;
  18438. Object.keys(this.events).forEach(function (event) {
  18439. _this4.events[event].forEach(function (callback) {
  18440. _this4.socket.removeListener(event, callback);
  18441. });
  18442. delete _this4.events[event];
  18443. });
  18444. }
  18445. }]);
  18446. return SocketIoChannel;
  18447. }(Channel);
  18448. /**
  18449. * This class represents a Socket.io presence channel.
  18450. */
  18451. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18452. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18453. function SocketIoPrivateChannel() {
  18454. classCallCheck(this, SocketIoPrivateChannel);
  18455. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18456. }
  18457. createClass(SocketIoPrivateChannel, [{
  18458. key: 'whisper',
  18459. /**
  18460. * Trigger client event on the channel.
  18461. */
  18462. value: function whisper(eventName, data) {
  18463. this.socket.emit('client event', {
  18464. channel: this.name,
  18465. event: 'client-' + eventName,
  18466. data: data
  18467. });
  18468. return this;
  18469. }
  18470. }]);
  18471. return SocketIoPrivateChannel;
  18472. }(SocketIoChannel);
  18473. /**
  18474. * This class represents a Socket.io presence channel.
  18475. */
  18476. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18477. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18478. function SocketIoPresenceChannel() {
  18479. classCallCheck(this, SocketIoPresenceChannel);
  18480. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18481. }
  18482. createClass(SocketIoPresenceChannel, [{
  18483. key: 'here',
  18484. /**
  18485. * Register a callback to be called anytime the member list changes.
  18486. */
  18487. value: function here(callback) {
  18488. this.on('presence:subscribed', function (members) {
  18489. callback(members.map(function (m) {
  18490. return m.user_info;
  18491. }));
  18492. });
  18493. return this;
  18494. }
  18495. /**
  18496. * Listen for someone joining the channel.
  18497. */
  18498. }, {
  18499. key: 'joining',
  18500. value: function joining(callback) {
  18501. this.on('presence:joining', function (member) {
  18502. return callback(member.user_info);
  18503. });
  18504. return this;
  18505. }
  18506. /**
  18507. * Listen for someone leaving the channel.
  18508. */
  18509. }, {
  18510. key: 'leaving',
  18511. value: function leaving(callback) {
  18512. this.on('presence:leaving', function (member) {
  18513. return callback(member.user_info);
  18514. });
  18515. return this;
  18516. }
  18517. }]);
  18518. return SocketIoPresenceChannel;
  18519. }(SocketIoPrivateChannel);
  18520. /**
  18521. * This class represents a null channel.
  18522. */
  18523. var NullChannel = function (_Channel) {
  18524. inherits(NullChannel, _Channel);
  18525. function NullChannel() {
  18526. classCallCheck(this, NullChannel);
  18527. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18528. }
  18529. createClass(NullChannel, [{
  18530. key: 'subscribe',
  18531. /**
  18532. * Subscribe to a channel.
  18533. */
  18534. value: function subscribe() {}
  18535. //
  18536. /**
  18537. * Unsubscribe from a channel.
  18538. */
  18539. }, {
  18540. key: 'unsubscribe',
  18541. value: function unsubscribe() {}
  18542. //
  18543. /**
  18544. * Listen for an event on the channel instance.
  18545. */
  18546. }, {
  18547. key: 'listen',
  18548. value: function listen(event, callback) {
  18549. return this;
  18550. }
  18551. /**
  18552. * Stop listening for an event on the channel instance.
  18553. */
  18554. }, {
  18555. key: 'stopListening',
  18556. value: function stopListening(event) {
  18557. return this;
  18558. }
  18559. /**
  18560. * Bind a channel to an event.
  18561. */
  18562. }, {
  18563. key: 'on',
  18564. value: function on(event, callback) {
  18565. return this;
  18566. }
  18567. }]);
  18568. return NullChannel;
  18569. }(Channel);
  18570. /**
  18571. * This class represents a null private channel.
  18572. */
  18573. var NullPrivateChannel = function (_NullChannel) {
  18574. inherits(NullPrivateChannel, _NullChannel);
  18575. function NullPrivateChannel() {
  18576. classCallCheck(this, NullPrivateChannel);
  18577. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18578. }
  18579. createClass(NullPrivateChannel, [{
  18580. key: 'whisper',
  18581. /**
  18582. * Trigger client event on the channel.
  18583. */
  18584. value: function whisper(eventName, data) {
  18585. return this;
  18586. }
  18587. }]);
  18588. return NullPrivateChannel;
  18589. }(NullChannel);
  18590. /**
  18591. * This class represents a null presence channel.
  18592. */
  18593. var NullPresenceChannel = function (_NullChannel) {
  18594. inherits(NullPresenceChannel, _NullChannel);
  18595. function NullPresenceChannel() {
  18596. classCallCheck(this, NullPresenceChannel);
  18597. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18598. }
  18599. createClass(NullPresenceChannel, [{
  18600. key: 'here',
  18601. /**
  18602. * Register a callback to be called anytime the member list changes.
  18603. */
  18604. value: function here(callback) {
  18605. return this;
  18606. }
  18607. /**
  18608. * Listen for someone joining the channel.
  18609. */
  18610. }, {
  18611. key: 'joining',
  18612. value: function joining(callback) {
  18613. return this;
  18614. }
  18615. /**
  18616. * Listen for someone leaving the channel.
  18617. */
  18618. }, {
  18619. key: 'leaving',
  18620. value: function leaving(callback) {
  18621. return this;
  18622. }
  18623. /**
  18624. * Trigger client event on the channel.
  18625. */
  18626. }, {
  18627. key: 'whisper',
  18628. value: function whisper(eventName, data) {
  18629. return this;
  18630. }
  18631. }]);
  18632. return NullPresenceChannel;
  18633. }(NullChannel);
  18634. /**
  18635. * This class creates a connector to Pusher.
  18636. */
  18637. var PusherConnector = function (_Connector) {
  18638. inherits(PusherConnector, _Connector);
  18639. function PusherConnector() {
  18640. classCallCheck(this, PusherConnector);
  18641. /**
  18642. * All of the subscribed channel names.
  18643. */
  18644. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18645. _this.channels = {};
  18646. return _this;
  18647. }
  18648. /**
  18649. * Create a fresh Pusher connection.
  18650. */
  18651. createClass(PusherConnector, [{
  18652. key: 'connect',
  18653. value: function connect() {
  18654. if (typeof this.options.client !== 'undefined') {
  18655. this.pusher = this.options.client;
  18656. } else {
  18657. this.pusher = new Pusher(this.options.key, this.options);
  18658. }
  18659. }
  18660. /**
  18661. * Listen for an event on a channel instance.
  18662. */
  18663. }, {
  18664. key: 'listen',
  18665. value: function listen(name, event, callback) {
  18666. return this.channel(name).listen(event, callback);
  18667. }
  18668. /**
  18669. * Get a channel instance by name.
  18670. */
  18671. }, {
  18672. key: 'channel',
  18673. value: function channel(name) {
  18674. if (!this.channels[name]) {
  18675. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18676. }
  18677. return this.channels[name];
  18678. }
  18679. /**
  18680. * Get a private channel instance by name.
  18681. */
  18682. }, {
  18683. key: 'privateChannel',
  18684. value: function privateChannel(name) {
  18685. if (!this.channels['private-' + name]) {
  18686. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18687. }
  18688. return this.channels['private-' + name];
  18689. }
  18690. /**
  18691. * Get a presence channel instance by name.
  18692. */
  18693. }, {
  18694. key: 'presenceChannel',
  18695. value: function presenceChannel(name) {
  18696. if (!this.channels['presence-' + name]) {
  18697. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18698. }
  18699. return this.channels['presence-' + name];
  18700. }
  18701. /**
  18702. * Leave the given channel, as well as its private and presence variants.
  18703. */
  18704. }, {
  18705. key: 'leave',
  18706. value: function leave(name) {
  18707. var _this2 = this;
  18708. var channels = [name, 'private-' + name, 'presence-' + name];
  18709. channels.forEach(function (name, index) {
  18710. _this2.leaveChannel(name);
  18711. });
  18712. }
  18713. /**
  18714. * Leave the given channel.
  18715. */
  18716. }, {
  18717. key: 'leaveChannel',
  18718. value: function leaveChannel(name) {
  18719. if (this.channels[name]) {
  18720. this.channels[name].unsubscribe();
  18721. delete this.channels[name];
  18722. }
  18723. }
  18724. /**
  18725. * Get the socket ID for the connection.
  18726. */
  18727. }, {
  18728. key: 'socketId',
  18729. value: function socketId() {
  18730. return this.pusher.connection.socket_id;
  18731. }
  18732. /**
  18733. * Disconnect Pusher connection.
  18734. */
  18735. }, {
  18736. key: 'disconnect',
  18737. value: function disconnect() {
  18738. this.pusher.disconnect();
  18739. }
  18740. }]);
  18741. return PusherConnector;
  18742. }(Connector);
  18743. /**
  18744. * This class creates a connnector to a Socket.io server.
  18745. */
  18746. var SocketIoConnector = function (_Connector) {
  18747. inherits(SocketIoConnector, _Connector);
  18748. function SocketIoConnector() {
  18749. classCallCheck(this, SocketIoConnector);
  18750. /**
  18751. * All of the subscribed channel names.
  18752. */
  18753. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18754. _this.channels = {};
  18755. return _this;
  18756. }
  18757. /**
  18758. * Create a fresh Socket.io connection.
  18759. */
  18760. createClass(SocketIoConnector, [{
  18761. key: 'connect',
  18762. value: function connect() {
  18763. var io = this.getSocketIO();
  18764. this.socket = io(this.options.host, this.options);
  18765. return this.socket;
  18766. }
  18767. /**
  18768. * Get socket.io module from global scope or options.
  18769. */
  18770. }, {
  18771. key: 'getSocketIO',
  18772. value: function getSocketIO() {
  18773. if (typeof this.options.client !== 'undefined') {
  18774. return this.options.client;
  18775. }
  18776. if (typeof io !== 'undefined') {
  18777. return io;
  18778. }
  18779. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18780. }
  18781. /**
  18782. * Listen for an event on a channel instance.
  18783. */
  18784. }, {
  18785. key: 'listen',
  18786. value: function listen(name, event, callback) {
  18787. return this.channel(name).listen(event, callback);
  18788. }
  18789. /**
  18790. * Get a channel instance by name.
  18791. */
  18792. }, {
  18793. key: 'channel',
  18794. value: function channel(name) {
  18795. if (!this.channels[name]) {
  18796. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18797. }
  18798. return this.channels[name];
  18799. }
  18800. /**
  18801. * Get a private channel instance by name.
  18802. */
  18803. }, {
  18804. key: 'privateChannel',
  18805. value: function privateChannel(name) {
  18806. if (!this.channels['private-' + name]) {
  18807. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18808. }
  18809. return this.channels['private-' + name];
  18810. }
  18811. /**
  18812. * Get a presence channel instance by name.
  18813. */
  18814. }, {
  18815. key: 'presenceChannel',
  18816. value: function presenceChannel(name) {
  18817. if (!this.channels['presence-' + name]) {
  18818. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18819. }
  18820. return this.channels['presence-' + name];
  18821. }
  18822. /**
  18823. * Leave the given channel, as well as its private and presence variants.
  18824. */
  18825. }, {
  18826. key: 'leave',
  18827. value: function leave(name) {
  18828. var _this2 = this;
  18829. var channels = [name, 'private-' + name, 'presence-' + name];
  18830. channels.forEach(function (name) {
  18831. _this2.leaveChannel(name);
  18832. });
  18833. }
  18834. /**
  18835. * Leave the given channel.
  18836. */
  18837. }, {
  18838. key: 'leaveChannel',
  18839. value: function leaveChannel(name) {
  18840. if (this.channels[name]) {
  18841. this.channels[name].unsubscribe();
  18842. delete this.channels[name];
  18843. }
  18844. }
  18845. /**
  18846. * Get the socket ID for the connection.
  18847. */
  18848. }, {
  18849. key: 'socketId',
  18850. value: function socketId() {
  18851. return this.socket.id;
  18852. }
  18853. /**
  18854. * Disconnect Socketio connection.
  18855. */
  18856. }, {
  18857. key: 'disconnect',
  18858. value: function disconnect() {
  18859. this.socket.disconnect();
  18860. }
  18861. }]);
  18862. return SocketIoConnector;
  18863. }(Connector);
  18864. /**
  18865. * This class creates a null connector.
  18866. */
  18867. var NullConnector = function (_Connector) {
  18868. inherits(NullConnector, _Connector);
  18869. function NullConnector() {
  18870. classCallCheck(this, NullConnector);
  18871. /**
  18872. * All of the subscribed channel names.
  18873. */
  18874. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18875. _this.channels = {};
  18876. return _this;
  18877. }
  18878. /**
  18879. * Create a fresh connection.
  18880. */
  18881. createClass(NullConnector, [{
  18882. key: 'connect',
  18883. value: function connect() {}
  18884. //
  18885. /**
  18886. * Listen for an event on a channel instance.
  18887. */
  18888. }, {
  18889. key: 'listen',
  18890. value: function listen(name, event, callback) {
  18891. return new NullChannel();
  18892. }
  18893. /**
  18894. * Get a channel instance by name.
  18895. */
  18896. }, {
  18897. key: 'channel',
  18898. value: function channel(name) {
  18899. return new NullChannel();
  18900. }
  18901. /**
  18902. * Get a private channel instance by name.
  18903. */
  18904. }, {
  18905. key: 'privateChannel',
  18906. value: function privateChannel(name) {
  18907. return new NullPrivateChannel();
  18908. }
  18909. /**
  18910. * Get a presence channel instance by name.
  18911. */
  18912. }, {
  18913. key: 'presenceChannel',
  18914. value: function presenceChannel(name) {
  18915. return new NullPresenceChannel();
  18916. }
  18917. /**
  18918. * Leave the given channel, as well as its private and presence variants.
  18919. */
  18920. }, {
  18921. key: 'leave',
  18922. value: function leave(name) {}
  18923. //
  18924. /**
  18925. * Leave the given channel.
  18926. */
  18927. }, {
  18928. key: 'leaveChannel',
  18929. value: function leaveChannel(name) {}
  18930. //
  18931. /**
  18932. * Get the socket ID for the connection.
  18933. */
  18934. }, {
  18935. key: 'socketId',
  18936. value: function socketId() {
  18937. return 'fake-socket-id';
  18938. }
  18939. /**
  18940. * Disconnect the connection.
  18941. */
  18942. }, {
  18943. key: 'disconnect',
  18944. value: function disconnect() {
  18945. //
  18946. }
  18947. }]);
  18948. return NullConnector;
  18949. }(Connector);
  18950. /**
  18951. * This class is the primary API for interacting with broadcasting.
  18952. */
  18953. var Echo = function () {
  18954. /**
  18955. * Create a new class instance.
  18956. */
  18957. function Echo(options) {
  18958. classCallCheck(this, Echo);
  18959. this.options = options;
  18960. this.connect();
  18961. if (!this.options.withoutInterceptors) {
  18962. this.registerInterceptors();
  18963. }
  18964. }
  18965. /**
  18966. * Get a channel instance by name.
  18967. */
  18968. createClass(Echo, [{
  18969. key: 'channel',
  18970. value: function channel(_channel) {
  18971. return this.connector.channel(_channel);
  18972. }
  18973. /**
  18974. * Create a new connection.
  18975. */
  18976. }, {
  18977. key: 'connect',
  18978. value: function connect() {
  18979. if (this.options.broadcaster == 'pusher') {
  18980. this.connector = new PusherConnector(this.options);
  18981. } else if (this.options.broadcaster == 'socket.io') {
  18982. this.connector = new SocketIoConnector(this.options);
  18983. } else if (this.options.broadcaster == 'null') {
  18984. this.connector = new NullConnector(this.options);
  18985. } else if (typeof this.options.broadcaster == 'function') {
  18986. this.connector = new this.options.broadcaster(this.options);
  18987. }
  18988. }
  18989. /**
  18990. * Disconnect from the Echo server.
  18991. */
  18992. }, {
  18993. key: 'disconnect',
  18994. value: function disconnect() {
  18995. this.connector.disconnect();
  18996. }
  18997. /**
  18998. * Get a presence channel instance by name.
  18999. */
  19000. }, {
  19001. key: 'join',
  19002. value: function join(channel) {
  19003. return this.connector.presenceChannel(channel);
  19004. }
  19005. /**
  19006. * Leave the given channel, as well as its private and presence variants.
  19007. */
  19008. }, {
  19009. key: 'leave',
  19010. value: function leave(channel) {
  19011. this.connector.leave(channel);
  19012. }
  19013. /**
  19014. * Leave the given channel.
  19015. */
  19016. }, {
  19017. key: 'leaveChannel',
  19018. value: function leaveChannel(channel) {
  19019. this.connector.leaveChannel(channel);
  19020. }
  19021. /**
  19022. * Listen for an event on a channel instance.
  19023. */
  19024. }, {
  19025. key: 'listen',
  19026. value: function listen(channel, event, callback) {
  19027. return this.connector.listen(channel, event, callback);
  19028. }
  19029. /**
  19030. * Get a private channel instance by name.
  19031. */
  19032. }, {
  19033. key: 'private',
  19034. value: function _private(channel) {
  19035. return this.connector.privateChannel(channel);
  19036. }
  19037. /**
  19038. * Get the Socket ID for the connection.
  19039. */
  19040. }, {
  19041. key: 'socketId',
  19042. value: function socketId() {
  19043. return this.connector.socketId();
  19044. }
  19045. /**
  19046. * Register 3rd party request interceptiors. These are used to automatically
  19047. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19048. */
  19049. }, {
  19050. key: 'registerInterceptors',
  19051. value: function registerInterceptors() {
  19052. if (typeof Vue === 'function' && Vue.http) {
  19053. this.registerVueRequestInterceptor();
  19054. }
  19055. if (typeof axios === 'function') {
  19056. this.registerAxiosRequestInterceptor();
  19057. }
  19058. if (typeof jQuery === 'function') {
  19059. this.registerjQueryAjaxSetup();
  19060. }
  19061. }
  19062. /**
  19063. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19064. */
  19065. }, {
  19066. key: 'registerVueRequestInterceptor',
  19067. value: function registerVueRequestInterceptor() {
  19068. var _this = this;
  19069. Vue.http.interceptors.push(function (request, next) {
  19070. if (_this.socketId()) {
  19071. request.headers.set('X-Socket-ID', _this.socketId());
  19072. }
  19073. next();
  19074. });
  19075. }
  19076. /**
  19077. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19078. */
  19079. }, {
  19080. key: 'registerAxiosRequestInterceptor',
  19081. value: function registerAxiosRequestInterceptor() {
  19082. var _this2 = this;
  19083. axios.interceptors.request.use(function (config) {
  19084. if (_this2.socketId()) {
  19085. config.headers['X-Socket-Id'] = _this2.socketId();
  19086. }
  19087. return config;
  19088. });
  19089. }
  19090. /**
  19091. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19092. */
  19093. }, {
  19094. key: 'registerjQueryAjaxSetup',
  19095. value: function registerjQueryAjaxSetup() {
  19096. var _this3 = this;
  19097. if (typeof jQuery.ajax != 'undefined') {
  19098. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19099. if (_this3.socketId()) {
  19100. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19101. }
  19102. });
  19103. }
  19104. }
  19105. }]);
  19106. return Echo;
  19107. }();
  19108. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19109. /***/ }),
  19110. /***/ "./node_modules/lodash/lodash.js":
  19111. /*!***************************************!*\
  19112. !*** ./node_modules/lodash/lodash.js ***!
  19113. \***************************************/
  19114. /*! no static exports found */
  19115. /***/ (function(module, exports, __webpack_require__) {
  19116. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19117. * @license
  19118. * Lodash <https://lodash.com/>
  19119. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19120. * Released under MIT license <https://lodash.com/license>
  19121. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19122. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19123. */
  19124. ;(function() {
  19125. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19126. var undefined;
  19127. /** Used as the semantic version number. */
  19128. var VERSION = '4.17.15';
  19129. /** Used as the size to enable large array optimizations. */
  19130. var LARGE_ARRAY_SIZE = 200;
  19131. /** Error message constants. */
  19132. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19133. FUNC_ERROR_TEXT = 'Expected a function';
  19134. /** Used to stand-in for `undefined` hash values. */
  19135. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19136. /** Used as the maximum memoize cache size. */
  19137. var MAX_MEMOIZE_SIZE = 500;
  19138. /** Used as the internal argument placeholder. */
  19139. var PLACEHOLDER = '__lodash_placeholder__';
  19140. /** Used to compose bitmasks for cloning. */
  19141. var CLONE_DEEP_FLAG = 1,
  19142. CLONE_FLAT_FLAG = 2,
  19143. CLONE_SYMBOLS_FLAG = 4;
  19144. /** Used to compose bitmasks for value comparisons. */
  19145. var COMPARE_PARTIAL_FLAG = 1,
  19146. COMPARE_UNORDERED_FLAG = 2;
  19147. /** Used to compose bitmasks for function metadata. */
  19148. var WRAP_BIND_FLAG = 1,
  19149. WRAP_BIND_KEY_FLAG = 2,
  19150. WRAP_CURRY_BOUND_FLAG = 4,
  19151. WRAP_CURRY_FLAG = 8,
  19152. WRAP_CURRY_RIGHT_FLAG = 16,
  19153. WRAP_PARTIAL_FLAG = 32,
  19154. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19155. WRAP_ARY_FLAG = 128,
  19156. WRAP_REARG_FLAG = 256,
  19157. WRAP_FLIP_FLAG = 512;
  19158. /** Used as default options for `_.truncate`. */
  19159. var DEFAULT_TRUNC_LENGTH = 30,
  19160. DEFAULT_TRUNC_OMISSION = '...';
  19161. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19162. var HOT_COUNT = 800,
  19163. HOT_SPAN = 16;
  19164. /** Used to indicate the type of lazy iteratees. */
  19165. var LAZY_FILTER_FLAG = 1,
  19166. LAZY_MAP_FLAG = 2,
  19167. LAZY_WHILE_FLAG = 3;
  19168. /** Used as references for various `Number` constants. */
  19169. var INFINITY = 1 / 0,
  19170. MAX_SAFE_INTEGER = 9007199254740991,
  19171. MAX_INTEGER = 1.7976931348623157e+308,
  19172. NAN = 0 / 0;
  19173. /** Used as references for the maximum length and index of an array. */
  19174. var MAX_ARRAY_LENGTH = 4294967295,
  19175. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19176. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19177. /** Used to associate wrap methods with their bit flags. */
  19178. var wrapFlags = [
  19179. ['ary', WRAP_ARY_FLAG],
  19180. ['bind', WRAP_BIND_FLAG],
  19181. ['bindKey', WRAP_BIND_KEY_FLAG],
  19182. ['curry', WRAP_CURRY_FLAG],
  19183. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19184. ['flip', WRAP_FLIP_FLAG],
  19185. ['partial', WRAP_PARTIAL_FLAG],
  19186. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19187. ['rearg', WRAP_REARG_FLAG]
  19188. ];
  19189. /** `Object#toString` result references. */
  19190. var argsTag = '[object Arguments]',
  19191. arrayTag = '[object Array]',
  19192. asyncTag = '[object AsyncFunction]',
  19193. boolTag = '[object Boolean]',
  19194. dateTag = '[object Date]',
  19195. domExcTag = '[object DOMException]',
  19196. errorTag = '[object Error]',
  19197. funcTag = '[object Function]',
  19198. genTag = '[object GeneratorFunction]',
  19199. mapTag = '[object Map]',
  19200. numberTag = '[object Number]',
  19201. nullTag = '[object Null]',
  19202. objectTag = '[object Object]',
  19203. promiseTag = '[object Promise]',
  19204. proxyTag = '[object Proxy]',
  19205. regexpTag = '[object RegExp]',
  19206. setTag = '[object Set]',
  19207. stringTag = '[object String]',
  19208. symbolTag = '[object Symbol]',
  19209. undefinedTag = '[object Undefined]',
  19210. weakMapTag = '[object WeakMap]',
  19211. weakSetTag = '[object WeakSet]';
  19212. var arrayBufferTag = '[object ArrayBuffer]',
  19213. dataViewTag = '[object DataView]',
  19214. float32Tag = '[object Float32Array]',
  19215. float64Tag = '[object Float64Array]',
  19216. int8Tag = '[object Int8Array]',
  19217. int16Tag = '[object Int16Array]',
  19218. int32Tag = '[object Int32Array]',
  19219. uint8Tag = '[object Uint8Array]',
  19220. uint8ClampedTag = '[object Uint8ClampedArray]',
  19221. uint16Tag = '[object Uint16Array]',
  19222. uint32Tag = '[object Uint32Array]';
  19223. /** Used to match empty string literals in compiled template source. */
  19224. var reEmptyStringLeading = /\b__p \+= '';/g,
  19225. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19226. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19227. /** Used to match HTML entities and HTML characters. */
  19228. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19229. reUnescapedHtml = /[&<>"']/g,
  19230. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19231. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19232. /** Used to match template delimiters. */
  19233. var reEscape = /<%-([\s\S]+?)%>/g,
  19234. reEvaluate = /<%([\s\S]+?)%>/g,
  19235. reInterpolate = /<%=([\s\S]+?)%>/g;
  19236. /** Used to match property names within property paths. */
  19237. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19238. reIsPlainProp = /^\w*$/,
  19239. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19240. /**
  19241. * Used to match `RegExp`
  19242. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19243. */
  19244. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19245. reHasRegExpChar = RegExp(reRegExpChar.source);
  19246. /** Used to match leading and trailing whitespace. */
  19247. var reTrim = /^\s+|\s+$/g,
  19248. reTrimStart = /^\s+/,
  19249. reTrimEnd = /\s+$/;
  19250. /** Used to match wrap detail comments. */
  19251. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19252. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19253. reSplitDetails = /,? & /;
  19254. /** Used to match words composed of alphanumeric characters. */
  19255. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19256. /** Used to match backslashes in property paths. */
  19257. var reEscapeChar = /\\(\\)?/g;
  19258. /**
  19259. * Used to match
  19260. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19261. */
  19262. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19263. /** Used to match `RegExp` flags from their coerced string values. */
  19264. var reFlags = /\w*$/;
  19265. /** Used to detect bad signed hexadecimal string values. */
  19266. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19267. /** Used to detect binary string values. */
  19268. var reIsBinary = /^0b[01]+$/i;
  19269. /** Used to detect host constructors (Safari). */
  19270. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19271. /** Used to detect octal string values. */
  19272. var reIsOctal = /^0o[0-7]+$/i;
  19273. /** Used to detect unsigned integer values. */
  19274. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19275. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19276. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19277. /** Used to ensure capturing order of template delimiters. */
  19278. var reNoMatch = /($^)/;
  19279. /** Used to match unescaped characters in compiled string literals. */
  19280. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19281. /** Used to compose unicode character classes. */
  19282. var rsAstralRange = '\\ud800-\\udfff',
  19283. rsComboMarksRange = '\\u0300-\\u036f',
  19284. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19285. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19286. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19287. rsDingbatRange = '\\u2700-\\u27bf',
  19288. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19289. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19290. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19291. rsPunctuationRange = '\\u2000-\\u206f',
  19292. 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',
  19293. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19294. rsVarRange = '\\ufe0e\\ufe0f',
  19295. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19296. /** Used to compose unicode capture groups. */
  19297. var rsApos = "['\u2019]",
  19298. rsAstral = '[' + rsAstralRange + ']',
  19299. rsBreak = '[' + rsBreakRange + ']',
  19300. rsCombo = '[' + rsComboRange + ']',
  19301. rsDigits = '\\d+',
  19302. rsDingbat = '[' + rsDingbatRange + ']',
  19303. rsLower = '[' + rsLowerRange + ']',
  19304. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19305. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19306. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19307. rsNonAstral = '[^' + rsAstralRange + ']',
  19308. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19309. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19310. rsUpper = '[' + rsUpperRange + ']',
  19311. rsZWJ = '\\u200d';
  19312. /** Used to compose unicode regexes. */
  19313. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19314. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19315. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19316. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19317. reOptMod = rsModifier + '?',
  19318. rsOptVar = '[' + rsVarRange + ']?',
  19319. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19320. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19321. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19322. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19323. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19324. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19325. /** Used to match apostrophes. */
  19326. var reApos = RegExp(rsApos, 'g');
  19327. /**
  19328. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19329. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19330. */
  19331. var reComboMark = RegExp(rsCombo, 'g');
  19332. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19333. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19334. /** Used to match complex or compound words. */
  19335. var reUnicodeWord = RegExp([
  19336. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19337. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19338. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19339. rsUpper + '+' + rsOptContrUpper,
  19340. rsOrdUpper,
  19341. rsOrdLower,
  19342. rsDigits,
  19343. rsEmoji
  19344. ].join('|'), 'g');
  19345. /** 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/). */
  19346. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19347. /** Used to detect strings that need a more robust regexp to match words. */
  19348. 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 ]/;
  19349. /** Used to assign default `context` object properties. */
  19350. var contextProps = [
  19351. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19352. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19353. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19354. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19355. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19356. ];
  19357. /** Used to make template sourceURLs easier to identify. */
  19358. var templateCounter = -1;
  19359. /** Used to identify `toStringTag` values of typed arrays. */
  19360. var typedArrayTags = {};
  19361. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19362. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19363. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19364. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19365. typedArrayTags[uint32Tag] = true;
  19366. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19367. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19368. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19369. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19370. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19371. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19372. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19373. typedArrayTags[weakMapTag] = false;
  19374. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19375. var cloneableTags = {};
  19376. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19377. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19378. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19379. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19380. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19381. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19382. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19383. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19384. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19385. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19386. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19387. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19388. cloneableTags[weakMapTag] = false;
  19389. /** Used to map Latin Unicode letters to basic Latin letters. */
  19390. var deburredLetters = {
  19391. // Latin-1 Supplement block.
  19392. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19393. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19394. '\xc7': 'C', '\xe7': 'c',
  19395. '\xd0': 'D', '\xf0': 'd',
  19396. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19397. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19398. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19399. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19400. '\xd1': 'N', '\xf1': 'n',
  19401. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19402. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19403. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19404. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19405. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19406. '\xc6': 'Ae', '\xe6': 'ae',
  19407. '\xde': 'Th', '\xfe': 'th',
  19408. '\xdf': 'ss',
  19409. // Latin Extended-A block.
  19410. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19411. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19412. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19413. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19414. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19415. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19416. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19417. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19418. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19419. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19420. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19421. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19422. '\u0134': 'J', '\u0135': 'j',
  19423. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19424. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19425. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19426. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19427. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19428. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19429. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19430. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19431. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19432. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19433. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19434. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19435. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19436. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19437. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19438. '\u0174': 'W', '\u0175': 'w',
  19439. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19440. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19441. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19442. '\u0132': 'IJ', '\u0133': 'ij',
  19443. '\u0152': 'Oe', '\u0153': 'oe',
  19444. '\u0149': "'n", '\u017f': 's'
  19445. };
  19446. /** Used to map characters to HTML entities. */
  19447. var htmlEscapes = {
  19448. '&': '&amp;',
  19449. '<': '&lt;',
  19450. '>': '&gt;',
  19451. '"': '&quot;',
  19452. "'": '&#39;'
  19453. };
  19454. /** Used to map HTML entities to characters. */
  19455. var htmlUnescapes = {
  19456. '&amp;': '&',
  19457. '&lt;': '<',
  19458. '&gt;': '>',
  19459. '&quot;': '"',
  19460. '&#39;': "'"
  19461. };
  19462. /** Used to escape characters for inclusion in compiled string literals. */
  19463. var stringEscapes = {
  19464. '\\': '\\',
  19465. "'": "'",
  19466. '\n': 'n',
  19467. '\r': 'r',
  19468. '\u2028': 'u2028',
  19469. '\u2029': 'u2029'
  19470. };
  19471. /** Built-in method references without a dependency on `root`. */
  19472. var freeParseFloat = parseFloat,
  19473. freeParseInt = parseInt;
  19474. /** Detect free variable `global` from Node.js. */
  19475. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19476. /** Detect free variable `self`. */
  19477. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19478. /** Used as a reference to the global object. */
  19479. var root = freeGlobal || freeSelf || Function('return this')();
  19480. /** Detect free variable `exports`. */
  19481. var freeExports = true && exports && !exports.nodeType && exports;
  19482. /** Detect free variable `module`. */
  19483. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19484. /** Detect the popular CommonJS extension `module.exports`. */
  19485. var moduleExports = freeModule && freeModule.exports === freeExports;
  19486. /** Detect free variable `process` from Node.js. */
  19487. var freeProcess = moduleExports && freeGlobal.process;
  19488. /** Used to access faster Node.js helpers. */
  19489. var nodeUtil = (function() {
  19490. try {
  19491. // Use `util.types` for Node.js 10+.
  19492. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19493. if (types) {
  19494. return types;
  19495. }
  19496. // Legacy `process.binding('util')` for Node.js < 10.
  19497. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19498. } catch (e) {}
  19499. }());
  19500. /* Node.js helper references. */
  19501. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19502. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19503. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19504. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19505. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19506. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19507. /*--------------------------------------------------------------------------*/
  19508. /**
  19509. * A faster alternative to `Function#apply`, this function invokes `func`
  19510. * with the `this` binding of `thisArg` and the arguments of `args`.
  19511. *
  19512. * @private
  19513. * @param {Function} func The function to invoke.
  19514. * @param {*} thisArg The `this` binding of `func`.
  19515. * @param {Array} args The arguments to invoke `func` with.
  19516. * @returns {*} Returns the result of `func`.
  19517. */
  19518. function apply(func, thisArg, args) {
  19519. switch (args.length) {
  19520. case 0: return func.call(thisArg);
  19521. case 1: return func.call(thisArg, args[0]);
  19522. case 2: return func.call(thisArg, args[0], args[1]);
  19523. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19524. }
  19525. return func.apply(thisArg, args);
  19526. }
  19527. /**
  19528. * A specialized version of `baseAggregator` for arrays.
  19529. *
  19530. * @private
  19531. * @param {Array} [array] The array to iterate over.
  19532. * @param {Function} setter The function to set `accumulator` values.
  19533. * @param {Function} iteratee The iteratee to transform keys.
  19534. * @param {Object} accumulator The initial aggregated object.
  19535. * @returns {Function} Returns `accumulator`.
  19536. */
  19537. function arrayAggregator(array, setter, iteratee, accumulator) {
  19538. var index = -1,
  19539. length = array == null ? 0 : array.length;
  19540. while (++index < length) {
  19541. var value = array[index];
  19542. setter(accumulator, value, iteratee(value), array);
  19543. }
  19544. return accumulator;
  19545. }
  19546. /**
  19547. * A specialized version of `_.forEach` for arrays without support for
  19548. * iteratee shorthands.
  19549. *
  19550. * @private
  19551. * @param {Array} [array] The array to iterate over.
  19552. * @param {Function} iteratee The function invoked per iteration.
  19553. * @returns {Array} Returns `array`.
  19554. */
  19555. function arrayEach(array, iteratee) {
  19556. var index = -1,
  19557. length = array == null ? 0 : array.length;
  19558. while (++index < length) {
  19559. if (iteratee(array[index], index, array) === false) {
  19560. break;
  19561. }
  19562. }
  19563. return array;
  19564. }
  19565. /**
  19566. * A specialized version of `_.forEachRight` for arrays without support for
  19567. * iteratee shorthands.
  19568. *
  19569. * @private
  19570. * @param {Array} [array] The array to iterate over.
  19571. * @param {Function} iteratee The function invoked per iteration.
  19572. * @returns {Array} Returns `array`.
  19573. */
  19574. function arrayEachRight(array, iteratee) {
  19575. var length = array == null ? 0 : array.length;
  19576. while (length--) {
  19577. if (iteratee(array[length], length, array) === false) {
  19578. break;
  19579. }
  19580. }
  19581. return array;
  19582. }
  19583. /**
  19584. * A specialized version of `_.every` for arrays without support for
  19585. * iteratee shorthands.
  19586. *
  19587. * @private
  19588. * @param {Array} [array] The array to iterate over.
  19589. * @param {Function} predicate The function invoked per iteration.
  19590. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19591. * else `false`.
  19592. */
  19593. function arrayEvery(array, predicate) {
  19594. var index = -1,
  19595. length = array == null ? 0 : array.length;
  19596. while (++index < length) {
  19597. if (!predicate(array[index], index, array)) {
  19598. return false;
  19599. }
  19600. }
  19601. return true;
  19602. }
  19603. /**
  19604. * A specialized version of `_.filter` for arrays without support for
  19605. * iteratee shorthands.
  19606. *
  19607. * @private
  19608. * @param {Array} [array] The array to iterate over.
  19609. * @param {Function} predicate The function invoked per iteration.
  19610. * @returns {Array} Returns the new filtered array.
  19611. */
  19612. function arrayFilter(array, predicate) {
  19613. var index = -1,
  19614. length = array == null ? 0 : array.length,
  19615. resIndex = 0,
  19616. result = [];
  19617. while (++index < length) {
  19618. var value = array[index];
  19619. if (predicate(value, index, array)) {
  19620. result[resIndex++] = value;
  19621. }
  19622. }
  19623. return result;
  19624. }
  19625. /**
  19626. * A specialized version of `_.includes` for arrays without support for
  19627. * specifying an index to search from.
  19628. *
  19629. * @private
  19630. * @param {Array} [array] The array to inspect.
  19631. * @param {*} target The value to search for.
  19632. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19633. */
  19634. function arrayIncludes(array, value) {
  19635. var length = array == null ? 0 : array.length;
  19636. return !!length && baseIndexOf(array, value, 0) > -1;
  19637. }
  19638. /**
  19639. * This function is like `arrayIncludes` except that it accepts a comparator.
  19640. *
  19641. * @private
  19642. * @param {Array} [array] The array to inspect.
  19643. * @param {*} target The value to search for.
  19644. * @param {Function} comparator The comparator invoked per element.
  19645. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19646. */
  19647. function arrayIncludesWith(array, value, comparator) {
  19648. var index = -1,
  19649. length = array == null ? 0 : array.length;
  19650. while (++index < length) {
  19651. if (comparator(value, array[index])) {
  19652. return true;
  19653. }
  19654. }
  19655. return false;
  19656. }
  19657. /**
  19658. * A specialized version of `_.map` for arrays without support for iteratee
  19659. * shorthands.
  19660. *
  19661. * @private
  19662. * @param {Array} [array] The array to iterate over.
  19663. * @param {Function} iteratee The function invoked per iteration.
  19664. * @returns {Array} Returns the new mapped array.
  19665. */
  19666. function arrayMap(array, iteratee) {
  19667. var index = -1,
  19668. length = array == null ? 0 : array.length,
  19669. result = Array(length);
  19670. while (++index < length) {
  19671. result[index] = iteratee(array[index], index, array);
  19672. }
  19673. return result;
  19674. }
  19675. /**
  19676. * Appends the elements of `values` to `array`.
  19677. *
  19678. * @private
  19679. * @param {Array} array The array to modify.
  19680. * @param {Array} values The values to append.
  19681. * @returns {Array} Returns `array`.
  19682. */
  19683. function arrayPush(array, values) {
  19684. var index = -1,
  19685. length = values.length,
  19686. offset = array.length;
  19687. while (++index < length) {
  19688. array[offset + index] = values[index];
  19689. }
  19690. return array;
  19691. }
  19692. /**
  19693. * A specialized version of `_.reduce` for arrays without support for
  19694. * iteratee shorthands.
  19695. *
  19696. * @private
  19697. * @param {Array} [array] The array to iterate over.
  19698. * @param {Function} iteratee The function invoked per iteration.
  19699. * @param {*} [accumulator] The initial value.
  19700. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19701. * the initial value.
  19702. * @returns {*} Returns the accumulated value.
  19703. */
  19704. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19705. var index = -1,
  19706. length = array == null ? 0 : array.length;
  19707. if (initAccum && length) {
  19708. accumulator = array[++index];
  19709. }
  19710. while (++index < length) {
  19711. accumulator = iteratee(accumulator, array[index], index, array);
  19712. }
  19713. return accumulator;
  19714. }
  19715. /**
  19716. * A specialized version of `_.reduceRight` for arrays without support for
  19717. * iteratee shorthands.
  19718. *
  19719. * @private
  19720. * @param {Array} [array] The array to iterate over.
  19721. * @param {Function} iteratee The function invoked per iteration.
  19722. * @param {*} [accumulator] The initial value.
  19723. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19724. * the initial value.
  19725. * @returns {*} Returns the accumulated value.
  19726. */
  19727. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19728. var length = array == null ? 0 : array.length;
  19729. if (initAccum && length) {
  19730. accumulator = array[--length];
  19731. }
  19732. while (length--) {
  19733. accumulator = iteratee(accumulator, array[length], length, array);
  19734. }
  19735. return accumulator;
  19736. }
  19737. /**
  19738. * A specialized version of `_.some` for arrays without support for iteratee
  19739. * shorthands.
  19740. *
  19741. * @private
  19742. * @param {Array} [array] The array to iterate over.
  19743. * @param {Function} predicate The function invoked per iteration.
  19744. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19745. * else `false`.
  19746. */
  19747. function arraySome(array, predicate) {
  19748. var index = -1,
  19749. length = array == null ? 0 : array.length;
  19750. while (++index < length) {
  19751. if (predicate(array[index], index, array)) {
  19752. return true;
  19753. }
  19754. }
  19755. return false;
  19756. }
  19757. /**
  19758. * Gets the size of an ASCII `string`.
  19759. *
  19760. * @private
  19761. * @param {string} string The string inspect.
  19762. * @returns {number} Returns the string size.
  19763. */
  19764. var asciiSize = baseProperty('length');
  19765. /**
  19766. * Converts an ASCII `string` to an array.
  19767. *
  19768. * @private
  19769. * @param {string} string The string to convert.
  19770. * @returns {Array} Returns the converted array.
  19771. */
  19772. function asciiToArray(string) {
  19773. return string.split('');
  19774. }
  19775. /**
  19776. * Splits an ASCII `string` into an array of its words.
  19777. *
  19778. * @private
  19779. * @param {string} The string to inspect.
  19780. * @returns {Array} Returns the words of `string`.
  19781. */
  19782. function asciiWords(string) {
  19783. return string.match(reAsciiWord) || [];
  19784. }
  19785. /**
  19786. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19787. * without support for iteratee shorthands, which iterates over `collection`
  19788. * using `eachFunc`.
  19789. *
  19790. * @private
  19791. * @param {Array|Object} collection The collection to inspect.
  19792. * @param {Function} predicate The function invoked per iteration.
  19793. * @param {Function} eachFunc The function to iterate over `collection`.
  19794. * @returns {*} Returns the found element or its key, else `undefined`.
  19795. */
  19796. function baseFindKey(collection, predicate, eachFunc) {
  19797. var result;
  19798. eachFunc(collection, function(value, key, collection) {
  19799. if (predicate(value, key, collection)) {
  19800. result = key;
  19801. return false;
  19802. }
  19803. });
  19804. return result;
  19805. }
  19806. /**
  19807. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19808. * support for iteratee shorthands.
  19809. *
  19810. * @private
  19811. * @param {Array} array The array to inspect.
  19812. * @param {Function} predicate The function invoked per iteration.
  19813. * @param {number} fromIndex The index to search from.
  19814. * @param {boolean} [fromRight] Specify iterating from right to left.
  19815. * @returns {number} Returns the index of the matched value, else `-1`.
  19816. */
  19817. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19818. var length = array.length,
  19819. index = fromIndex + (fromRight ? 1 : -1);
  19820. while ((fromRight ? index-- : ++index < length)) {
  19821. if (predicate(array[index], index, array)) {
  19822. return index;
  19823. }
  19824. }
  19825. return -1;
  19826. }
  19827. /**
  19828. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19829. *
  19830. * @private
  19831. * @param {Array} array The array to inspect.
  19832. * @param {*} value The value to search for.
  19833. * @param {number} fromIndex The index to search from.
  19834. * @returns {number} Returns the index of the matched value, else `-1`.
  19835. */
  19836. function baseIndexOf(array, value, fromIndex) {
  19837. return value === value
  19838. ? strictIndexOf(array, value, fromIndex)
  19839. : baseFindIndex(array, baseIsNaN, fromIndex);
  19840. }
  19841. /**
  19842. * This function is like `baseIndexOf` except that it accepts a comparator.
  19843. *
  19844. * @private
  19845. * @param {Array} array The array to inspect.
  19846. * @param {*} value The value to search for.
  19847. * @param {number} fromIndex The index to search from.
  19848. * @param {Function} comparator The comparator invoked per element.
  19849. * @returns {number} Returns the index of the matched value, else `-1`.
  19850. */
  19851. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19852. var index = fromIndex - 1,
  19853. length = array.length;
  19854. while (++index < length) {
  19855. if (comparator(array[index], value)) {
  19856. return index;
  19857. }
  19858. }
  19859. return -1;
  19860. }
  19861. /**
  19862. * The base implementation of `_.isNaN` without support for number objects.
  19863. *
  19864. * @private
  19865. * @param {*} value The value to check.
  19866. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19867. */
  19868. function baseIsNaN(value) {
  19869. return value !== value;
  19870. }
  19871. /**
  19872. * The base implementation of `_.mean` and `_.meanBy` without support for
  19873. * iteratee shorthands.
  19874. *
  19875. * @private
  19876. * @param {Array} array The array to iterate over.
  19877. * @param {Function} iteratee The function invoked per iteration.
  19878. * @returns {number} Returns the mean.
  19879. */
  19880. function baseMean(array, iteratee) {
  19881. var length = array == null ? 0 : array.length;
  19882. return length ? (baseSum(array, iteratee) / length) : NAN;
  19883. }
  19884. /**
  19885. * The base implementation of `_.property` without support for deep paths.
  19886. *
  19887. * @private
  19888. * @param {string} key The key of the property to get.
  19889. * @returns {Function} Returns the new accessor function.
  19890. */
  19891. function baseProperty(key) {
  19892. return function(object) {
  19893. return object == null ? undefined : object[key];
  19894. };
  19895. }
  19896. /**
  19897. * The base implementation of `_.propertyOf` without support for deep paths.
  19898. *
  19899. * @private
  19900. * @param {Object} object The object to query.
  19901. * @returns {Function} Returns the new accessor function.
  19902. */
  19903. function basePropertyOf(object) {
  19904. return function(key) {
  19905. return object == null ? undefined : object[key];
  19906. };
  19907. }
  19908. /**
  19909. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19910. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19911. *
  19912. * @private
  19913. * @param {Array|Object} collection The collection to iterate over.
  19914. * @param {Function} iteratee The function invoked per iteration.
  19915. * @param {*} accumulator The initial value.
  19916. * @param {boolean} initAccum Specify using the first or last element of
  19917. * `collection` as the initial value.
  19918. * @param {Function} eachFunc The function to iterate over `collection`.
  19919. * @returns {*} Returns the accumulated value.
  19920. */
  19921. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19922. eachFunc(collection, function(value, index, collection) {
  19923. accumulator = initAccum
  19924. ? (initAccum = false, value)
  19925. : iteratee(accumulator, value, index, collection);
  19926. });
  19927. return accumulator;
  19928. }
  19929. /**
  19930. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19931. * sort order of `array` and replaces criteria objects with their corresponding
  19932. * values.
  19933. *
  19934. * @private
  19935. * @param {Array} array The array to sort.
  19936. * @param {Function} comparer The function to define sort order.
  19937. * @returns {Array} Returns `array`.
  19938. */
  19939. function baseSortBy(array, comparer) {
  19940. var length = array.length;
  19941. array.sort(comparer);
  19942. while (length--) {
  19943. array[length] = array[length].value;
  19944. }
  19945. return array;
  19946. }
  19947. /**
  19948. * The base implementation of `_.sum` and `_.sumBy` without support for
  19949. * iteratee shorthands.
  19950. *
  19951. * @private
  19952. * @param {Array} array The array to iterate over.
  19953. * @param {Function} iteratee The function invoked per iteration.
  19954. * @returns {number} Returns the sum.
  19955. */
  19956. function baseSum(array, iteratee) {
  19957. var result,
  19958. index = -1,
  19959. length = array.length;
  19960. while (++index < length) {
  19961. var current = iteratee(array[index]);
  19962. if (current !== undefined) {
  19963. result = result === undefined ? current : (result + current);
  19964. }
  19965. }
  19966. return result;
  19967. }
  19968. /**
  19969. * The base implementation of `_.times` without support for iteratee shorthands
  19970. * or max array length checks.
  19971. *
  19972. * @private
  19973. * @param {number} n The number of times to invoke `iteratee`.
  19974. * @param {Function} iteratee The function invoked per iteration.
  19975. * @returns {Array} Returns the array of results.
  19976. */
  19977. function baseTimes(n, iteratee) {
  19978. var index = -1,
  19979. result = Array(n);
  19980. while (++index < n) {
  19981. result[index] = iteratee(index);
  19982. }
  19983. return result;
  19984. }
  19985. /**
  19986. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19987. * of key-value pairs for `object` corresponding to the property names of `props`.
  19988. *
  19989. * @private
  19990. * @param {Object} object The object to query.
  19991. * @param {Array} props The property names to get values for.
  19992. * @returns {Object} Returns the key-value pairs.
  19993. */
  19994. function baseToPairs(object, props) {
  19995. return arrayMap(props, function(key) {
  19996. return [key, object[key]];
  19997. });
  19998. }
  19999. /**
  20000. * The base implementation of `_.unary` without support for storing metadata.
  20001. *
  20002. * @private
  20003. * @param {Function} func The function to cap arguments for.
  20004. * @returns {Function} Returns the new capped function.
  20005. */
  20006. function baseUnary(func) {
  20007. return function(value) {
  20008. return func(value);
  20009. };
  20010. }
  20011. /**
  20012. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20013. * array of `object` property values corresponding to the property names
  20014. * of `props`.
  20015. *
  20016. * @private
  20017. * @param {Object} object The object to query.
  20018. * @param {Array} props The property names to get values for.
  20019. * @returns {Object} Returns the array of property values.
  20020. */
  20021. function baseValues(object, props) {
  20022. return arrayMap(props, function(key) {
  20023. return object[key];
  20024. });
  20025. }
  20026. /**
  20027. * Checks if a `cache` value for `key` exists.
  20028. *
  20029. * @private
  20030. * @param {Object} cache The cache to query.
  20031. * @param {string} key The key of the entry to check.
  20032. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20033. */
  20034. function cacheHas(cache, key) {
  20035. return cache.has(key);
  20036. }
  20037. /**
  20038. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20039. * that is not found in the character symbols.
  20040. *
  20041. * @private
  20042. * @param {Array} strSymbols The string symbols to inspect.
  20043. * @param {Array} chrSymbols The character symbols to find.
  20044. * @returns {number} Returns the index of the first unmatched string symbol.
  20045. */
  20046. function charsStartIndex(strSymbols, chrSymbols) {
  20047. var index = -1,
  20048. length = strSymbols.length;
  20049. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20050. return index;
  20051. }
  20052. /**
  20053. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20054. * that is not found in the character symbols.
  20055. *
  20056. * @private
  20057. * @param {Array} strSymbols The string symbols to inspect.
  20058. * @param {Array} chrSymbols The character symbols to find.
  20059. * @returns {number} Returns the index of the last unmatched string symbol.
  20060. */
  20061. function charsEndIndex(strSymbols, chrSymbols) {
  20062. var index = strSymbols.length;
  20063. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20064. return index;
  20065. }
  20066. /**
  20067. * Gets the number of `placeholder` occurrences in `array`.
  20068. *
  20069. * @private
  20070. * @param {Array} array The array to inspect.
  20071. * @param {*} placeholder The placeholder to search for.
  20072. * @returns {number} Returns the placeholder count.
  20073. */
  20074. function countHolders(array, placeholder) {
  20075. var length = array.length,
  20076. result = 0;
  20077. while (length--) {
  20078. if (array[length] === placeholder) {
  20079. ++result;
  20080. }
  20081. }
  20082. return result;
  20083. }
  20084. /**
  20085. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20086. * letters to basic Latin letters.
  20087. *
  20088. * @private
  20089. * @param {string} letter The matched letter to deburr.
  20090. * @returns {string} Returns the deburred letter.
  20091. */
  20092. var deburrLetter = basePropertyOf(deburredLetters);
  20093. /**
  20094. * Used by `_.escape` to convert characters to HTML entities.
  20095. *
  20096. * @private
  20097. * @param {string} chr The matched character to escape.
  20098. * @returns {string} Returns the escaped character.
  20099. */
  20100. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20101. /**
  20102. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20103. *
  20104. * @private
  20105. * @param {string} chr The matched character to escape.
  20106. * @returns {string} Returns the escaped character.
  20107. */
  20108. function escapeStringChar(chr) {
  20109. return '\\' + stringEscapes[chr];
  20110. }
  20111. /**
  20112. * Gets the value at `key` of `object`.
  20113. *
  20114. * @private
  20115. * @param {Object} [object] The object to query.
  20116. * @param {string} key The key of the property to get.
  20117. * @returns {*} Returns the property value.
  20118. */
  20119. function getValue(object, key) {
  20120. return object == null ? undefined : object[key];
  20121. }
  20122. /**
  20123. * Checks if `string` contains Unicode symbols.
  20124. *
  20125. * @private
  20126. * @param {string} string The string to inspect.
  20127. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20128. */
  20129. function hasUnicode(string) {
  20130. return reHasUnicode.test(string);
  20131. }
  20132. /**
  20133. * Checks if `string` contains a word composed of Unicode symbols.
  20134. *
  20135. * @private
  20136. * @param {string} string The string to inspect.
  20137. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20138. */
  20139. function hasUnicodeWord(string) {
  20140. return reHasUnicodeWord.test(string);
  20141. }
  20142. /**
  20143. * Converts `iterator` to an array.
  20144. *
  20145. * @private
  20146. * @param {Object} iterator The iterator to convert.
  20147. * @returns {Array} Returns the converted array.
  20148. */
  20149. function iteratorToArray(iterator) {
  20150. var data,
  20151. result = [];
  20152. while (!(data = iterator.next()).done) {
  20153. result.push(data.value);
  20154. }
  20155. return result;
  20156. }
  20157. /**
  20158. * Converts `map` to its key-value pairs.
  20159. *
  20160. * @private
  20161. * @param {Object} map The map to convert.
  20162. * @returns {Array} Returns the key-value pairs.
  20163. */
  20164. function mapToArray(map) {
  20165. var index = -1,
  20166. result = Array(map.size);
  20167. map.forEach(function(value, key) {
  20168. result[++index] = [key, value];
  20169. });
  20170. return result;
  20171. }
  20172. /**
  20173. * Creates a unary function that invokes `func` with its argument transformed.
  20174. *
  20175. * @private
  20176. * @param {Function} func The function to wrap.
  20177. * @param {Function} transform The argument transform.
  20178. * @returns {Function} Returns the new function.
  20179. */
  20180. function overArg(func, transform) {
  20181. return function(arg) {
  20182. return func(transform(arg));
  20183. };
  20184. }
  20185. /**
  20186. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20187. * and returns an array of their indexes.
  20188. *
  20189. * @private
  20190. * @param {Array} array The array to modify.
  20191. * @param {*} placeholder The placeholder to replace.
  20192. * @returns {Array} Returns the new array of placeholder indexes.
  20193. */
  20194. function replaceHolders(array, placeholder) {
  20195. var index = -1,
  20196. length = array.length,
  20197. resIndex = 0,
  20198. result = [];
  20199. while (++index < length) {
  20200. var value = array[index];
  20201. if (value === placeholder || value === PLACEHOLDER) {
  20202. array[index] = PLACEHOLDER;
  20203. result[resIndex++] = index;
  20204. }
  20205. }
  20206. return result;
  20207. }
  20208. /**
  20209. * Converts `set` to an array of its values.
  20210. *
  20211. * @private
  20212. * @param {Object} set The set to convert.
  20213. * @returns {Array} Returns the values.
  20214. */
  20215. function setToArray(set) {
  20216. var index = -1,
  20217. result = Array(set.size);
  20218. set.forEach(function(value) {
  20219. result[++index] = value;
  20220. });
  20221. return result;
  20222. }
  20223. /**
  20224. * Converts `set` to its value-value pairs.
  20225. *
  20226. * @private
  20227. * @param {Object} set The set to convert.
  20228. * @returns {Array} Returns the value-value pairs.
  20229. */
  20230. function setToPairs(set) {
  20231. var index = -1,
  20232. result = Array(set.size);
  20233. set.forEach(function(value) {
  20234. result[++index] = [value, value];
  20235. });
  20236. return result;
  20237. }
  20238. /**
  20239. * A specialized version of `_.indexOf` which performs strict equality
  20240. * comparisons of values, i.e. `===`.
  20241. *
  20242. * @private
  20243. * @param {Array} array The array to inspect.
  20244. * @param {*} value The value to search for.
  20245. * @param {number} fromIndex The index to search from.
  20246. * @returns {number} Returns the index of the matched value, else `-1`.
  20247. */
  20248. function strictIndexOf(array, value, fromIndex) {
  20249. var index = fromIndex - 1,
  20250. length = array.length;
  20251. while (++index < length) {
  20252. if (array[index] === value) {
  20253. return index;
  20254. }
  20255. }
  20256. return -1;
  20257. }
  20258. /**
  20259. * A specialized version of `_.lastIndexOf` which performs strict equality
  20260. * comparisons of values, i.e. `===`.
  20261. *
  20262. * @private
  20263. * @param {Array} array The array to inspect.
  20264. * @param {*} value The value to search for.
  20265. * @param {number} fromIndex The index to search from.
  20266. * @returns {number} Returns the index of the matched value, else `-1`.
  20267. */
  20268. function strictLastIndexOf(array, value, fromIndex) {
  20269. var index = fromIndex + 1;
  20270. while (index--) {
  20271. if (array[index] === value) {
  20272. return index;
  20273. }
  20274. }
  20275. return index;
  20276. }
  20277. /**
  20278. * Gets the number of symbols in `string`.
  20279. *
  20280. * @private
  20281. * @param {string} string The string to inspect.
  20282. * @returns {number} Returns the string size.
  20283. */
  20284. function stringSize(string) {
  20285. return hasUnicode(string)
  20286. ? unicodeSize(string)
  20287. : asciiSize(string);
  20288. }
  20289. /**
  20290. * Converts `string` to an array.
  20291. *
  20292. * @private
  20293. * @param {string} string The string to convert.
  20294. * @returns {Array} Returns the converted array.
  20295. */
  20296. function stringToArray(string) {
  20297. return hasUnicode(string)
  20298. ? unicodeToArray(string)
  20299. : asciiToArray(string);
  20300. }
  20301. /**
  20302. * Used by `_.unescape` to convert HTML entities to characters.
  20303. *
  20304. * @private
  20305. * @param {string} chr The matched character to unescape.
  20306. * @returns {string} Returns the unescaped character.
  20307. */
  20308. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20309. /**
  20310. * Gets the size of a Unicode `string`.
  20311. *
  20312. * @private
  20313. * @param {string} string The string inspect.
  20314. * @returns {number} Returns the string size.
  20315. */
  20316. function unicodeSize(string) {
  20317. var result = reUnicode.lastIndex = 0;
  20318. while (reUnicode.test(string)) {
  20319. ++result;
  20320. }
  20321. return result;
  20322. }
  20323. /**
  20324. * Converts a Unicode `string` to an array.
  20325. *
  20326. * @private
  20327. * @param {string} string The string to convert.
  20328. * @returns {Array} Returns the converted array.
  20329. */
  20330. function unicodeToArray(string) {
  20331. return string.match(reUnicode) || [];
  20332. }
  20333. /**
  20334. * Splits a Unicode `string` into an array of its words.
  20335. *
  20336. * @private
  20337. * @param {string} The string to inspect.
  20338. * @returns {Array} Returns the words of `string`.
  20339. */
  20340. function unicodeWords(string) {
  20341. return string.match(reUnicodeWord) || [];
  20342. }
  20343. /*--------------------------------------------------------------------------*/
  20344. /**
  20345. * Create a new pristine `lodash` function using the `context` object.
  20346. *
  20347. * @static
  20348. * @memberOf _
  20349. * @since 1.1.0
  20350. * @category Util
  20351. * @param {Object} [context=root] The context object.
  20352. * @returns {Function} Returns a new `lodash` function.
  20353. * @example
  20354. *
  20355. * _.mixin({ 'foo': _.constant('foo') });
  20356. *
  20357. * var lodash = _.runInContext();
  20358. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20359. *
  20360. * _.isFunction(_.foo);
  20361. * // => true
  20362. * _.isFunction(_.bar);
  20363. * // => false
  20364. *
  20365. * lodash.isFunction(lodash.foo);
  20366. * // => false
  20367. * lodash.isFunction(lodash.bar);
  20368. * // => true
  20369. *
  20370. * // Create a suped-up `defer` in Node.js.
  20371. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20372. */
  20373. var runInContext = (function runInContext(context) {
  20374. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20375. /** Built-in constructor references. */
  20376. var Array = context.Array,
  20377. Date = context.Date,
  20378. Error = context.Error,
  20379. Function = context.Function,
  20380. Math = context.Math,
  20381. Object = context.Object,
  20382. RegExp = context.RegExp,
  20383. String = context.String,
  20384. TypeError = context.TypeError;
  20385. /** Used for built-in method references. */
  20386. var arrayProto = Array.prototype,
  20387. funcProto = Function.prototype,
  20388. objectProto = Object.prototype;
  20389. /** Used to detect overreaching core-js shims. */
  20390. var coreJsData = context['__core-js_shared__'];
  20391. /** Used to resolve the decompiled source of functions. */
  20392. var funcToString = funcProto.toString;
  20393. /** Used to check objects for own properties. */
  20394. var hasOwnProperty = objectProto.hasOwnProperty;
  20395. /** Used to generate unique IDs. */
  20396. var idCounter = 0;
  20397. /** Used to detect methods masquerading as native. */
  20398. var maskSrcKey = (function() {
  20399. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20400. return uid ? ('Symbol(src)_1.' + uid) : '';
  20401. }());
  20402. /**
  20403. * Used to resolve the
  20404. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20405. * of values.
  20406. */
  20407. var nativeObjectToString = objectProto.toString;
  20408. /** Used to infer the `Object` constructor. */
  20409. var objectCtorString = funcToString.call(Object);
  20410. /** Used to restore the original `_` reference in `_.noConflict`. */
  20411. var oldDash = root._;
  20412. /** Used to detect if a method is native. */
  20413. var reIsNative = RegExp('^' +
  20414. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20415. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20416. );
  20417. /** Built-in value references. */
  20418. var Buffer = moduleExports ? context.Buffer : undefined,
  20419. Symbol = context.Symbol,
  20420. Uint8Array = context.Uint8Array,
  20421. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20422. getPrototype = overArg(Object.getPrototypeOf, Object),
  20423. objectCreate = Object.create,
  20424. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20425. splice = arrayProto.splice,
  20426. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20427. symIterator = Symbol ? Symbol.iterator : undefined,
  20428. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20429. var defineProperty = (function() {
  20430. try {
  20431. var func = getNative(Object, 'defineProperty');
  20432. func({}, '', {});
  20433. return func;
  20434. } catch (e) {}
  20435. }());
  20436. /** Mocked built-ins. */
  20437. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20438. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20439. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20440. /* Built-in method references for those with the same name as other `lodash` methods. */
  20441. var nativeCeil = Math.ceil,
  20442. nativeFloor = Math.floor,
  20443. nativeGetSymbols = Object.getOwnPropertySymbols,
  20444. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20445. nativeIsFinite = context.isFinite,
  20446. nativeJoin = arrayProto.join,
  20447. nativeKeys = overArg(Object.keys, Object),
  20448. nativeMax = Math.max,
  20449. nativeMin = Math.min,
  20450. nativeNow = Date.now,
  20451. nativeParseInt = context.parseInt,
  20452. nativeRandom = Math.random,
  20453. nativeReverse = arrayProto.reverse;
  20454. /* Built-in method references that are verified to be native. */
  20455. var DataView = getNative(context, 'DataView'),
  20456. Map = getNative(context, 'Map'),
  20457. Promise = getNative(context, 'Promise'),
  20458. Set = getNative(context, 'Set'),
  20459. WeakMap = getNative(context, 'WeakMap'),
  20460. nativeCreate = getNative(Object, 'create');
  20461. /** Used to store function metadata. */
  20462. var metaMap = WeakMap && new WeakMap;
  20463. /** Used to lookup unminified function names. */
  20464. var realNames = {};
  20465. /** Used to detect maps, sets, and weakmaps. */
  20466. var dataViewCtorString = toSource(DataView),
  20467. mapCtorString = toSource(Map),
  20468. promiseCtorString = toSource(Promise),
  20469. setCtorString = toSource(Set),
  20470. weakMapCtorString = toSource(WeakMap);
  20471. /** Used to convert symbols to primitives and strings. */
  20472. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20473. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20474. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20475. /*------------------------------------------------------------------------*/
  20476. /**
  20477. * Creates a `lodash` object which wraps `value` to enable implicit method
  20478. * chain sequences. Methods that operate on and return arrays, collections,
  20479. * and functions can be chained together. Methods that retrieve a single value
  20480. * or may return a primitive value will automatically end the chain sequence
  20481. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20482. * with `_#value`.
  20483. *
  20484. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20485. * enabled using `_.chain`.
  20486. *
  20487. * The execution of chained methods is lazy, that is, it's deferred until
  20488. * `_#value` is implicitly or explicitly called.
  20489. *
  20490. * Lazy evaluation allows several methods to support shortcut fusion.
  20491. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20492. * the creation of intermediate arrays and can greatly reduce the number of
  20493. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20494. * fusion if the section is applied to an array and iteratees accept only
  20495. * one argument. The heuristic for whether a section qualifies for shortcut
  20496. * fusion is subject to change.
  20497. *
  20498. * Chaining is supported in custom builds as long as the `_#value` method is
  20499. * directly or indirectly included in the build.
  20500. *
  20501. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20502. *
  20503. * The wrapper `Array` methods are:
  20504. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20505. *
  20506. * The wrapper `String` methods are:
  20507. * `replace` and `split`
  20508. *
  20509. * The wrapper methods that support shortcut fusion are:
  20510. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20511. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20512. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20513. *
  20514. * The chainable wrapper methods are:
  20515. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20516. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20517. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20518. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20519. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20520. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20521. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20522. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20523. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20524. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20525. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20526. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20527. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20528. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20529. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20530. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20531. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20532. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20533. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20534. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20535. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20536. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20537. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20538. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20539. *
  20540. * The wrapper methods that are **not** chainable by default are:
  20541. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20542. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20543. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20544. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20545. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20546. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20547. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20548. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20549. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20550. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20551. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20552. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20553. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20554. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20555. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20556. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20557. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20558. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20559. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20560. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20561. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20562. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20563. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20564. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20565. * `upperFirst`, `value`, and `words`
  20566. *
  20567. * @name _
  20568. * @constructor
  20569. * @category Seq
  20570. * @param {*} value The value to wrap in a `lodash` instance.
  20571. * @returns {Object} Returns the new `lodash` wrapper instance.
  20572. * @example
  20573. *
  20574. * function square(n) {
  20575. * return n * n;
  20576. * }
  20577. *
  20578. * var wrapped = _([1, 2, 3]);
  20579. *
  20580. * // Returns an unwrapped value.
  20581. * wrapped.reduce(_.add);
  20582. * // => 6
  20583. *
  20584. * // Returns a wrapped value.
  20585. * var squares = wrapped.map(square);
  20586. *
  20587. * _.isArray(squares);
  20588. * // => false
  20589. *
  20590. * _.isArray(squares.value());
  20591. * // => true
  20592. */
  20593. function lodash(value) {
  20594. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20595. if (value instanceof LodashWrapper) {
  20596. return value;
  20597. }
  20598. if (hasOwnProperty.call(value, '__wrapped__')) {
  20599. return wrapperClone(value);
  20600. }
  20601. }
  20602. return new LodashWrapper(value);
  20603. }
  20604. /**
  20605. * The base implementation of `_.create` without support for assigning
  20606. * properties to the created object.
  20607. *
  20608. * @private
  20609. * @param {Object} proto The object to inherit from.
  20610. * @returns {Object} Returns the new object.
  20611. */
  20612. var baseCreate = (function() {
  20613. function object() {}
  20614. return function(proto) {
  20615. if (!isObject(proto)) {
  20616. return {};
  20617. }
  20618. if (objectCreate) {
  20619. return objectCreate(proto);
  20620. }
  20621. object.prototype = proto;
  20622. var result = new object;
  20623. object.prototype = undefined;
  20624. return result;
  20625. };
  20626. }());
  20627. /**
  20628. * The function whose prototype chain sequence wrappers inherit from.
  20629. *
  20630. * @private
  20631. */
  20632. function baseLodash() {
  20633. // No operation performed.
  20634. }
  20635. /**
  20636. * The base constructor for creating `lodash` wrapper objects.
  20637. *
  20638. * @private
  20639. * @param {*} value The value to wrap.
  20640. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20641. */
  20642. function LodashWrapper(value, chainAll) {
  20643. this.__wrapped__ = value;
  20644. this.__actions__ = [];
  20645. this.__chain__ = !!chainAll;
  20646. this.__index__ = 0;
  20647. this.__values__ = undefined;
  20648. }
  20649. /**
  20650. * By default, the template delimiters used by lodash are like those in
  20651. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20652. * following template settings to use alternative delimiters.
  20653. *
  20654. * @static
  20655. * @memberOf _
  20656. * @type {Object}
  20657. */
  20658. lodash.templateSettings = {
  20659. /**
  20660. * Used to detect `data` property values to be HTML-escaped.
  20661. *
  20662. * @memberOf _.templateSettings
  20663. * @type {RegExp}
  20664. */
  20665. 'escape': reEscape,
  20666. /**
  20667. * Used to detect code to be evaluated.
  20668. *
  20669. * @memberOf _.templateSettings
  20670. * @type {RegExp}
  20671. */
  20672. 'evaluate': reEvaluate,
  20673. /**
  20674. * Used to detect `data` property values to inject.
  20675. *
  20676. * @memberOf _.templateSettings
  20677. * @type {RegExp}
  20678. */
  20679. 'interpolate': reInterpolate,
  20680. /**
  20681. * Used to reference the data object in the template text.
  20682. *
  20683. * @memberOf _.templateSettings
  20684. * @type {string}
  20685. */
  20686. 'variable': '',
  20687. /**
  20688. * Used to import variables into the compiled template.
  20689. *
  20690. * @memberOf _.templateSettings
  20691. * @type {Object}
  20692. */
  20693. 'imports': {
  20694. /**
  20695. * A reference to the `lodash` function.
  20696. *
  20697. * @memberOf _.templateSettings.imports
  20698. * @type {Function}
  20699. */
  20700. '_': lodash
  20701. }
  20702. };
  20703. // Ensure wrappers are instances of `baseLodash`.
  20704. lodash.prototype = baseLodash.prototype;
  20705. lodash.prototype.constructor = lodash;
  20706. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20707. LodashWrapper.prototype.constructor = LodashWrapper;
  20708. /*------------------------------------------------------------------------*/
  20709. /**
  20710. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20711. *
  20712. * @private
  20713. * @constructor
  20714. * @param {*} value The value to wrap.
  20715. */
  20716. function LazyWrapper(value) {
  20717. this.__wrapped__ = value;
  20718. this.__actions__ = [];
  20719. this.__dir__ = 1;
  20720. this.__filtered__ = false;
  20721. this.__iteratees__ = [];
  20722. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20723. this.__views__ = [];
  20724. }
  20725. /**
  20726. * Creates a clone of the lazy wrapper object.
  20727. *
  20728. * @private
  20729. * @name clone
  20730. * @memberOf LazyWrapper
  20731. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20732. */
  20733. function lazyClone() {
  20734. var result = new LazyWrapper(this.__wrapped__);
  20735. result.__actions__ = copyArray(this.__actions__);
  20736. result.__dir__ = this.__dir__;
  20737. result.__filtered__ = this.__filtered__;
  20738. result.__iteratees__ = copyArray(this.__iteratees__);
  20739. result.__takeCount__ = this.__takeCount__;
  20740. result.__views__ = copyArray(this.__views__);
  20741. return result;
  20742. }
  20743. /**
  20744. * Reverses the direction of lazy iteration.
  20745. *
  20746. * @private
  20747. * @name reverse
  20748. * @memberOf LazyWrapper
  20749. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20750. */
  20751. function lazyReverse() {
  20752. if (this.__filtered__) {
  20753. var result = new LazyWrapper(this);
  20754. result.__dir__ = -1;
  20755. result.__filtered__ = true;
  20756. } else {
  20757. result = this.clone();
  20758. result.__dir__ *= -1;
  20759. }
  20760. return result;
  20761. }
  20762. /**
  20763. * Extracts the unwrapped value from its lazy wrapper.
  20764. *
  20765. * @private
  20766. * @name value
  20767. * @memberOf LazyWrapper
  20768. * @returns {*} Returns the unwrapped value.
  20769. */
  20770. function lazyValue() {
  20771. var array = this.__wrapped__.value(),
  20772. dir = this.__dir__,
  20773. isArr = isArray(array),
  20774. isRight = dir < 0,
  20775. arrLength = isArr ? array.length : 0,
  20776. view = getView(0, arrLength, this.__views__),
  20777. start = view.start,
  20778. end = view.end,
  20779. length = end - start,
  20780. index = isRight ? end : (start - 1),
  20781. iteratees = this.__iteratees__,
  20782. iterLength = iteratees.length,
  20783. resIndex = 0,
  20784. takeCount = nativeMin(length, this.__takeCount__);
  20785. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20786. return baseWrapperValue(array, this.__actions__);
  20787. }
  20788. var result = [];
  20789. outer:
  20790. while (length-- && resIndex < takeCount) {
  20791. index += dir;
  20792. var iterIndex = -1,
  20793. value = array[index];
  20794. while (++iterIndex < iterLength) {
  20795. var data = iteratees[iterIndex],
  20796. iteratee = data.iteratee,
  20797. type = data.type,
  20798. computed = iteratee(value);
  20799. if (type == LAZY_MAP_FLAG) {
  20800. value = computed;
  20801. } else if (!computed) {
  20802. if (type == LAZY_FILTER_FLAG) {
  20803. continue outer;
  20804. } else {
  20805. break outer;
  20806. }
  20807. }
  20808. }
  20809. result[resIndex++] = value;
  20810. }
  20811. return result;
  20812. }
  20813. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20814. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20815. LazyWrapper.prototype.constructor = LazyWrapper;
  20816. /*------------------------------------------------------------------------*/
  20817. /**
  20818. * Creates a hash object.
  20819. *
  20820. * @private
  20821. * @constructor
  20822. * @param {Array} [entries] The key-value pairs to cache.
  20823. */
  20824. function Hash(entries) {
  20825. var index = -1,
  20826. length = entries == null ? 0 : entries.length;
  20827. this.clear();
  20828. while (++index < length) {
  20829. var entry = entries[index];
  20830. this.set(entry[0], entry[1]);
  20831. }
  20832. }
  20833. /**
  20834. * Removes all key-value entries from the hash.
  20835. *
  20836. * @private
  20837. * @name clear
  20838. * @memberOf Hash
  20839. */
  20840. function hashClear() {
  20841. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20842. this.size = 0;
  20843. }
  20844. /**
  20845. * Removes `key` and its value from the hash.
  20846. *
  20847. * @private
  20848. * @name delete
  20849. * @memberOf Hash
  20850. * @param {Object} hash The hash to modify.
  20851. * @param {string} key The key of the value to remove.
  20852. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20853. */
  20854. function hashDelete(key) {
  20855. var result = this.has(key) && delete this.__data__[key];
  20856. this.size -= result ? 1 : 0;
  20857. return result;
  20858. }
  20859. /**
  20860. * Gets the hash value for `key`.
  20861. *
  20862. * @private
  20863. * @name get
  20864. * @memberOf Hash
  20865. * @param {string} key The key of the value to get.
  20866. * @returns {*} Returns the entry value.
  20867. */
  20868. function hashGet(key) {
  20869. var data = this.__data__;
  20870. if (nativeCreate) {
  20871. var result = data[key];
  20872. return result === HASH_UNDEFINED ? undefined : result;
  20873. }
  20874. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20875. }
  20876. /**
  20877. * Checks if a hash value for `key` exists.
  20878. *
  20879. * @private
  20880. * @name has
  20881. * @memberOf Hash
  20882. * @param {string} key The key of the entry to check.
  20883. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20884. */
  20885. function hashHas(key) {
  20886. var data = this.__data__;
  20887. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20888. }
  20889. /**
  20890. * Sets the hash `key` to `value`.
  20891. *
  20892. * @private
  20893. * @name set
  20894. * @memberOf Hash
  20895. * @param {string} key The key of the value to set.
  20896. * @param {*} value The value to set.
  20897. * @returns {Object} Returns the hash instance.
  20898. */
  20899. function hashSet(key, value) {
  20900. var data = this.__data__;
  20901. this.size += this.has(key) ? 0 : 1;
  20902. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20903. return this;
  20904. }
  20905. // Add methods to `Hash`.
  20906. Hash.prototype.clear = hashClear;
  20907. Hash.prototype['delete'] = hashDelete;
  20908. Hash.prototype.get = hashGet;
  20909. Hash.prototype.has = hashHas;
  20910. Hash.prototype.set = hashSet;
  20911. /*------------------------------------------------------------------------*/
  20912. /**
  20913. * Creates an list cache object.
  20914. *
  20915. * @private
  20916. * @constructor
  20917. * @param {Array} [entries] The key-value pairs to cache.
  20918. */
  20919. function ListCache(entries) {
  20920. var index = -1,
  20921. length = entries == null ? 0 : entries.length;
  20922. this.clear();
  20923. while (++index < length) {
  20924. var entry = entries[index];
  20925. this.set(entry[0], entry[1]);
  20926. }
  20927. }
  20928. /**
  20929. * Removes all key-value entries from the list cache.
  20930. *
  20931. * @private
  20932. * @name clear
  20933. * @memberOf ListCache
  20934. */
  20935. function listCacheClear() {
  20936. this.__data__ = [];
  20937. this.size = 0;
  20938. }
  20939. /**
  20940. * Removes `key` and its value from the list cache.
  20941. *
  20942. * @private
  20943. * @name delete
  20944. * @memberOf ListCache
  20945. * @param {string} key The key of the value to remove.
  20946. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20947. */
  20948. function listCacheDelete(key) {
  20949. var data = this.__data__,
  20950. index = assocIndexOf(data, key);
  20951. if (index < 0) {
  20952. return false;
  20953. }
  20954. var lastIndex = data.length - 1;
  20955. if (index == lastIndex) {
  20956. data.pop();
  20957. } else {
  20958. splice.call(data, index, 1);
  20959. }
  20960. --this.size;
  20961. return true;
  20962. }
  20963. /**
  20964. * Gets the list cache value for `key`.
  20965. *
  20966. * @private
  20967. * @name get
  20968. * @memberOf ListCache
  20969. * @param {string} key The key of the value to get.
  20970. * @returns {*} Returns the entry value.
  20971. */
  20972. function listCacheGet(key) {
  20973. var data = this.__data__,
  20974. index = assocIndexOf(data, key);
  20975. return index < 0 ? undefined : data[index][1];
  20976. }
  20977. /**
  20978. * Checks if a list cache value for `key` exists.
  20979. *
  20980. * @private
  20981. * @name has
  20982. * @memberOf ListCache
  20983. * @param {string} key The key of the entry to check.
  20984. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20985. */
  20986. function listCacheHas(key) {
  20987. return assocIndexOf(this.__data__, key) > -1;
  20988. }
  20989. /**
  20990. * Sets the list cache `key` to `value`.
  20991. *
  20992. * @private
  20993. * @name set
  20994. * @memberOf ListCache
  20995. * @param {string} key The key of the value to set.
  20996. * @param {*} value The value to set.
  20997. * @returns {Object} Returns the list cache instance.
  20998. */
  20999. function listCacheSet(key, value) {
  21000. var data = this.__data__,
  21001. index = assocIndexOf(data, key);
  21002. if (index < 0) {
  21003. ++this.size;
  21004. data.push([key, value]);
  21005. } else {
  21006. data[index][1] = value;
  21007. }
  21008. return this;
  21009. }
  21010. // Add methods to `ListCache`.
  21011. ListCache.prototype.clear = listCacheClear;
  21012. ListCache.prototype['delete'] = listCacheDelete;
  21013. ListCache.prototype.get = listCacheGet;
  21014. ListCache.prototype.has = listCacheHas;
  21015. ListCache.prototype.set = listCacheSet;
  21016. /*------------------------------------------------------------------------*/
  21017. /**
  21018. * Creates a map cache object to store key-value pairs.
  21019. *
  21020. * @private
  21021. * @constructor
  21022. * @param {Array} [entries] The key-value pairs to cache.
  21023. */
  21024. function MapCache(entries) {
  21025. var index = -1,
  21026. length = entries == null ? 0 : entries.length;
  21027. this.clear();
  21028. while (++index < length) {
  21029. var entry = entries[index];
  21030. this.set(entry[0], entry[1]);
  21031. }
  21032. }
  21033. /**
  21034. * Removes all key-value entries from the map.
  21035. *
  21036. * @private
  21037. * @name clear
  21038. * @memberOf MapCache
  21039. */
  21040. function mapCacheClear() {
  21041. this.size = 0;
  21042. this.__data__ = {
  21043. 'hash': new Hash,
  21044. 'map': new (Map || ListCache),
  21045. 'string': new Hash
  21046. };
  21047. }
  21048. /**
  21049. * Removes `key` and its value from the map.
  21050. *
  21051. * @private
  21052. * @name delete
  21053. * @memberOf MapCache
  21054. * @param {string} key The key of the value to remove.
  21055. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21056. */
  21057. function mapCacheDelete(key) {
  21058. var result = getMapData(this, key)['delete'](key);
  21059. this.size -= result ? 1 : 0;
  21060. return result;
  21061. }
  21062. /**
  21063. * Gets the map value for `key`.
  21064. *
  21065. * @private
  21066. * @name get
  21067. * @memberOf MapCache
  21068. * @param {string} key The key of the value to get.
  21069. * @returns {*} Returns the entry value.
  21070. */
  21071. function mapCacheGet(key) {
  21072. return getMapData(this, key).get(key);
  21073. }
  21074. /**
  21075. * Checks if a map value for `key` exists.
  21076. *
  21077. * @private
  21078. * @name has
  21079. * @memberOf MapCache
  21080. * @param {string} key The key of the entry to check.
  21081. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21082. */
  21083. function mapCacheHas(key) {
  21084. return getMapData(this, key).has(key);
  21085. }
  21086. /**
  21087. * Sets the map `key` to `value`.
  21088. *
  21089. * @private
  21090. * @name set
  21091. * @memberOf MapCache
  21092. * @param {string} key The key of the value to set.
  21093. * @param {*} value The value to set.
  21094. * @returns {Object} Returns the map cache instance.
  21095. */
  21096. function mapCacheSet(key, value) {
  21097. var data = getMapData(this, key),
  21098. size = data.size;
  21099. data.set(key, value);
  21100. this.size += data.size == size ? 0 : 1;
  21101. return this;
  21102. }
  21103. // Add methods to `MapCache`.
  21104. MapCache.prototype.clear = mapCacheClear;
  21105. MapCache.prototype['delete'] = mapCacheDelete;
  21106. MapCache.prototype.get = mapCacheGet;
  21107. MapCache.prototype.has = mapCacheHas;
  21108. MapCache.prototype.set = mapCacheSet;
  21109. /*------------------------------------------------------------------------*/
  21110. /**
  21111. *
  21112. * Creates an array cache object to store unique values.
  21113. *
  21114. * @private
  21115. * @constructor
  21116. * @param {Array} [values] The values to cache.
  21117. */
  21118. function SetCache(values) {
  21119. var index = -1,
  21120. length = values == null ? 0 : values.length;
  21121. this.__data__ = new MapCache;
  21122. while (++index < length) {
  21123. this.add(values[index]);
  21124. }
  21125. }
  21126. /**
  21127. * Adds `value` to the array cache.
  21128. *
  21129. * @private
  21130. * @name add
  21131. * @memberOf SetCache
  21132. * @alias push
  21133. * @param {*} value The value to cache.
  21134. * @returns {Object} Returns the cache instance.
  21135. */
  21136. function setCacheAdd(value) {
  21137. this.__data__.set(value, HASH_UNDEFINED);
  21138. return this;
  21139. }
  21140. /**
  21141. * Checks if `value` is in the array cache.
  21142. *
  21143. * @private
  21144. * @name has
  21145. * @memberOf SetCache
  21146. * @param {*} value The value to search for.
  21147. * @returns {number} Returns `true` if `value` is found, else `false`.
  21148. */
  21149. function setCacheHas(value) {
  21150. return this.__data__.has(value);
  21151. }
  21152. // Add methods to `SetCache`.
  21153. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21154. SetCache.prototype.has = setCacheHas;
  21155. /*------------------------------------------------------------------------*/
  21156. /**
  21157. * Creates a stack cache object to store key-value pairs.
  21158. *
  21159. * @private
  21160. * @constructor
  21161. * @param {Array} [entries] The key-value pairs to cache.
  21162. */
  21163. function Stack(entries) {
  21164. var data = this.__data__ = new ListCache(entries);
  21165. this.size = data.size;
  21166. }
  21167. /**
  21168. * Removes all key-value entries from the stack.
  21169. *
  21170. * @private
  21171. * @name clear
  21172. * @memberOf Stack
  21173. */
  21174. function stackClear() {
  21175. this.__data__ = new ListCache;
  21176. this.size = 0;
  21177. }
  21178. /**
  21179. * Removes `key` and its value from the stack.
  21180. *
  21181. * @private
  21182. * @name delete
  21183. * @memberOf Stack
  21184. * @param {string} key The key of the value to remove.
  21185. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21186. */
  21187. function stackDelete(key) {
  21188. var data = this.__data__,
  21189. result = data['delete'](key);
  21190. this.size = data.size;
  21191. return result;
  21192. }
  21193. /**
  21194. * Gets the stack value for `key`.
  21195. *
  21196. * @private
  21197. * @name get
  21198. * @memberOf Stack
  21199. * @param {string} key The key of the value to get.
  21200. * @returns {*} Returns the entry value.
  21201. */
  21202. function stackGet(key) {
  21203. return this.__data__.get(key);
  21204. }
  21205. /**
  21206. * Checks if a stack value for `key` exists.
  21207. *
  21208. * @private
  21209. * @name has
  21210. * @memberOf Stack
  21211. * @param {string} key The key of the entry to check.
  21212. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21213. */
  21214. function stackHas(key) {
  21215. return this.__data__.has(key);
  21216. }
  21217. /**
  21218. * Sets the stack `key` to `value`.
  21219. *
  21220. * @private
  21221. * @name set
  21222. * @memberOf Stack
  21223. * @param {string} key The key of the value to set.
  21224. * @param {*} value The value to set.
  21225. * @returns {Object} Returns the stack cache instance.
  21226. */
  21227. function stackSet(key, value) {
  21228. var data = this.__data__;
  21229. if (data instanceof ListCache) {
  21230. var pairs = data.__data__;
  21231. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21232. pairs.push([key, value]);
  21233. this.size = ++data.size;
  21234. return this;
  21235. }
  21236. data = this.__data__ = new MapCache(pairs);
  21237. }
  21238. data.set(key, value);
  21239. this.size = data.size;
  21240. return this;
  21241. }
  21242. // Add methods to `Stack`.
  21243. Stack.prototype.clear = stackClear;
  21244. Stack.prototype['delete'] = stackDelete;
  21245. Stack.prototype.get = stackGet;
  21246. Stack.prototype.has = stackHas;
  21247. Stack.prototype.set = stackSet;
  21248. /*------------------------------------------------------------------------*/
  21249. /**
  21250. * Creates an array of the enumerable property names of the array-like `value`.
  21251. *
  21252. * @private
  21253. * @param {*} value The value to query.
  21254. * @param {boolean} inherited Specify returning inherited property names.
  21255. * @returns {Array} Returns the array of property names.
  21256. */
  21257. function arrayLikeKeys(value, inherited) {
  21258. var isArr = isArray(value),
  21259. isArg = !isArr && isArguments(value),
  21260. isBuff = !isArr && !isArg && isBuffer(value),
  21261. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21262. skipIndexes = isArr || isArg || isBuff || isType,
  21263. result = skipIndexes ? baseTimes(value.length, String) : [],
  21264. length = result.length;
  21265. for (var key in value) {
  21266. if ((inherited || hasOwnProperty.call(value, key)) &&
  21267. !(skipIndexes && (
  21268. // Safari 9 has enumerable `arguments.length` in strict mode.
  21269. key == 'length' ||
  21270. // Node.js 0.10 has enumerable non-index properties on buffers.
  21271. (isBuff && (key == 'offset' || key == 'parent')) ||
  21272. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21273. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21274. // Skip index properties.
  21275. isIndex(key, length)
  21276. ))) {
  21277. result.push(key);
  21278. }
  21279. }
  21280. return result;
  21281. }
  21282. /**
  21283. * A specialized version of `_.sample` for arrays.
  21284. *
  21285. * @private
  21286. * @param {Array} array The array to sample.
  21287. * @returns {*} Returns the random element.
  21288. */
  21289. function arraySample(array) {
  21290. var length = array.length;
  21291. return length ? array[baseRandom(0, length - 1)] : undefined;
  21292. }
  21293. /**
  21294. * A specialized version of `_.sampleSize` for arrays.
  21295. *
  21296. * @private
  21297. * @param {Array} array The array to sample.
  21298. * @param {number} n The number of elements to sample.
  21299. * @returns {Array} Returns the random elements.
  21300. */
  21301. function arraySampleSize(array, n) {
  21302. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21303. }
  21304. /**
  21305. * A specialized version of `_.shuffle` for arrays.
  21306. *
  21307. * @private
  21308. * @param {Array} array The array to shuffle.
  21309. * @returns {Array} Returns the new shuffled array.
  21310. */
  21311. function arrayShuffle(array) {
  21312. return shuffleSelf(copyArray(array));
  21313. }
  21314. /**
  21315. * This function is like `assignValue` except that it doesn't assign
  21316. * `undefined` values.
  21317. *
  21318. * @private
  21319. * @param {Object} object The object to modify.
  21320. * @param {string} key The key of the property to assign.
  21321. * @param {*} value The value to assign.
  21322. */
  21323. function assignMergeValue(object, key, value) {
  21324. if ((value !== undefined && !eq(object[key], value)) ||
  21325. (value === undefined && !(key in object))) {
  21326. baseAssignValue(object, key, value);
  21327. }
  21328. }
  21329. /**
  21330. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21331. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21332. * for equality comparisons.
  21333. *
  21334. * @private
  21335. * @param {Object} object The object to modify.
  21336. * @param {string} key The key of the property to assign.
  21337. * @param {*} value The value to assign.
  21338. */
  21339. function assignValue(object, key, value) {
  21340. var objValue = object[key];
  21341. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21342. (value === undefined && !(key in object))) {
  21343. baseAssignValue(object, key, value);
  21344. }
  21345. }
  21346. /**
  21347. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21348. *
  21349. * @private
  21350. * @param {Array} array The array to inspect.
  21351. * @param {*} key The key to search for.
  21352. * @returns {number} Returns the index of the matched value, else `-1`.
  21353. */
  21354. function assocIndexOf(array, key) {
  21355. var length = array.length;
  21356. while (length--) {
  21357. if (eq(array[length][0], key)) {
  21358. return length;
  21359. }
  21360. }
  21361. return -1;
  21362. }
  21363. /**
  21364. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21365. * by `iteratee` and values set by `setter`.
  21366. *
  21367. * @private
  21368. * @param {Array|Object} collection The collection to iterate over.
  21369. * @param {Function} setter The function to set `accumulator` values.
  21370. * @param {Function} iteratee The iteratee to transform keys.
  21371. * @param {Object} accumulator The initial aggregated object.
  21372. * @returns {Function} Returns `accumulator`.
  21373. */
  21374. function baseAggregator(collection, setter, iteratee, accumulator) {
  21375. baseEach(collection, function(value, key, collection) {
  21376. setter(accumulator, value, iteratee(value), collection);
  21377. });
  21378. return accumulator;
  21379. }
  21380. /**
  21381. * The base implementation of `_.assign` without support for multiple sources
  21382. * or `customizer` functions.
  21383. *
  21384. * @private
  21385. * @param {Object} object The destination object.
  21386. * @param {Object} source The source object.
  21387. * @returns {Object} Returns `object`.
  21388. */
  21389. function baseAssign(object, source) {
  21390. return object && copyObject(source, keys(source), object);
  21391. }
  21392. /**
  21393. * The base implementation of `_.assignIn` without support for multiple sources
  21394. * or `customizer` functions.
  21395. *
  21396. * @private
  21397. * @param {Object} object The destination object.
  21398. * @param {Object} source The source object.
  21399. * @returns {Object} Returns `object`.
  21400. */
  21401. function baseAssignIn(object, source) {
  21402. return object && copyObject(source, keysIn(source), object);
  21403. }
  21404. /**
  21405. * The base implementation of `assignValue` and `assignMergeValue` without
  21406. * value checks.
  21407. *
  21408. * @private
  21409. * @param {Object} object The object to modify.
  21410. * @param {string} key The key of the property to assign.
  21411. * @param {*} value The value to assign.
  21412. */
  21413. function baseAssignValue(object, key, value) {
  21414. if (key == '__proto__' && defineProperty) {
  21415. defineProperty(object, key, {
  21416. 'configurable': true,
  21417. 'enumerable': true,
  21418. 'value': value,
  21419. 'writable': true
  21420. });
  21421. } else {
  21422. object[key] = value;
  21423. }
  21424. }
  21425. /**
  21426. * The base implementation of `_.at` without support for individual paths.
  21427. *
  21428. * @private
  21429. * @param {Object} object The object to iterate over.
  21430. * @param {string[]} paths The property paths to pick.
  21431. * @returns {Array} Returns the picked elements.
  21432. */
  21433. function baseAt(object, paths) {
  21434. var index = -1,
  21435. length = paths.length,
  21436. result = Array(length),
  21437. skip = object == null;
  21438. while (++index < length) {
  21439. result[index] = skip ? undefined : get(object, paths[index]);
  21440. }
  21441. return result;
  21442. }
  21443. /**
  21444. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21445. *
  21446. * @private
  21447. * @param {number} number The number to clamp.
  21448. * @param {number} [lower] The lower bound.
  21449. * @param {number} upper The upper bound.
  21450. * @returns {number} Returns the clamped number.
  21451. */
  21452. function baseClamp(number, lower, upper) {
  21453. if (number === number) {
  21454. if (upper !== undefined) {
  21455. number = number <= upper ? number : upper;
  21456. }
  21457. if (lower !== undefined) {
  21458. number = number >= lower ? number : lower;
  21459. }
  21460. }
  21461. return number;
  21462. }
  21463. /**
  21464. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21465. * traversed objects.
  21466. *
  21467. * @private
  21468. * @param {*} value The value to clone.
  21469. * @param {boolean} bitmask The bitmask flags.
  21470. * 1 - Deep clone
  21471. * 2 - Flatten inherited properties
  21472. * 4 - Clone symbols
  21473. * @param {Function} [customizer] The function to customize cloning.
  21474. * @param {string} [key] The key of `value`.
  21475. * @param {Object} [object] The parent object of `value`.
  21476. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21477. * @returns {*} Returns the cloned value.
  21478. */
  21479. function baseClone(value, bitmask, customizer, key, object, stack) {
  21480. var result,
  21481. isDeep = bitmask & CLONE_DEEP_FLAG,
  21482. isFlat = bitmask & CLONE_FLAT_FLAG,
  21483. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21484. if (customizer) {
  21485. result = object ? customizer(value, key, object, stack) : customizer(value);
  21486. }
  21487. if (result !== undefined) {
  21488. return result;
  21489. }
  21490. if (!isObject(value)) {
  21491. return value;
  21492. }
  21493. var isArr = isArray(value);
  21494. if (isArr) {
  21495. result = initCloneArray(value);
  21496. if (!isDeep) {
  21497. return copyArray(value, result);
  21498. }
  21499. } else {
  21500. var tag = getTag(value),
  21501. isFunc = tag == funcTag || tag == genTag;
  21502. if (isBuffer(value)) {
  21503. return cloneBuffer(value, isDeep);
  21504. }
  21505. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21506. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21507. if (!isDeep) {
  21508. return isFlat
  21509. ? copySymbolsIn(value, baseAssignIn(result, value))
  21510. : copySymbols(value, baseAssign(result, value));
  21511. }
  21512. } else {
  21513. if (!cloneableTags[tag]) {
  21514. return object ? value : {};
  21515. }
  21516. result = initCloneByTag(value, tag, isDeep);
  21517. }
  21518. }
  21519. // Check for circular references and return its corresponding clone.
  21520. stack || (stack = new Stack);
  21521. var stacked = stack.get(value);
  21522. if (stacked) {
  21523. return stacked;
  21524. }
  21525. stack.set(value, result);
  21526. if (isSet(value)) {
  21527. value.forEach(function(subValue) {
  21528. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21529. });
  21530. } else if (isMap(value)) {
  21531. value.forEach(function(subValue, key) {
  21532. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21533. });
  21534. }
  21535. var keysFunc = isFull
  21536. ? (isFlat ? getAllKeysIn : getAllKeys)
  21537. : (isFlat ? keysIn : keys);
  21538. var props = isArr ? undefined : keysFunc(value);
  21539. arrayEach(props || value, function(subValue, key) {
  21540. if (props) {
  21541. key = subValue;
  21542. subValue = value[key];
  21543. }
  21544. // Recursively populate clone (susceptible to call stack limits).
  21545. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21546. });
  21547. return result;
  21548. }
  21549. /**
  21550. * The base implementation of `_.conforms` which doesn't clone `source`.
  21551. *
  21552. * @private
  21553. * @param {Object} source The object of property predicates to conform to.
  21554. * @returns {Function} Returns the new spec function.
  21555. */
  21556. function baseConforms(source) {
  21557. var props = keys(source);
  21558. return function(object) {
  21559. return baseConformsTo(object, source, props);
  21560. };
  21561. }
  21562. /**
  21563. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21564. *
  21565. * @private
  21566. * @param {Object} object The object to inspect.
  21567. * @param {Object} source The object of property predicates to conform to.
  21568. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21569. */
  21570. function baseConformsTo(object, source, props) {
  21571. var length = props.length;
  21572. if (object == null) {
  21573. return !length;
  21574. }
  21575. object = Object(object);
  21576. while (length--) {
  21577. var key = props[length],
  21578. predicate = source[key],
  21579. value = object[key];
  21580. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21581. return false;
  21582. }
  21583. }
  21584. return true;
  21585. }
  21586. /**
  21587. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21588. * to provide to `func`.
  21589. *
  21590. * @private
  21591. * @param {Function} func The function to delay.
  21592. * @param {number} wait The number of milliseconds to delay invocation.
  21593. * @param {Array} args The arguments to provide to `func`.
  21594. * @returns {number|Object} Returns the timer id or timeout object.
  21595. */
  21596. function baseDelay(func, wait, args) {
  21597. if (typeof func != 'function') {
  21598. throw new TypeError(FUNC_ERROR_TEXT);
  21599. }
  21600. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21601. }
  21602. /**
  21603. * The base implementation of methods like `_.difference` without support
  21604. * for excluding multiple arrays or iteratee shorthands.
  21605. *
  21606. * @private
  21607. * @param {Array} array The array to inspect.
  21608. * @param {Array} values The values to exclude.
  21609. * @param {Function} [iteratee] The iteratee invoked per element.
  21610. * @param {Function} [comparator] The comparator invoked per element.
  21611. * @returns {Array} Returns the new array of filtered values.
  21612. */
  21613. function baseDifference(array, values, iteratee, comparator) {
  21614. var index = -1,
  21615. includes = arrayIncludes,
  21616. isCommon = true,
  21617. length = array.length,
  21618. result = [],
  21619. valuesLength = values.length;
  21620. if (!length) {
  21621. return result;
  21622. }
  21623. if (iteratee) {
  21624. values = arrayMap(values, baseUnary(iteratee));
  21625. }
  21626. if (comparator) {
  21627. includes = arrayIncludesWith;
  21628. isCommon = false;
  21629. }
  21630. else if (values.length >= LARGE_ARRAY_SIZE) {
  21631. includes = cacheHas;
  21632. isCommon = false;
  21633. values = new SetCache(values);
  21634. }
  21635. outer:
  21636. while (++index < length) {
  21637. var value = array[index],
  21638. computed = iteratee == null ? value : iteratee(value);
  21639. value = (comparator || value !== 0) ? value : 0;
  21640. if (isCommon && computed === computed) {
  21641. var valuesIndex = valuesLength;
  21642. while (valuesIndex--) {
  21643. if (values[valuesIndex] === computed) {
  21644. continue outer;
  21645. }
  21646. }
  21647. result.push(value);
  21648. }
  21649. else if (!includes(values, computed, comparator)) {
  21650. result.push(value);
  21651. }
  21652. }
  21653. return result;
  21654. }
  21655. /**
  21656. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21657. *
  21658. * @private
  21659. * @param {Array|Object} collection The collection to iterate over.
  21660. * @param {Function} iteratee The function invoked per iteration.
  21661. * @returns {Array|Object} Returns `collection`.
  21662. */
  21663. var baseEach = createBaseEach(baseForOwn);
  21664. /**
  21665. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21666. *
  21667. * @private
  21668. * @param {Array|Object} collection The collection to iterate over.
  21669. * @param {Function} iteratee The function invoked per iteration.
  21670. * @returns {Array|Object} Returns `collection`.
  21671. */
  21672. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21673. /**
  21674. * The base implementation of `_.every` without support for iteratee shorthands.
  21675. *
  21676. * @private
  21677. * @param {Array|Object} collection The collection to iterate over.
  21678. * @param {Function} predicate The function invoked per iteration.
  21679. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21680. * else `false`
  21681. */
  21682. function baseEvery(collection, predicate) {
  21683. var result = true;
  21684. baseEach(collection, function(value, index, collection) {
  21685. result = !!predicate(value, index, collection);
  21686. return result;
  21687. });
  21688. return result;
  21689. }
  21690. /**
  21691. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21692. * `comparator` to determine the extremum value.
  21693. *
  21694. * @private
  21695. * @param {Array} array The array to iterate over.
  21696. * @param {Function} iteratee The iteratee invoked per iteration.
  21697. * @param {Function} comparator The comparator used to compare values.
  21698. * @returns {*} Returns the extremum value.
  21699. */
  21700. function baseExtremum(array, iteratee, comparator) {
  21701. var index = -1,
  21702. length = array.length;
  21703. while (++index < length) {
  21704. var value = array[index],
  21705. current = iteratee(value);
  21706. if (current != null && (computed === undefined
  21707. ? (current === current && !isSymbol(current))
  21708. : comparator(current, computed)
  21709. )) {
  21710. var computed = current,
  21711. result = value;
  21712. }
  21713. }
  21714. return result;
  21715. }
  21716. /**
  21717. * The base implementation of `_.fill` without an iteratee call guard.
  21718. *
  21719. * @private
  21720. * @param {Array} array The array to fill.
  21721. * @param {*} value The value to fill `array` with.
  21722. * @param {number} [start=0] The start position.
  21723. * @param {number} [end=array.length] The end position.
  21724. * @returns {Array} Returns `array`.
  21725. */
  21726. function baseFill(array, value, start, end) {
  21727. var length = array.length;
  21728. start = toInteger(start);
  21729. if (start < 0) {
  21730. start = -start > length ? 0 : (length + start);
  21731. }
  21732. end = (end === undefined || end > length) ? length : toInteger(end);
  21733. if (end < 0) {
  21734. end += length;
  21735. }
  21736. end = start > end ? 0 : toLength(end);
  21737. while (start < end) {
  21738. array[start++] = value;
  21739. }
  21740. return array;
  21741. }
  21742. /**
  21743. * The base implementation of `_.filter` without support for iteratee shorthands.
  21744. *
  21745. * @private
  21746. * @param {Array|Object} collection The collection to iterate over.
  21747. * @param {Function} predicate The function invoked per iteration.
  21748. * @returns {Array} Returns the new filtered array.
  21749. */
  21750. function baseFilter(collection, predicate) {
  21751. var result = [];
  21752. baseEach(collection, function(value, index, collection) {
  21753. if (predicate(value, index, collection)) {
  21754. result.push(value);
  21755. }
  21756. });
  21757. return result;
  21758. }
  21759. /**
  21760. * The base implementation of `_.flatten` with support for restricting flattening.
  21761. *
  21762. * @private
  21763. * @param {Array} array The array to flatten.
  21764. * @param {number} depth The maximum recursion depth.
  21765. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21766. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21767. * @param {Array} [result=[]] The initial result value.
  21768. * @returns {Array} Returns the new flattened array.
  21769. */
  21770. function baseFlatten(array, depth, predicate, isStrict, result) {
  21771. var index = -1,
  21772. length = array.length;
  21773. predicate || (predicate = isFlattenable);
  21774. result || (result = []);
  21775. while (++index < length) {
  21776. var value = array[index];
  21777. if (depth > 0 && predicate(value)) {
  21778. if (depth > 1) {
  21779. // Recursively flatten arrays (susceptible to call stack limits).
  21780. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21781. } else {
  21782. arrayPush(result, value);
  21783. }
  21784. } else if (!isStrict) {
  21785. result[result.length] = value;
  21786. }
  21787. }
  21788. return result;
  21789. }
  21790. /**
  21791. * The base implementation of `baseForOwn` which iterates over `object`
  21792. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21793. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21794. *
  21795. * @private
  21796. * @param {Object} object The object to iterate over.
  21797. * @param {Function} iteratee The function invoked per iteration.
  21798. * @param {Function} keysFunc The function to get the keys of `object`.
  21799. * @returns {Object} Returns `object`.
  21800. */
  21801. var baseFor = createBaseFor();
  21802. /**
  21803. * This function is like `baseFor` except that it iterates over properties
  21804. * in the opposite order.
  21805. *
  21806. * @private
  21807. * @param {Object} object The object to iterate over.
  21808. * @param {Function} iteratee The function invoked per iteration.
  21809. * @param {Function} keysFunc The function to get the keys of `object`.
  21810. * @returns {Object} Returns `object`.
  21811. */
  21812. var baseForRight = createBaseFor(true);
  21813. /**
  21814. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21815. *
  21816. * @private
  21817. * @param {Object} object The object to iterate over.
  21818. * @param {Function} iteratee The function invoked per iteration.
  21819. * @returns {Object} Returns `object`.
  21820. */
  21821. function baseForOwn(object, iteratee) {
  21822. return object && baseFor(object, iteratee, keys);
  21823. }
  21824. /**
  21825. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21826. *
  21827. * @private
  21828. * @param {Object} object The object to iterate over.
  21829. * @param {Function} iteratee The function invoked per iteration.
  21830. * @returns {Object} Returns `object`.
  21831. */
  21832. function baseForOwnRight(object, iteratee) {
  21833. return object && baseForRight(object, iteratee, keys);
  21834. }
  21835. /**
  21836. * The base implementation of `_.functions` which creates an array of
  21837. * `object` function property names filtered from `props`.
  21838. *
  21839. * @private
  21840. * @param {Object} object The object to inspect.
  21841. * @param {Array} props The property names to filter.
  21842. * @returns {Array} Returns the function names.
  21843. */
  21844. function baseFunctions(object, props) {
  21845. return arrayFilter(props, function(key) {
  21846. return isFunction(object[key]);
  21847. });
  21848. }
  21849. /**
  21850. * The base implementation of `_.get` without support for default values.
  21851. *
  21852. * @private
  21853. * @param {Object} object The object to query.
  21854. * @param {Array|string} path The path of the property to get.
  21855. * @returns {*} Returns the resolved value.
  21856. */
  21857. function baseGet(object, path) {
  21858. path = castPath(path, object);
  21859. var index = 0,
  21860. length = path.length;
  21861. while (object != null && index < length) {
  21862. object = object[toKey(path[index++])];
  21863. }
  21864. return (index && index == length) ? object : undefined;
  21865. }
  21866. /**
  21867. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21868. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21869. * symbols of `object`.
  21870. *
  21871. * @private
  21872. * @param {Object} object The object to query.
  21873. * @param {Function} keysFunc The function to get the keys of `object`.
  21874. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21875. * @returns {Array} Returns the array of property names and symbols.
  21876. */
  21877. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21878. var result = keysFunc(object);
  21879. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21880. }
  21881. /**
  21882. * The base implementation of `getTag` without fallbacks for buggy environments.
  21883. *
  21884. * @private
  21885. * @param {*} value The value to query.
  21886. * @returns {string} Returns the `toStringTag`.
  21887. */
  21888. function baseGetTag(value) {
  21889. if (value == null) {
  21890. return value === undefined ? undefinedTag : nullTag;
  21891. }
  21892. return (symToStringTag && symToStringTag in Object(value))
  21893. ? getRawTag(value)
  21894. : objectToString(value);
  21895. }
  21896. /**
  21897. * The base implementation of `_.gt` which doesn't coerce arguments.
  21898. *
  21899. * @private
  21900. * @param {*} value The value to compare.
  21901. * @param {*} other The other value to compare.
  21902. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21903. * else `false`.
  21904. */
  21905. function baseGt(value, other) {
  21906. return value > other;
  21907. }
  21908. /**
  21909. * The base implementation of `_.has` without support for deep paths.
  21910. *
  21911. * @private
  21912. * @param {Object} [object] The object to query.
  21913. * @param {Array|string} key The key to check.
  21914. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21915. */
  21916. function baseHas(object, key) {
  21917. return object != null && hasOwnProperty.call(object, key);
  21918. }
  21919. /**
  21920. * The base implementation of `_.hasIn` without support for deep paths.
  21921. *
  21922. * @private
  21923. * @param {Object} [object] The object to query.
  21924. * @param {Array|string} key The key to check.
  21925. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21926. */
  21927. function baseHasIn(object, key) {
  21928. return object != null && key in Object(object);
  21929. }
  21930. /**
  21931. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21932. *
  21933. * @private
  21934. * @param {number} number The number to check.
  21935. * @param {number} start The start of the range.
  21936. * @param {number} end The end of the range.
  21937. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21938. */
  21939. function baseInRange(number, start, end) {
  21940. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21941. }
  21942. /**
  21943. * The base implementation of methods like `_.intersection`, without support
  21944. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21945. *
  21946. * @private
  21947. * @param {Array} arrays The arrays to inspect.
  21948. * @param {Function} [iteratee] The iteratee invoked per element.
  21949. * @param {Function} [comparator] The comparator invoked per element.
  21950. * @returns {Array} Returns the new array of shared values.
  21951. */
  21952. function baseIntersection(arrays, iteratee, comparator) {
  21953. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21954. length = arrays[0].length,
  21955. othLength = arrays.length,
  21956. othIndex = othLength,
  21957. caches = Array(othLength),
  21958. maxLength = Infinity,
  21959. result = [];
  21960. while (othIndex--) {
  21961. var array = arrays[othIndex];
  21962. if (othIndex && iteratee) {
  21963. array = arrayMap(array, baseUnary(iteratee));
  21964. }
  21965. maxLength = nativeMin(array.length, maxLength);
  21966. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21967. ? new SetCache(othIndex && array)
  21968. : undefined;
  21969. }
  21970. array = arrays[0];
  21971. var index = -1,
  21972. seen = caches[0];
  21973. outer:
  21974. while (++index < length && result.length < maxLength) {
  21975. var value = array[index],
  21976. computed = iteratee ? iteratee(value) : value;
  21977. value = (comparator || value !== 0) ? value : 0;
  21978. if (!(seen
  21979. ? cacheHas(seen, computed)
  21980. : includes(result, computed, comparator)
  21981. )) {
  21982. othIndex = othLength;
  21983. while (--othIndex) {
  21984. var cache = caches[othIndex];
  21985. if (!(cache
  21986. ? cacheHas(cache, computed)
  21987. : includes(arrays[othIndex], computed, comparator))
  21988. ) {
  21989. continue outer;
  21990. }
  21991. }
  21992. if (seen) {
  21993. seen.push(computed);
  21994. }
  21995. result.push(value);
  21996. }
  21997. }
  21998. return result;
  21999. }
  22000. /**
  22001. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22002. * `object` with values transformed by `iteratee` and set by `setter`.
  22003. *
  22004. * @private
  22005. * @param {Object} object The object to iterate over.
  22006. * @param {Function} setter The function to set `accumulator` values.
  22007. * @param {Function} iteratee The iteratee to transform values.
  22008. * @param {Object} accumulator The initial inverted object.
  22009. * @returns {Function} Returns `accumulator`.
  22010. */
  22011. function baseInverter(object, setter, iteratee, accumulator) {
  22012. baseForOwn(object, function(value, key, object) {
  22013. setter(accumulator, iteratee(value), key, object);
  22014. });
  22015. return accumulator;
  22016. }
  22017. /**
  22018. * The base implementation of `_.invoke` without support for individual
  22019. * method arguments.
  22020. *
  22021. * @private
  22022. * @param {Object} object The object to query.
  22023. * @param {Array|string} path The path of the method to invoke.
  22024. * @param {Array} args The arguments to invoke the method with.
  22025. * @returns {*} Returns the result of the invoked method.
  22026. */
  22027. function baseInvoke(object, path, args) {
  22028. path = castPath(path, object);
  22029. object = parent(object, path);
  22030. var func = object == null ? object : object[toKey(last(path))];
  22031. return func == null ? undefined : apply(func, object, args);
  22032. }
  22033. /**
  22034. * The base implementation of `_.isArguments`.
  22035. *
  22036. * @private
  22037. * @param {*} value The value to check.
  22038. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22039. */
  22040. function baseIsArguments(value) {
  22041. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22042. }
  22043. /**
  22044. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22045. *
  22046. * @private
  22047. * @param {*} value The value to check.
  22048. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22049. */
  22050. function baseIsArrayBuffer(value) {
  22051. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22052. }
  22053. /**
  22054. * The base implementation of `_.isDate` without Node.js optimizations.
  22055. *
  22056. * @private
  22057. * @param {*} value The value to check.
  22058. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22059. */
  22060. function baseIsDate(value) {
  22061. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22062. }
  22063. /**
  22064. * The base implementation of `_.isEqual` which supports partial comparisons
  22065. * and tracks traversed objects.
  22066. *
  22067. * @private
  22068. * @param {*} value The value to compare.
  22069. * @param {*} other The other value to compare.
  22070. * @param {boolean} bitmask The bitmask flags.
  22071. * 1 - Unordered comparison
  22072. * 2 - Partial comparison
  22073. * @param {Function} [customizer] The function to customize comparisons.
  22074. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22075. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22076. */
  22077. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22078. if (value === other) {
  22079. return true;
  22080. }
  22081. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22082. return value !== value && other !== other;
  22083. }
  22084. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22085. }
  22086. /**
  22087. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22088. * deep comparisons and tracks traversed objects enabling objects with circular
  22089. * references to be compared.
  22090. *
  22091. * @private
  22092. * @param {Object} object The object to compare.
  22093. * @param {Object} other The other object to compare.
  22094. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22095. * @param {Function} customizer The function to customize comparisons.
  22096. * @param {Function} equalFunc The function to determine equivalents of values.
  22097. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22098. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22099. */
  22100. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22101. var objIsArr = isArray(object),
  22102. othIsArr = isArray(other),
  22103. objTag = objIsArr ? arrayTag : getTag(object),
  22104. othTag = othIsArr ? arrayTag : getTag(other);
  22105. objTag = objTag == argsTag ? objectTag : objTag;
  22106. othTag = othTag == argsTag ? objectTag : othTag;
  22107. var objIsObj = objTag == objectTag,
  22108. othIsObj = othTag == objectTag,
  22109. isSameTag = objTag == othTag;
  22110. if (isSameTag && isBuffer(object)) {
  22111. if (!isBuffer(other)) {
  22112. return false;
  22113. }
  22114. objIsArr = true;
  22115. objIsObj = false;
  22116. }
  22117. if (isSameTag && !objIsObj) {
  22118. stack || (stack = new Stack);
  22119. return (objIsArr || isTypedArray(object))
  22120. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22121. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22122. }
  22123. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22124. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22125. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22126. if (objIsWrapped || othIsWrapped) {
  22127. var objUnwrapped = objIsWrapped ? object.value() : object,
  22128. othUnwrapped = othIsWrapped ? other.value() : other;
  22129. stack || (stack = new Stack);
  22130. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22131. }
  22132. }
  22133. if (!isSameTag) {
  22134. return false;
  22135. }
  22136. stack || (stack = new Stack);
  22137. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22138. }
  22139. /**
  22140. * The base implementation of `_.isMap` without Node.js optimizations.
  22141. *
  22142. * @private
  22143. * @param {*} value The value to check.
  22144. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22145. */
  22146. function baseIsMap(value) {
  22147. return isObjectLike(value) && getTag(value) == mapTag;
  22148. }
  22149. /**
  22150. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22151. *
  22152. * @private
  22153. * @param {Object} object The object to inspect.
  22154. * @param {Object} source The object of property values to match.
  22155. * @param {Array} matchData The property names, values, and compare flags to match.
  22156. * @param {Function} [customizer] The function to customize comparisons.
  22157. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22158. */
  22159. function baseIsMatch(object, source, matchData, customizer) {
  22160. var index = matchData.length,
  22161. length = index,
  22162. noCustomizer = !customizer;
  22163. if (object == null) {
  22164. return !length;
  22165. }
  22166. object = Object(object);
  22167. while (index--) {
  22168. var data = matchData[index];
  22169. if ((noCustomizer && data[2])
  22170. ? data[1] !== object[data[0]]
  22171. : !(data[0] in object)
  22172. ) {
  22173. return false;
  22174. }
  22175. }
  22176. while (++index < length) {
  22177. data = matchData[index];
  22178. var key = data[0],
  22179. objValue = object[key],
  22180. srcValue = data[1];
  22181. if (noCustomizer && data[2]) {
  22182. if (objValue === undefined && !(key in object)) {
  22183. return false;
  22184. }
  22185. } else {
  22186. var stack = new Stack;
  22187. if (customizer) {
  22188. var result = customizer(objValue, srcValue, key, object, source, stack);
  22189. }
  22190. if (!(result === undefined
  22191. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22192. : result
  22193. )) {
  22194. return false;
  22195. }
  22196. }
  22197. }
  22198. return true;
  22199. }
  22200. /**
  22201. * The base implementation of `_.isNative` without bad shim checks.
  22202. *
  22203. * @private
  22204. * @param {*} value The value to check.
  22205. * @returns {boolean} Returns `true` if `value` is a native function,
  22206. * else `false`.
  22207. */
  22208. function baseIsNative(value) {
  22209. if (!isObject(value) || isMasked(value)) {
  22210. return false;
  22211. }
  22212. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22213. return pattern.test(toSource(value));
  22214. }
  22215. /**
  22216. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22217. *
  22218. * @private
  22219. * @param {*} value The value to check.
  22220. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22221. */
  22222. function baseIsRegExp(value) {
  22223. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22224. }
  22225. /**
  22226. * The base implementation of `_.isSet` without Node.js optimizations.
  22227. *
  22228. * @private
  22229. * @param {*} value The value to check.
  22230. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22231. */
  22232. function baseIsSet(value) {
  22233. return isObjectLike(value) && getTag(value) == setTag;
  22234. }
  22235. /**
  22236. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22237. *
  22238. * @private
  22239. * @param {*} value The value to check.
  22240. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22241. */
  22242. function baseIsTypedArray(value) {
  22243. return isObjectLike(value) &&
  22244. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22245. }
  22246. /**
  22247. * The base implementation of `_.iteratee`.
  22248. *
  22249. * @private
  22250. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22251. * @returns {Function} Returns the iteratee.
  22252. */
  22253. function baseIteratee(value) {
  22254. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22255. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22256. if (typeof value == 'function') {
  22257. return value;
  22258. }
  22259. if (value == null) {
  22260. return identity;
  22261. }
  22262. if (typeof value == 'object') {
  22263. return isArray(value)
  22264. ? baseMatchesProperty(value[0], value[1])
  22265. : baseMatches(value);
  22266. }
  22267. return property(value);
  22268. }
  22269. /**
  22270. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22271. *
  22272. * @private
  22273. * @param {Object} object The object to query.
  22274. * @returns {Array} Returns the array of property names.
  22275. */
  22276. function baseKeys(object) {
  22277. if (!isPrototype(object)) {
  22278. return nativeKeys(object);
  22279. }
  22280. var result = [];
  22281. for (var key in Object(object)) {
  22282. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22283. result.push(key);
  22284. }
  22285. }
  22286. return result;
  22287. }
  22288. /**
  22289. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22290. *
  22291. * @private
  22292. * @param {Object} object The object to query.
  22293. * @returns {Array} Returns the array of property names.
  22294. */
  22295. function baseKeysIn(object) {
  22296. if (!isObject(object)) {
  22297. return nativeKeysIn(object);
  22298. }
  22299. var isProto = isPrototype(object),
  22300. result = [];
  22301. for (var key in object) {
  22302. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22303. result.push(key);
  22304. }
  22305. }
  22306. return result;
  22307. }
  22308. /**
  22309. * The base implementation of `_.lt` which doesn't coerce arguments.
  22310. *
  22311. * @private
  22312. * @param {*} value The value to compare.
  22313. * @param {*} other The other value to compare.
  22314. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22315. * else `false`.
  22316. */
  22317. function baseLt(value, other) {
  22318. return value < other;
  22319. }
  22320. /**
  22321. * The base implementation of `_.map` without support for iteratee shorthands.
  22322. *
  22323. * @private
  22324. * @param {Array|Object} collection The collection to iterate over.
  22325. * @param {Function} iteratee The function invoked per iteration.
  22326. * @returns {Array} Returns the new mapped array.
  22327. */
  22328. function baseMap(collection, iteratee) {
  22329. var index = -1,
  22330. result = isArrayLike(collection) ? Array(collection.length) : [];
  22331. baseEach(collection, function(value, key, collection) {
  22332. result[++index] = iteratee(value, key, collection);
  22333. });
  22334. return result;
  22335. }
  22336. /**
  22337. * The base implementation of `_.matches` which doesn't clone `source`.
  22338. *
  22339. * @private
  22340. * @param {Object} source The object of property values to match.
  22341. * @returns {Function} Returns the new spec function.
  22342. */
  22343. function baseMatches(source) {
  22344. var matchData = getMatchData(source);
  22345. if (matchData.length == 1 && matchData[0][2]) {
  22346. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22347. }
  22348. return function(object) {
  22349. return object === source || baseIsMatch(object, source, matchData);
  22350. };
  22351. }
  22352. /**
  22353. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22354. *
  22355. * @private
  22356. * @param {string} path The path of the property to get.
  22357. * @param {*} srcValue The value to match.
  22358. * @returns {Function} Returns the new spec function.
  22359. */
  22360. function baseMatchesProperty(path, srcValue) {
  22361. if (isKey(path) && isStrictComparable(srcValue)) {
  22362. return matchesStrictComparable(toKey(path), srcValue);
  22363. }
  22364. return function(object) {
  22365. var objValue = get(object, path);
  22366. return (objValue === undefined && objValue === srcValue)
  22367. ? hasIn(object, path)
  22368. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22369. };
  22370. }
  22371. /**
  22372. * The base implementation of `_.merge` without support for multiple sources.
  22373. *
  22374. * @private
  22375. * @param {Object} object The destination object.
  22376. * @param {Object} source The source object.
  22377. * @param {number} srcIndex The index of `source`.
  22378. * @param {Function} [customizer] The function to customize merged values.
  22379. * @param {Object} [stack] Tracks traversed source values and their merged
  22380. * counterparts.
  22381. */
  22382. function baseMerge(object, source, srcIndex, customizer, stack) {
  22383. if (object === source) {
  22384. return;
  22385. }
  22386. baseFor(source, function(srcValue, key) {
  22387. stack || (stack = new Stack);
  22388. if (isObject(srcValue)) {
  22389. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22390. }
  22391. else {
  22392. var newValue = customizer
  22393. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22394. : undefined;
  22395. if (newValue === undefined) {
  22396. newValue = srcValue;
  22397. }
  22398. assignMergeValue(object, key, newValue);
  22399. }
  22400. }, keysIn);
  22401. }
  22402. /**
  22403. * A specialized version of `baseMerge` for arrays and objects which performs
  22404. * deep merges and tracks traversed objects enabling objects with circular
  22405. * references to be merged.
  22406. *
  22407. * @private
  22408. * @param {Object} object The destination object.
  22409. * @param {Object} source The source object.
  22410. * @param {string} key The key of the value to merge.
  22411. * @param {number} srcIndex The index of `source`.
  22412. * @param {Function} mergeFunc The function to merge values.
  22413. * @param {Function} [customizer] The function to customize assigned values.
  22414. * @param {Object} [stack] Tracks traversed source values and their merged
  22415. * counterparts.
  22416. */
  22417. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22418. var objValue = safeGet(object, key),
  22419. srcValue = safeGet(source, key),
  22420. stacked = stack.get(srcValue);
  22421. if (stacked) {
  22422. assignMergeValue(object, key, stacked);
  22423. return;
  22424. }
  22425. var newValue = customizer
  22426. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22427. : undefined;
  22428. var isCommon = newValue === undefined;
  22429. if (isCommon) {
  22430. var isArr = isArray(srcValue),
  22431. isBuff = !isArr && isBuffer(srcValue),
  22432. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22433. newValue = srcValue;
  22434. if (isArr || isBuff || isTyped) {
  22435. if (isArray(objValue)) {
  22436. newValue = objValue;
  22437. }
  22438. else if (isArrayLikeObject(objValue)) {
  22439. newValue = copyArray(objValue);
  22440. }
  22441. else if (isBuff) {
  22442. isCommon = false;
  22443. newValue = cloneBuffer(srcValue, true);
  22444. }
  22445. else if (isTyped) {
  22446. isCommon = false;
  22447. newValue = cloneTypedArray(srcValue, true);
  22448. }
  22449. else {
  22450. newValue = [];
  22451. }
  22452. }
  22453. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22454. newValue = objValue;
  22455. if (isArguments(objValue)) {
  22456. newValue = toPlainObject(objValue);
  22457. }
  22458. else if (!isObject(objValue) || isFunction(objValue)) {
  22459. newValue = initCloneObject(srcValue);
  22460. }
  22461. }
  22462. else {
  22463. isCommon = false;
  22464. }
  22465. }
  22466. if (isCommon) {
  22467. // Recursively merge objects and arrays (susceptible to call stack limits).
  22468. stack.set(srcValue, newValue);
  22469. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22470. stack['delete'](srcValue);
  22471. }
  22472. assignMergeValue(object, key, newValue);
  22473. }
  22474. /**
  22475. * The base implementation of `_.nth` which doesn't coerce arguments.
  22476. *
  22477. * @private
  22478. * @param {Array} array The array to query.
  22479. * @param {number} n The index of the element to return.
  22480. * @returns {*} Returns the nth element of `array`.
  22481. */
  22482. function baseNth(array, n) {
  22483. var length = array.length;
  22484. if (!length) {
  22485. return;
  22486. }
  22487. n += n < 0 ? length : 0;
  22488. return isIndex(n, length) ? array[n] : undefined;
  22489. }
  22490. /**
  22491. * The base implementation of `_.orderBy` without param guards.
  22492. *
  22493. * @private
  22494. * @param {Array|Object} collection The collection to iterate over.
  22495. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22496. * @param {string[]} orders The sort orders of `iteratees`.
  22497. * @returns {Array} Returns the new sorted array.
  22498. */
  22499. function baseOrderBy(collection, iteratees, orders) {
  22500. var index = -1;
  22501. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22502. var result = baseMap(collection, function(value, key, collection) {
  22503. var criteria = arrayMap(iteratees, function(iteratee) {
  22504. return iteratee(value);
  22505. });
  22506. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22507. });
  22508. return baseSortBy(result, function(object, other) {
  22509. return compareMultiple(object, other, orders);
  22510. });
  22511. }
  22512. /**
  22513. * The base implementation of `_.pick` without support for individual
  22514. * property identifiers.
  22515. *
  22516. * @private
  22517. * @param {Object} object The source object.
  22518. * @param {string[]} paths The property paths to pick.
  22519. * @returns {Object} Returns the new object.
  22520. */
  22521. function basePick(object, paths) {
  22522. return basePickBy(object, paths, function(value, path) {
  22523. return hasIn(object, path);
  22524. });
  22525. }
  22526. /**
  22527. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22528. *
  22529. * @private
  22530. * @param {Object} object The source object.
  22531. * @param {string[]} paths The property paths to pick.
  22532. * @param {Function} predicate The function invoked per property.
  22533. * @returns {Object} Returns the new object.
  22534. */
  22535. function basePickBy(object, paths, predicate) {
  22536. var index = -1,
  22537. length = paths.length,
  22538. result = {};
  22539. while (++index < length) {
  22540. var path = paths[index],
  22541. value = baseGet(object, path);
  22542. if (predicate(value, path)) {
  22543. baseSet(result, castPath(path, object), value);
  22544. }
  22545. }
  22546. return result;
  22547. }
  22548. /**
  22549. * A specialized version of `baseProperty` which supports deep paths.
  22550. *
  22551. * @private
  22552. * @param {Array|string} path The path of the property to get.
  22553. * @returns {Function} Returns the new accessor function.
  22554. */
  22555. function basePropertyDeep(path) {
  22556. return function(object) {
  22557. return baseGet(object, path);
  22558. };
  22559. }
  22560. /**
  22561. * The base implementation of `_.pullAllBy` without support for iteratee
  22562. * shorthands.
  22563. *
  22564. * @private
  22565. * @param {Array} array The array to modify.
  22566. * @param {Array} values The values to remove.
  22567. * @param {Function} [iteratee] The iteratee invoked per element.
  22568. * @param {Function} [comparator] The comparator invoked per element.
  22569. * @returns {Array} Returns `array`.
  22570. */
  22571. function basePullAll(array, values, iteratee, comparator) {
  22572. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22573. index = -1,
  22574. length = values.length,
  22575. seen = array;
  22576. if (array === values) {
  22577. values = copyArray(values);
  22578. }
  22579. if (iteratee) {
  22580. seen = arrayMap(array, baseUnary(iteratee));
  22581. }
  22582. while (++index < length) {
  22583. var fromIndex = 0,
  22584. value = values[index],
  22585. computed = iteratee ? iteratee(value) : value;
  22586. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22587. if (seen !== array) {
  22588. splice.call(seen, fromIndex, 1);
  22589. }
  22590. splice.call(array, fromIndex, 1);
  22591. }
  22592. }
  22593. return array;
  22594. }
  22595. /**
  22596. * The base implementation of `_.pullAt` without support for individual
  22597. * indexes or capturing the removed elements.
  22598. *
  22599. * @private
  22600. * @param {Array} array The array to modify.
  22601. * @param {number[]} indexes The indexes of elements to remove.
  22602. * @returns {Array} Returns `array`.
  22603. */
  22604. function basePullAt(array, indexes) {
  22605. var length = array ? indexes.length : 0,
  22606. lastIndex = length - 1;
  22607. while (length--) {
  22608. var index = indexes[length];
  22609. if (length == lastIndex || index !== previous) {
  22610. var previous = index;
  22611. if (isIndex(index)) {
  22612. splice.call(array, index, 1);
  22613. } else {
  22614. baseUnset(array, index);
  22615. }
  22616. }
  22617. }
  22618. return array;
  22619. }
  22620. /**
  22621. * The base implementation of `_.random` without support for returning
  22622. * floating-point numbers.
  22623. *
  22624. * @private
  22625. * @param {number} lower The lower bound.
  22626. * @param {number} upper The upper bound.
  22627. * @returns {number} Returns the random number.
  22628. */
  22629. function baseRandom(lower, upper) {
  22630. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22631. }
  22632. /**
  22633. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22634. * coerce arguments.
  22635. *
  22636. * @private
  22637. * @param {number} start The start of the range.
  22638. * @param {number} end The end of the range.
  22639. * @param {number} step The value to increment or decrement by.
  22640. * @param {boolean} [fromRight] Specify iterating from right to left.
  22641. * @returns {Array} Returns the range of numbers.
  22642. */
  22643. function baseRange(start, end, step, fromRight) {
  22644. var index = -1,
  22645. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22646. result = Array(length);
  22647. while (length--) {
  22648. result[fromRight ? length : ++index] = start;
  22649. start += step;
  22650. }
  22651. return result;
  22652. }
  22653. /**
  22654. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22655. *
  22656. * @private
  22657. * @param {string} string The string to repeat.
  22658. * @param {number} n The number of times to repeat the string.
  22659. * @returns {string} Returns the repeated string.
  22660. */
  22661. function baseRepeat(string, n) {
  22662. var result = '';
  22663. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22664. return result;
  22665. }
  22666. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22667. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22668. do {
  22669. if (n % 2) {
  22670. result += string;
  22671. }
  22672. n = nativeFloor(n / 2);
  22673. if (n) {
  22674. string += string;
  22675. }
  22676. } while (n);
  22677. return result;
  22678. }
  22679. /**
  22680. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22681. *
  22682. * @private
  22683. * @param {Function} func The function to apply a rest parameter to.
  22684. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22685. * @returns {Function} Returns the new function.
  22686. */
  22687. function baseRest(func, start) {
  22688. return setToString(overRest(func, start, identity), func + '');
  22689. }
  22690. /**
  22691. * The base implementation of `_.sample`.
  22692. *
  22693. * @private
  22694. * @param {Array|Object} collection The collection to sample.
  22695. * @returns {*} Returns the random element.
  22696. */
  22697. function baseSample(collection) {
  22698. return arraySample(values(collection));
  22699. }
  22700. /**
  22701. * The base implementation of `_.sampleSize` without param guards.
  22702. *
  22703. * @private
  22704. * @param {Array|Object} collection The collection to sample.
  22705. * @param {number} n The number of elements to sample.
  22706. * @returns {Array} Returns the random elements.
  22707. */
  22708. function baseSampleSize(collection, n) {
  22709. var array = values(collection);
  22710. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22711. }
  22712. /**
  22713. * The base implementation of `_.set`.
  22714. *
  22715. * @private
  22716. * @param {Object} object The object to modify.
  22717. * @param {Array|string} path The path of the property to set.
  22718. * @param {*} value The value to set.
  22719. * @param {Function} [customizer] The function to customize path creation.
  22720. * @returns {Object} Returns `object`.
  22721. */
  22722. function baseSet(object, path, value, customizer) {
  22723. if (!isObject(object)) {
  22724. return object;
  22725. }
  22726. path = castPath(path, object);
  22727. var index = -1,
  22728. length = path.length,
  22729. lastIndex = length - 1,
  22730. nested = object;
  22731. while (nested != null && ++index < length) {
  22732. var key = toKey(path[index]),
  22733. newValue = value;
  22734. if (index != lastIndex) {
  22735. var objValue = nested[key];
  22736. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22737. if (newValue === undefined) {
  22738. newValue = isObject(objValue)
  22739. ? objValue
  22740. : (isIndex(path[index + 1]) ? [] : {});
  22741. }
  22742. }
  22743. assignValue(nested, key, newValue);
  22744. nested = nested[key];
  22745. }
  22746. return object;
  22747. }
  22748. /**
  22749. * The base implementation of `setData` without support for hot loop shorting.
  22750. *
  22751. * @private
  22752. * @param {Function} func The function to associate metadata with.
  22753. * @param {*} data The metadata.
  22754. * @returns {Function} Returns `func`.
  22755. */
  22756. var baseSetData = !metaMap ? identity : function(func, data) {
  22757. metaMap.set(func, data);
  22758. return func;
  22759. };
  22760. /**
  22761. * The base implementation of `setToString` without support for hot loop shorting.
  22762. *
  22763. * @private
  22764. * @param {Function} func The function to modify.
  22765. * @param {Function} string The `toString` result.
  22766. * @returns {Function} Returns `func`.
  22767. */
  22768. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22769. return defineProperty(func, 'toString', {
  22770. 'configurable': true,
  22771. 'enumerable': false,
  22772. 'value': constant(string),
  22773. 'writable': true
  22774. });
  22775. };
  22776. /**
  22777. * The base implementation of `_.shuffle`.
  22778. *
  22779. * @private
  22780. * @param {Array|Object} collection The collection to shuffle.
  22781. * @returns {Array} Returns the new shuffled array.
  22782. */
  22783. function baseShuffle(collection) {
  22784. return shuffleSelf(values(collection));
  22785. }
  22786. /**
  22787. * The base implementation of `_.slice` without an iteratee call guard.
  22788. *
  22789. * @private
  22790. * @param {Array} array The array to slice.
  22791. * @param {number} [start=0] The start position.
  22792. * @param {number} [end=array.length] The end position.
  22793. * @returns {Array} Returns the slice of `array`.
  22794. */
  22795. function baseSlice(array, start, end) {
  22796. var index = -1,
  22797. length = array.length;
  22798. if (start < 0) {
  22799. start = -start > length ? 0 : (length + start);
  22800. }
  22801. end = end > length ? length : end;
  22802. if (end < 0) {
  22803. end += length;
  22804. }
  22805. length = start > end ? 0 : ((end - start) >>> 0);
  22806. start >>>= 0;
  22807. var result = Array(length);
  22808. while (++index < length) {
  22809. result[index] = array[index + start];
  22810. }
  22811. return result;
  22812. }
  22813. /**
  22814. * The base implementation of `_.some` without support for iteratee shorthands.
  22815. *
  22816. * @private
  22817. * @param {Array|Object} collection The collection to iterate over.
  22818. * @param {Function} predicate The function invoked per iteration.
  22819. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22820. * else `false`.
  22821. */
  22822. function baseSome(collection, predicate) {
  22823. var result;
  22824. baseEach(collection, function(value, index, collection) {
  22825. result = predicate(value, index, collection);
  22826. return !result;
  22827. });
  22828. return !!result;
  22829. }
  22830. /**
  22831. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22832. * performs a binary search of `array` to determine the index at which `value`
  22833. * should be inserted into `array` in order to maintain its sort order.
  22834. *
  22835. * @private
  22836. * @param {Array} array The sorted array to inspect.
  22837. * @param {*} value The value to evaluate.
  22838. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22839. * @returns {number} Returns the index at which `value` should be inserted
  22840. * into `array`.
  22841. */
  22842. function baseSortedIndex(array, value, retHighest) {
  22843. var low = 0,
  22844. high = array == null ? low : array.length;
  22845. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22846. while (low < high) {
  22847. var mid = (low + high) >>> 1,
  22848. computed = array[mid];
  22849. if (computed !== null && !isSymbol(computed) &&
  22850. (retHighest ? (computed <= value) : (computed < value))) {
  22851. low = mid + 1;
  22852. } else {
  22853. high = mid;
  22854. }
  22855. }
  22856. return high;
  22857. }
  22858. return baseSortedIndexBy(array, value, identity, retHighest);
  22859. }
  22860. /**
  22861. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22862. * which invokes `iteratee` for `value` and each element of `array` to compute
  22863. * their sort ranking. The iteratee is invoked with one argument; (value).
  22864. *
  22865. * @private
  22866. * @param {Array} array The sorted array to inspect.
  22867. * @param {*} value The value to evaluate.
  22868. * @param {Function} iteratee The iteratee invoked per element.
  22869. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22870. * @returns {number} Returns the index at which `value` should be inserted
  22871. * into `array`.
  22872. */
  22873. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22874. value = iteratee(value);
  22875. var low = 0,
  22876. high = array == null ? 0 : array.length,
  22877. valIsNaN = value !== value,
  22878. valIsNull = value === null,
  22879. valIsSymbol = isSymbol(value),
  22880. valIsUndefined = value === undefined;
  22881. while (low < high) {
  22882. var mid = nativeFloor((low + high) / 2),
  22883. computed = iteratee(array[mid]),
  22884. othIsDefined = computed !== undefined,
  22885. othIsNull = computed === null,
  22886. othIsReflexive = computed === computed,
  22887. othIsSymbol = isSymbol(computed);
  22888. if (valIsNaN) {
  22889. var setLow = retHighest || othIsReflexive;
  22890. } else if (valIsUndefined) {
  22891. setLow = othIsReflexive && (retHighest || othIsDefined);
  22892. } else if (valIsNull) {
  22893. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22894. } else if (valIsSymbol) {
  22895. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22896. } else if (othIsNull || othIsSymbol) {
  22897. setLow = false;
  22898. } else {
  22899. setLow = retHighest ? (computed <= value) : (computed < value);
  22900. }
  22901. if (setLow) {
  22902. low = mid + 1;
  22903. } else {
  22904. high = mid;
  22905. }
  22906. }
  22907. return nativeMin(high, MAX_ARRAY_INDEX);
  22908. }
  22909. /**
  22910. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22911. * support for iteratee shorthands.
  22912. *
  22913. * @private
  22914. * @param {Array} array The array to inspect.
  22915. * @param {Function} [iteratee] The iteratee invoked per element.
  22916. * @returns {Array} Returns the new duplicate free array.
  22917. */
  22918. function baseSortedUniq(array, iteratee) {
  22919. var index = -1,
  22920. length = array.length,
  22921. resIndex = 0,
  22922. result = [];
  22923. while (++index < length) {
  22924. var value = array[index],
  22925. computed = iteratee ? iteratee(value) : value;
  22926. if (!index || !eq(computed, seen)) {
  22927. var seen = computed;
  22928. result[resIndex++] = value === 0 ? 0 : value;
  22929. }
  22930. }
  22931. return result;
  22932. }
  22933. /**
  22934. * The base implementation of `_.toNumber` which doesn't ensure correct
  22935. * conversions of binary, hexadecimal, or octal string values.
  22936. *
  22937. * @private
  22938. * @param {*} value The value to process.
  22939. * @returns {number} Returns the number.
  22940. */
  22941. function baseToNumber(value) {
  22942. if (typeof value == 'number') {
  22943. return value;
  22944. }
  22945. if (isSymbol(value)) {
  22946. return NAN;
  22947. }
  22948. return +value;
  22949. }
  22950. /**
  22951. * The base implementation of `_.toString` which doesn't convert nullish
  22952. * values to empty strings.
  22953. *
  22954. * @private
  22955. * @param {*} value The value to process.
  22956. * @returns {string} Returns the string.
  22957. */
  22958. function baseToString(value) {
  22959. // Exit early for strings to avoid a performance hit in some environments.
  22960. if (typeof value == 'string') {
  22961. return value;
  22962. }
  22963. if (isArray(value)) {
  22964. // Recursively convert values (susceptible to call stack limits).
  22965. return arrayMap(value, baseToString) + '';
  22966. }
  22967. if (isSymbol(value)) {
  22968. return symbolToString ? symbolToString.call(value) : '';
  22969. }
  22970. var result = (value + '');
  22971. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22972. }
  22973. /**
  22974. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22975. *
  22976. * @private
  22977. * @param {Array} array The array to inspect.
  22978. * @param {Function} [iteratee] The iteratee invoked per element.
  22979. * @param {Function} [comparator] The comparator invoked per element.
  22980. * @returns {Array} Returns the new duplicate free array.
  22981. */
  22982. function baseUniq(array, iteratee, comparator) {
  22983. var index = -1,
  22984. includes = arrayIncludes,
  22985. length = array.length,
  22986. isCommon = true,
  22987. result = [],
  22988. seen = result;
  22989. if (comparator) {
  22990. isCommon = false;
  22991. includes = arrayIncludesWith;
  22992. }
  22993. else if (length >= LARGE_ARRAY_SIZE) {
  22994. var set = iteratee ? null : createSet(array);
  22995. if (set) {
  22996. return setToArray(set);
  22997. }
  22998. isCommon = false;
  22999. includes = cacheHas;
  23000. seen = new SetCache;
  23001. }
  23002. else {
  23003. seen = iteratee ? [] : result;
  23004. }
  23005. outer:
  23006. while (++index < length) {
  23007. var value = array[index],
  23008. computed = iteratee ? iteratee(value) : value;
  23009. value = (comparator || value !== 0) ? value : 0;
  23010. if (isCommon && computed === computed) {
  23011. var seenIndex = seen.length;
  23012. while (seenIndex--) {
  23013. if (seen[seenIndex] === computed) {
  23014. continue outer;
  23015. }
  23016. }
  23017. if (iteratee) {
  23018. seen.push(computed);
  23019. }
  23020. result.push(value);
  23021. }
  23022. else if (!includes(seen, computed, comparator)) {
  23023. if (seen !== result) {
  23024. seen.push(computed);
  23025. }
  23026. result.push(value);
  23027. }
  23028. }
  23029. return result;
  23030. }
  23031. /**
  23032. * The base implementation of `_.unset`.
  23033. *
  23034. * @private
  23035. * @param {Object} object The object to modify.
  23036. * @param {Array|string} path The property path to unset.
  23037. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23038. */
  23039. function baseUnset(object, path) {
  23040. path = castPath(path, object);
  23041. object = parent(object, path);
  23042. return object == null || delete object[toKey(last(path))];
  23043. }
  23044. /**
  23045. * The base implementation of `_.update`.
  23046. *
  23047. * @private
  23048. * @param {Object} object The object to modify.
  23049. * @param {Array|string} path The path of the property to update.
  23050. * @param {Function} updater The function to produce the updated value.
  23051. * @param {Function} [customizer] The function to customize path creation.
  23052. * @returns {Object} Returns `object`.
  23053. */
  23054. function baseUpdate(object, path, updater, customizer) {
  23055. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23056. }
  23057. /**
  23058. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23059. * without support for iteratee shorthands.
  23060. *
  23061. * @private
  23062. * @param {Array} array The array to query.
  23063. * @param {Function} predicate The function invoked per iteration.
  23064. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23065. * @param {boolean} [fromRight] Specify iterating from right to left.
  23066. * @returns {Array} Returns the slice of `array`.
  23067. */
  23068. function baseWhile(array, predicate, isDrop, fromRight) {
  23069. var length = array.length,
  23070. index = fromRight ? length : -1;
  23071. while ((fromRight ? index-- : ++index < length) &&
  23072. predicate(array[index], index, array)) {}
  23073. return isDrop
  23074. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23075. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23076. }
  23077. /**
  23078. * The base implementation of `wrapperValue` which returns the result of
  23079. * performing a sequence of actions on the unwrapped `value`, where each
  23080. * successive action is supplied the return value of the previous.
  23081. *
  23082. * @private
  23083. * @param {*} value The unwrapped value.
  23084. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23085. * @returns {*} Returns the resolved value.
  23086. */
  23087. function baseWrapperValue(value, actions) {
  23088. var result = value;
  23089. if (result instanceof LazyWrapper) {
  23090. result = result.value();
  23091. }
  23092. return arrayReduce(actions, function(result, action) {
  23093. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23094. }, result);
  23095. }
  23096. /**
  23097. * The base implementation of methods like `_.xor`, without support for
  23098. * iteratee shorthands, that accepts an array of arrays to inspect.
  23099. *
  23100. * @private
  23101. * @param {Array} arrays The arrays to inspect.
  23102. * @param {Function} [iteratee] The iteratee invoked per element.
  23103. * @param {Function} [comparator] The comparator invoked per element.
  23104. * @returns {Array} Returns the new array of values.
  23105. */
  23106. function baseXor(arrays, iteratee, comparator) {
  23107. var length = arrays.length;
  23108. if (length < 2) {
  23109. return length ? baseUniq(arrays[0]) : [];
  23110. }
  23111. var index = -1,
  23112. result = Array(length);
  23113. while (++index < length) {
  23114. var array = arrays[index],
  23115. othIndex = -1;
  23116. while (++othIndex < length) {
  23117. if (othIndex != index) {
  23118. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23119. }
  23120. }
  23121. }
  23122. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23123. }
  23124. /**
  23125. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23126. *
  23127. * @private
  23128. * @param {Array} props The property identifiers.
  23129. * @param {Array} values The property values.
  23130. * @param {Function} assignFunc The function to assign values.
  23131. * @returns {Object} Returns the new object.
  23132. */
  23133. function baseZipObject(props, values, assignFunc) {
  23134. var index = -1,
  23135. length = props.length,
  23136. valsLength = values.length,
  23137. result = {};
  23138. while (++index < length) {
  23139. var value = index < valsLength ? values[index] : undefined;
  23140. assignFunc(result, props[index], value);
  23141. }
  23142. return result;
  23143. }
  23144. /**
  23145. * Casts `value` to an empty array if it's not an array like object.
  23146. *
  23147. * @private
  23148. * @param {*} value The value to inspect.
  23149. * @returns {Array|Object} Returns the cast array-like object.
  23150. */
  23151. function castArrayLikeObject(value) {
  23152. return isArrayLikeObject(value) ? value : [];
  23153. }
  23154. /**
  23155. * Casts `value` to `identity` if it's not a function.
  23156. *
  23157. * @private
  23158. * @param {*} value The value to inspect.
  23159. * @returns {Function} Returns cast function.
  23160. */
  23161. function castFunction(value) {
  23162. return typeof value == 'function' ? value : identity;
  23163. }
  23164. /**
  23165. * Casts `value` to a path array if it's not one.
  23166. *
  23167. * @private
  23168. * @param {*} value The value to inspect.
  23169. * @param {Object} [object] The object to query keys on.
  23170. * @returns {Array} Returns the cast property path array.
  23171. */
  23172. function castPath(value, object) {
  23173. if (isArray(value)) {
  23174. return value;
  23175. }
  23176. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23177. }
  23178. /**
  23179. * A `baseRest` alias which can be replaced with `identity` by module
  23180. * replacement plugins.
  23181. *
  23182. * @private
  23183. * @type {Function}
  23184. * @param {Function} func The function to apply a rest parameter to.
  23185. * @returns {Function} Returns the new function.
  23186. */
  23187. var castRest = baseRest;
  23188. /**
  23189. * Casts `array` to a slice if it's needed.
  23190. *
  23191. * @private
  23192. * @param {Array} array The array to inspect.
  23193. * @param {number} start The start position.
  23194. * @param {number} [end=array.length] The end position.
  23195. * @returns {Array} Returns the cast slice.
  23196. */
  23197. function castSlice(array, start, end) {
  23198. var length = array.length;
  23199. end = end === undefined ? length : end;
  23200. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23201. }
  23202. /**
  23203. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23204. *
  23205. * @private
  23206. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23207. */
  23208. var clearTimeout = ctxClearTimeout || function(id) {
  23209. return root.clearTimeout(id);
  23210. };
  23211. /**
  23212. * Creates a clone of `buffer`.
  23213. *
  23214. * @private
  23215. * @param {Buffer} buffer The buffer to clone.
  23216. * @param {boolean} [isDeep] Specify a deep clone.
  23217. * @returns {Buffer} Returns the cloned buffer.
  23218. */
  23219. function cloneBuffer(buffer, isDeep) {
  23220. if (isDeep) {
  23221. return buffer.slice();
  23222. }
  23223. var length = buffer.length,
  23224. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23225. buffer.copy(result);
  23226. return result;
  23227. }
  23228. /**
  23229. * Creates a clone of `arrayBuffer`.
  23230. *
  23231. * @private
  23232. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23233. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23234. */
  23235. function cloneArrayBuffer(arrayBuffer) {
  23236. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23237. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23238. return result;
  23239. }
  23240. /**
  23241. * Creates a clone of `dataView`.
  23242. *
  23243. * @private
  23244. * @param {Object} dataView The data view to clone.
  23245. * @param {boolean} [isDeep] Specify a deep clone.
  23246. * @returns {Object} Returns the cloned data view.
  23247. */
  23248. function cloneDataView(dataView, isDeep) {
  23249. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23250. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23251. }
  23252. /**
  23253. * Creates a clone of `regexp`.
  23254. *
  23255. * @private
  23256. * @param {Object} regexp The regexp to clone.
  23257. * @returns {Object} Returns the cloned regexp.
  23258. */
  23259. function cloneRegExp(regexp) {
  23260. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23261. result.lastIndex = regexp.lastIndex;
  23262. return result;
  23263. }
  23264. /**
  23265. * Creates a clone of the `symbol` object.
  23266. *
  23267. * @private
  23268. * @param {Object} symbol The symbol object to clone.
  23269. * @returns {Object} Returns the cloned symbol object.
  23270. */
  23271. function cloneSymbol(symbol) {
  23272. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23273. }
  23274. /**
  23275. * Creates a clone of `typedArray`.
  23276. *
  23277. * @private
  23278. * @param {Object} typedArray The typed array to clone.
  23279. * @param {boolean} [isDeep] Specify a deep clone.
  23280. * @returns {Object} Returns the cloned typed array.
  23281. */
  23282. function cloneTypedArray(typedArray, isDeep) {
  23283. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23284. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23285. }
  23286. /**
  23287. * Compares values to sort them in ascending order.
  23288. *
  23289. * @private
  23290. * @param {*} value The value to compare.
  23291. * @param {*} other The other value to compare.
  23292. * @returns {number} Returns the sort order indicator for `value`.
  23293. */
  23294. function compareAscending(value, other) {
  23295. if (value !== other) {
  23296. var valIsDefined = value !== undefined,
  23297. valIsNull = value === null,
  23298. valIsReflexive = value === value,
  23299. valIsSymbol = isSymbol(value);
  23300. var othIsDefined = other !== undefined,
  23301. othIsNull = other === null,
  23302. othIsReflexive = other === other,
  23303. othIsSymbol = isSymbol(other);
  23304. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23305. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23306. (valIsNull && othIsDefined && othIsReflexive) ||
  23307. (!valIsDefined && othIsReflexive) ||
  23308. !valIsReflexive) {
  23309. return 1;
  23310. }
  23311. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23312. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23313. (othIsNull && valIsDefined && valIsReflexive) ||
  23314. (!othIsDefined && valIsReflexive) ||
  23315. !othIsReflexive) {
  23316. return -1;
  23317. }
  23318. }
  23319. return 0;
  23320. }
  23321. /**
  23322. * Used by `_.orderBy` to compare multiple properties of a value to another
  23323. * and stable sort them.
  23324. *
  23325. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23326. * specify an order of "desc" for descending or "asc" for ascending sort order
  23327. * of corresponding values.
  23328. *
  23329. * @private
  23330. * @param {Object} object The object to compare.
  23331. * @param {Object} other The other object to compare.
  23332. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23333. * @returns {number} Returns the sort order indicator for `object`.
  23334. */
  23335. function compareMultiple(object, other, orders) {
  23336. var index = -1,
  23337. objCriteria = object.criteria,
  23338. othCriteria = other.criteria,
  23339. length = objCriteria.length,
  23340. ordersLength = orders.length;
  23341. while (++index < length) {
  23342. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23343. if (result) {
  23344. if (index >= ordersLength) {
  23345. return result;
  23346. }
  23347. var order = orders[index];
  23348. return result * (order == 'desc' ? -1 : 1);
  23349. }
  23350. }
  23351. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23352. // that causes it, under certain circumstances, to provide the same value for
  23353. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23354. // for more details.
  23355. //
  23356. // This also ensures a stable sort in V8 and other engines.
  23357. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23358. return object.index - other.index;
  23359. }
  23360. /**
  23361. * Creates an array that is the composition of partially applied arguments,
  23362. * placeholders, and provided arguments into a single array of arguments.
  23363. *
  23364. * @private
  23365. * @param {Array} args The provided arguments.
  23366. * @param {Array} partials The arguments to prepend to those provided.
  23367. * @param {Array} holders The `partials` placeholder indexes.
  23368. * @params {boolean} [isCurried] Specify composing for a curried function.
  23369. * @returns {Array} Returns the new array of composed arguments.
  23370. */
  23371. function composeArgs(args, partials, holders, isCurried) {
  23372. var argsIndex = -1,
  23373. argsLength = args.length,
  23374. holdersLength = holders.length,
  23375. leftIndex = -1,
  23376. leftLength = partials.length,
  23377. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23378. result = Array(leftLength + rangeLength),
  23379. isUncurried = !isCurried;
  23380. while (++leftIndex < leftLength) {
  23381. result[leftIndex] = partials[leftIndex];
  23382. }
  23383. while (++argsIndex < holdersLength) {
  23384. if (isUncurried || argsIndex < argsLength) {
  23385. result[holders[argsIndex]] = args[argsIndex];
  23386. }
  23387. }
  23388. while (rangeLength--) {
  23389. result[leftIndex++] = args[argsIndex++];
  23390. }
  23391. return result;
  23392. }
  23393. /**
  23394. * This function is like `composeArgs` except that the arguments composition
  23395. * is tailored for `_.partialRight`.
  23396. *
  23397. * @private
  23398. * @param {Array} args The provided arguments.
  23399. * @param {Array} partials The arguments to append to those provided.
  23400. * @param {Array} holders The `partials` placeholder indexes.
  23401. * @params {boolean} [isCurried] Specify composing for a curried function.
  23402. * @returns {Array} Returns the new array of composed arguments.
  23403. */
  23404. function composeArgsRight(args, partials, holders, isCurried) {
  23405. var argsIndex = -1,
  23406. argsLength = args.length,
  23407. holdersIndex = -1,
  23408. holdersLength = holders.length,
  23409. rightIndex = -1,
  23410. rightLength = partials.length,
  23411. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23412. result = Array(rangeLength + rightLength),
  23413. isUncurried = !isCurried;
  23414. while (++argsIndex < rangeLength) {
  23415. result[argsIndex] = args[argsIndex];
  23416. }
  23417. var offset = argsIndex;
  23418. while (++rightIndex < rightLength) {
  23419. result[offset + rightIndex] = partials[rightIndex];
  23420. }
  23421. while (++holdersIndex < holdersLength) {
  23422. if (isUncurried || argsIndex < argsLength) {
  23423. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23424. }
  23425. }
  23426. return result;
  23427. }
  23428. /**
  23429. * Copies the values of `source` to `array`.
  23430. *
  23431. * @private
  23432. * @param {Array} source The array to copy values from.
  23433. * @param {Array} [array=[]] The array to copy values to.
  23434. * @returns {Array} Returns `array`.
  23435. */
  23436. function copyArray(source, array) {
  23437. var index = -1,
  23438. length = source.length;
  23439. array || (array = Array(length));
  23440. while (++index < length) {
  23441. array[index] = source[index];
  23442. }
  23443. return array;
  23444. }
  23445. /**
  23446. * Copies properties of `source` to `object`.
  23447. *
  23448. * @private
  23449. * @param {Object} source The object to copy properties from.
  23450. * @param {Array} props The property identifiers to copy.
  23451. * @param {Object} [object={}] The object to copy properties to.
  23452. * @param {Function} [customizer] The function to customize copied values.
  23453. * @returns {Object} Returns `object`.
  23454. */
  23455. function copyObject(source, props, object, customizer) {
  23456. var isNew = !object;
  23457. object || (object = {});
  23458. var index = -1,
  23459. length = props.length;
  23460. while (++index < length) {
  23461. var key = props[index];
  23462. var newValue = customizer
  23463. ? customizer(object[key], source[key], key, object, source)
  23464. : undefined;
  23465. if (newValue === undefined) {
  23466. newValue = source[key];
  23467. }
  23468. if (isNew) {
  23469. baseAssignValue(object, key, newValue);
  23470. } else {
  23471. assignValue(object, key, newValue);
  23472. }
  23473. }
  23474. return object;
  23475. }
  23476. /**
  23477. * Copies own symbols of `source` to `object`.
  23478. *
  23479. * @private
  23480. * @param {Object} source The object to copy symbols from.
  23481. * @param {Object} [object={}] The object to copy symbols to.
  23482. * @returns {Object} Returns `object`.
  23483. */
  23484. function copySymbols(source, object) {
  23485. return copyObject(source, getSymbols(source), object);
  23486. }
  23487. /**
  23488. * Copies own and inherited symbols of `source` to `object`.
  23489. *
  23490. * @private
  23491. * @param {Object} source The object to copy symbols from.
  23492. * @param {Object} [object={}] The object to copy symbols to.
  23493. * @returns {Object} Returns `object`.
  23494. */
  23495. function copySymbolsIn(source, object) {
  23496. return copyObject(source, getSymbolsIn(source), object);
  23497. }
  23498. /**
  23499. * Creates a function like `_.groupBy`.
  23500. *
  23501. * @private
  23502. * @param {Function} setter The function to set accumulator values.
  23503. * @param {Function} [initializer] The accumulator object initializer.
  23504. * @returns {Function} Returns the new aggregator function.
  23505. */
  23506. function createAggregator(setter, initializer) {
  23507. return function(collection, iteratee) {
  23508. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23509. accumulator = initializer ? initializer() : {};
  23510. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23511. };
  23512. }
  23513. /**
  23514. * Creates a function like `_.assign`.
  23515. *
  23516. * @private
  23517. * @param {Function} assigner The function to assign values.
  23518. * @returns {Function} Returns the new assigner function.
  23519. */
  23520. function createAssigner(assigner) {
  23521. return baseRest(function(object, sources) {
  23522. var index = -1,
  23523. length = sources.length,
  23524. customizer = length > 1 ? sources[length - 1] : undefined,
  23525. guard = length > 2 ? sources[2] : undefined;
  23526. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23527. ? (length--, customizer)
  23528. : undefined;
  23529. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23530. customizer = length < 3 ? undefined : customizer;
  23531. length = 1;
  23532. }
  23533. object = Object(object);
  23534. while (++index < length) {
  23535. var source = sources[index];
  23536. if (source) {
  23537. assigner(object, source, index, customizer);
  23538. }
  23539. }
  23540. return object;
  23541. });
  23542. }
  23543. /**
  23544. * Creates a `baseEach` or `baseEachRight` function.
  23545. *
  23546. * @private
  23547. * @param {Function} eachFunc The function to iterate over a collection.
  23548. * @param {boolean} [fromRight] Specify iterating from right to left.
  23549. * @returns {Function} Returns the new base function.
  23550. */
  23551. function createBaseEach(eachFunc, fromRight) {
  23552. return function(collection, iteratee) {
  23553. if (collection == null) {
  23554. return collection;
  23555. }
  23556. if (!isArrayLike(collection)) {
  23557. return eachFunc(collection, iteratee);
  23558. }
  23559. var length = collection.length,
  23560. index = fromRight ? length : -1,
  23561. iterable = Object(collection);
  23562. while ((fromRight ? index-- : ++index < length)) {
  23563. if (iteratee(iterable[index], index, iterable) === false) {
  23564. break;
  23565. }
  23566. }
  23567. return collection;
  23568. };
  23569. }
  23570. /**
  23571. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23572. *
  23573. * @private
  23574. * @param {boolean} [fromRight] Specify iterating from right to left.
  23575. * @returns {Function} Returns the new base function.
  23576. */
  23577. function createBaseFor(fromRight) {
  23578. return function(object, iteratee, keysFunc) {
  23579. var index = -1,
  23580. iterable = Object(object),
  23581. props = keysFunc(object),
  23582. length = props.length;
  23583. while (length--) {
  23584. var key = props[fromRight ? length : ++index];
  23585. if (iteratee(iterable[key], key, iterable) === false) {
  23586. break;
  23587. }
  23588. }
  23589. return object;
  23590. };
  23591. }
  23592. /**
  23593. * Creates a function that wraps `func` to invoke it with the optional `this`
  23594. * binding of `thisArg`.
  23595. *
  23596. * @private
  23597. * @param {Function} func The function to wrap.
  23598. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23599. * @param {*} [thisArg] The `this` binding of `func`.
  23600. * @returns {Function} Returns the new wrapped function.
  23601. */
  23602. function createBind(func, bitmask, thisArg) {
  23603. var isBind = bitmask & WRAP_BIND_FLAG,
  23604. Ctor = createCtor(func);
  23605. function wrapper() {
  23606. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23607. return fn.apply(isBind ? thisArg : this, arguments);
  23608. }
  23609. return wrapper;
  23610. }
  23611. /**
  23612. * Creates a function like `_.lowerFirst`.
  23613. *
  23614. * @private
  23615. * @param {string} methodName The name of the `String` case method to use.
  23616. * @returns {Function} Returns the new case function.
  23617. */
  23618. function createCaseFirst(methodName) {
  23619. return function(string) {
  23620. string = toString(string);
  23621. var strSymbols = hasUnicode(string)
  23622. ? stringToArray(string)
  23623. : undefined;
  23624. var chr = strSymbols
  23625. ? strSymbols[0]
  23626. : string.charAt(0);
  23627. var trailing = strSymbols
  23628. ? castSlice(strSymbols, 1).join('')
  23629. : string.slice(1);
  23630. return chr[methodName]() + trailing;
  23631. };
  23632. }
  23633. /**
  23634. * Creates a function like `_.camelCase`.
  23635. *
  23636. * @private
  23637. * @param {Function} callback The function to combine each word.
  23638. * @returns {Function} Returns the new compounder function.
  23639. */
  23640. function createCompounder(callback) {
  23641. return function(string) {
  23642. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23643. };
  23644. }
  23645. /**
  23646. * Creates a function that produces an instance of `Ctor` regardless of
  23647. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23648. *
  23649. * @private
  23650. * @param {Function} Ctor The constructor to wrap.
  23651. * @returns {Function} Returns the new wrapped function.
  23652. */
  23653. function createCtor(Ctor) {
  23654. return function() {
  23655. // Use a `switch` statement to work with class constructors. See
  23656. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23657. // for more details.
  23658. var args = arguments;
  23659. switch (args.length) {
  23660. case 0: return new Ctor;
  23661. case 1: return new Ctor(args[0]);
  23662. case 2: return new Ctor(args[0], args[1]);
  23663. case 3: return new Ctor(args[0], args[1], args[2]);
  23664. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23665. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23666. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23667. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23668. }
  23669. var thisBinding = baseCreate(Ctor.prototype),
  23670. result = Ctor.apply(thisBinding, args);
  23671. // Mimic the constructor's `return` behavior.
  23672. // See https://es5.github.io/#x13.2.2 for more details.
  23673. return isObject(result) ? result : thisBinding;
  23674. };
  23675. }
  23676. /**
  23677. * Creates a function that wraps `func` to enable currying.
  23678. *
  23679. * @private
  23680. * @param {Function} func The function to wrap.
  23681. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23682. * @param {number} arity The arity of `func`.
  23683. * @returns {Function} Returns the new wrapped function.
  23684. */
  23685. function createCurry(func, bitmask, arity) {
  23686. var Ctor = createCtor(func);
  23687. function wrapper() {
  23688. var length = arguments.length,
  23689. args = Array(length),
  23690. index = length,
  23691. placeholder = getHolder(wrapper);
  23692. while (index--) {
  23693. args[index] = arguments[index];
  23694. }
  23695. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23696. ? []
  23697. : replaceHolders(args, placeholder);
  23698. length -= holders.length;
  23699. if (length < arity) {
  23700. return createRecurry(
  23701. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23702. args, holders, undefined, undefined, arity - length);
  23703. }
  23704. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23705. return apply(fn, this, args);
  23706. }
  23707. return wrapper;
  23708. }
  23709. /**
  23710. * Creates a `_.find` or `_.findLast` function.
  23711. *
  23712. * @private
  23713. * @param {Function} findIndexFunc The function to find the collection index.
  23714. * @returns {Function} Returns the new find function.
  23715. */
  23716. function createFind(findIndexFunc) {
  23717. return function(collection, predicate, fromIndex) {
  23718. var iterable = Object(collection);
  23719. if (!isArrayLike(collection)) {
  23720. var iteratee = getIteratee(predicate, 3);
  23721. collection = keys(collection);
  23722. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23723. }
  23724. var index = findIndexFunc(collection, predicate, fromIndex);
  23725. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23726. };
  23727. }
  23728. /**
  23729. * Creates a `_.flow` or `_.flowRight` function.
  23730. *
  23731. * @private
  23732. * @param {boolean} [fromRight] Specify iterating from right to left.
  23733. * @returns {Function} Returns the new flow function.
  23734. */
  23735. function createFlow(fromRight) {
  23736. return flatRest(function(funcs) {
  23737. var length = funcs.length,
  23738. index = length,
  23739. prereq = LodashWrapper.prototype.thru;
  23740. if (fromRight) {
  23741. funcs.reverse();
  23742. }
  23743. while (index--) {
  23744. var func = funcs[index];
  23745. if (typeof func != 'function') {
  23746. throw new TypeError(FUNC_ERROR_TEXT);
  23747. }
  23748. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23749. var wrapper = new LodashWrapper([], true);
  23750. }
  23751. }
  23752. index = wrapper ? index : length;
  23753. while (++index < length) {
  23754. func = funcs[index];
  23755. var funcName = getFuncName(func),
  23756. data = funcName == 'wrapper' ? getData(func) : undefined;
  23757. if (data && isLaziable(data[0]) &&
  23758. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23759. !data[4].length && data[9] == 1
  23760. ) {
  23761. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23762. } else {
  23763. wrapper = (func.length == 1 && isLaziable(func))
  23764. ? wrapper[funcName]()
  23765. : wrapper.thru(func);
  23766. }
  23767. }
  23768. return function() {
  23769. var args = arguments,
  23770. value = args[0];
  23771. if (wrapper && args.length == 1 && isArray(value)) {
  23772. return wrapper.plant(value).value();
  23773. }
  23774. var index = 0,
  23775. result = length ? funcs[index].apply(this, args) : value;
  23776. while (++index < length) {
  23777. result = funcs[index].call(this, result);
  23778. }
  23779. return result;
  23780. };
  23781. });
  23782. }
  23783. /**
  23784. * Creates a function that wraps `func` to invoke it with optional `this`
  23785. * binding of `thisArg`, partial application, and currying.
  23786. *
  23787. * @private
  23788. * @param {Function|string} func The function or method name to wrap.
  23789. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23790. * @param {*} [thisArg] The `this` binding of `func`.
  23791. * @param {Array} [partials] The arguments to prepend to those provided to
  23792. * the new function.
  23793. * @param {Array} [holders] The `partials` placeholder indexes.
  23794. * @param {Array} [partialsRight] The arguments to append to those provided
  23795. * to the new function.
  23796. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23797. * @param {Array} [argPos] The argument positions of the new function.
  23798. * @param {number} [ary] The arity cap of `func`.
  23799. * @param {number} [arity] The arity of `func`.
  23800. * @returns {Function} Returns the new wrapped function.
  23801. */
  23802. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23803. var isAry = bitmask & WRAP_ARY_FLAG,
  23804. isBind = bitmask & WRAP_BIND_FLAG,
  23805. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23806. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23807. isFlip = bitmask & WRAP_FLIP_FLAG,
  23808. Ctor = isBindKey ? undefined : createCtor(func);
  23809. function wrapper() {
  23810. var length = arguments.length,
  23811. args = Array(length),
  23812. index = length;
  23813. while (index--) {
  23814. args[index] = arguments[index];
  23815. }
  23816. if (isCurried) {
  23817. var placeholder = getHolder(wrapper),
  23818. holdersCount = countHolders(args, placeholder);
  23819. }
  23820. if (partials) {
  23821. args = composeArgs(args, partials, holders, isCurried);
  23822. }
  23823. if (partialsRight) {
  23824. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23825. }
  23826. length -= holdersCount;
  23827. if (isCurried && length < arity) {
  23828. var newHolders = replaceHolders(args, placeholder);
  23829. return createRecurry(
  23830. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23831. args, newHolders, argPos, ary, arity - length
  23832. );
  23833. }
  23834. var thisBinding = isBind ? thisArg : this,
  23835. fn = isBindKey ? thisBinding[func] : func;
  23836. length = args.length;
  23837. if (argPos) {
  23838. args = reorder(args, argPos);
  23839. } else if (isFlip && length > 1) {
  23840. args.reverse();
  23841. }
  23842. if (isAry && ary < length) {
  23843. args.length = ary;
  23844. }
  23845. if (this && this !== root && this instanceof wrapper) {
  23846. fn = Ctor || createCtor(fn);
  23847. }
  23848. return fn.apply(thisBinding, args);
  23849. }
  23850. return wrapper;
  23851. }
  23852. /**
  23853. * Creates a function like `_.invertBy`.
  23854. *
  23855. * @private
  23856. * @param {Function} setter The function to set accumulator values.
  23857. * @param {Function} toIteratee The function to resolve iteratees.
  23858. * @returns {Function} Returns the new inverter function.
  23859. */
  23860. function createInverter(setter, toIteratee) {
  23861. return function(object, iteratee) {
  23862. return baseInverter(object, setter, toIteratee(iteratee), {});
  23863. };
  23864. }
  23865. /**
  23866. * Creates a function that performs a mathematical operation on two values.
  23867. *
  23868. * @private
  23869. * @param {Function} operator The function to perform the operation.
  23870. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23871. * @returns {Function} Returns the new mathematical operation function.
  23872. */
  23873. function createMathOperation(operator, defaultValue) {
  23874. return function(value, other) {
  23875. var result;
  23876. if (value === undefined && other === undefined) {
  23877. return defaultValue;
  23878. }
  23879. if (value !== undefined) {
  23880. result = value;
  23881. }
  23882. if (other !== undefined) {
  23883. if (result === undefined) {
  23884. return other;
  23885. }
  23886. if (typeof value == 'string' || typeof other == 'string') {
  23887. value = baseToString(value);
  23888. other = baseToString(other);
  23889. } else {
  23890. value = baseToNumber(value);
  23891. other = baseToNumber(other);
  23892. }
  23893. result = operator(value, other);
  23894. }
  23895. return result;
  23896. };
  23897. }
  23898. /**
  23899. * Creates a function like `_.over`.
  23900. *
  23901. * @private
  23902. * @param {Function} arrayFunc The function to iterate over iteratees.
  23903. * @returns {Function} Returns the new over function.
  23904. */
  23905. function createOver(arrayFunc) {
  23906. return flatRest(function(iteratees) {
  23907. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23908. return baseRest(function(args) {
  23909. var thisArg = this;
  23910. return arrayFunc(iteratees, function(iteratee) {
  23911. return apply(iteratee, thisArg, args);
  23912. });
  23913. });
  23914. });
  23915. }
  23916. /**
  23917. * Creates the padding for `string` based on `length`. The `chars` string
  23918. * is truncated if the number of characters exceeds `length`.
  23919. *
  23920. * @private
  23921. * @param {number} length The padding length.
  23922. * @param {string} [chars=' '] The string used as padding.
  23923. * @returns {string} Returns the padding for `string`.
  23924. */
  23925. function createPadding(length, chars) {
  23926. chars = chars === undefined ? ' ' : baseToString(chars);
  23927. var charsLength = chars.length;
  23928. if (charsLength < 2) {
  23929. return charsLength ? baseRepeat(chars, length) : chars;
  23930. }
  23931. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23932. return hasUnicode(chars)
  23933. ? castSlice(stringToArray(result), 0, length).join('')
  23934. : result.slice(0, length);
  23935. }
  23936. /**
  23937. * Creates a function that wraps `func` to invoke it with the `this` binding
  23938. * of `thisArg` and `partials` prepended to the arguments it receives.
  23939. *
  23940. * @private
  23941. * @param {Function} func The function to wrap.
  23942. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23943. * @param {*} thisArg The `this` binding of `func`.
  23944. * @param {Array} partials The arguments to prepend to those provided to
  23945. * the new function.
  23946. * @returns {Function} Returns the new wrapped function.
  23947. */
  23948. function createPartial(func, bitmask, thisArg, partials) {
  23949. var isBind = bitmask & WRAP_BIND_FLAG,
  23950. Ctor = createCtor(func);
  23951. function wrapper() {
  23952. var argsIndex = -1,
  23953. argsLength = arguments.length,
  23954. leftIndex = -1,
  23955. leftLength = partials.length,
  23956. args = Array(leftLength + argsLength),
  23957. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23958. while (++leftIndex < leftLength) {
  23959. args[leftIndex] = partials[leftIndex];
  23960. }
  23961. while (argsLength--) {
  23962. args[leftIndex++] = arguments[++argsIndex];
  23963. }
  23964. return apply(fn, isBind ? thisArg : this, args);
  23965. }
  23966. return wrapper;
  23967. }
  23968. /**
  23969. * Creates a `_.range` or `_.rangeRight` function.
  23970. *
  23971. * @private
  23972. * @param {boolean} [fromRight] Specify iterating from right to left.
  23973. * @returns {Function} Returns the new range function.
  23974. */
  23975. function createRange(fromRight) {
  23976. return function(start, end, step) {
  23977. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23978. end = step = undefined;
  23979. }
  23980. // Ensure the sign of `-0` is preserved.
  23981. start = toFinite(start);
  23982. if (end === undefined) {
  23983. end = start;
  23984. start = 0;
  23985. } else {
  23986. end = toFinite(end);
  23987. }
  23988. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23989. return baseRange(start, end, step, fromRight);
  23990. };
  23991. }
  23992. /**
  23993. * Creates a function that performs a relational operation on two values.
  23994. *
  23995. * @private
  23996. * @param {Function} operator The function to perform the operation.
  23997. * @returns {Function} Returns the new relational operation function.
  23998. */
  23999. function createRelationalOperation(operator) {
  24000. return function(value, other) {
  24001. if (!(typeof value == 'string' && typeof other == 'string')) {
  24002. value = toNumber(value);
  24003. other = toNumber(other);
  24004. }
  24005. return operator(value, other);
  24006. };
  24007. }
  24008. /**
  24009. * Creates a function that wraps `func` to continue currying.
  24010. *
  24011. * @private
  24012. * @param {Function} func The function to wrap.
  24013. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24014. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24015. * @param {*} placeholder The placeholder value.
  24016. * @param {*} [thisArg] The `this` binding of `func`.
  24017. * @param {Array} [partials] The arguments to prepend to those provided to
  24018. * the new function.
  24019. * @param {Array} [holders] The `partials` placeholder indexes.
  24020. * @param {Array} [argPos] The argument positions of the new function.
  24021. * @param {number} [ary] The arity cap of `func`.
  24022. * @param {number} [arity] The arity of `func`.
  24023. * @returns {Function} Returns the new wrapped function.
  24024. */
  24025. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24026. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24027. newHolders = isCurry ? holders : undefined,
  24028. newHoldersRight = isCurry ? undefined : holders,
  24029. newPartials = isCurry ? partials : undefined,
  24030. newPartialsRight = isCurry ? undefined : partials;
  24031. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24032. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24033. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24034. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24035. }
  24036. var newData = [
  24037. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24038. newHoldersRight, argPos, ary, arity
  24039. ];
  24040. var result = wrapFunc.apply(undefined, newData);
  24041. if (isLaziable(func)) {
  24042. setData(result, newData);
  24043. }
  24044. result.placeholder = placeholder;
  24045. return setWrapToString(result, func, bitmask);
  24046. }
  24047. /**
  24048. * Creates a function like `_.round`.
  24049. *
  24050. * @private
  24051. * @param {string} methodName The name of the `Math` method to use when rounding.
  24052. * @returns {Function} Returns the new round function.
  24053. */
  24054. function createRound(methodName) {
  24055. var func = Math[methodName];
  24056. return function(number, precision) {
  24057. number = toNumber(number);
  24058. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24059. if (precision && nativeIsFinite(number)) {
  24060. // Shift with exponential notation to avoid floating-point issues.
  24061. // See [MDN](https://mdn.io/round#Examples) for more details.
  24062. var pair = (toString(number) + 'e').split('e'),
  24063. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24064. pair = (toString(value) + 'e').split('e');
  24065. return +(pair[0] + 'e' + (+pair[1] - precision));
  24066. }
  24067. return func(number);
  24068. };
  24069. }
  24070. /**
  24071. * Creates a set object of `values`.
  24072. *
  24073. * @private
  24074. * @param {Array} values The values to add to the set.
  24075. * @returns {Object} Returns the new set.
  24076. */
  24077. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24078. return new Set(values);
  24079. };
  24080. /**
  24081. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24082. *
  24083. * @private
  24084. * @param {Function} keysFunc The function to get the keys of a given object.
  24085. * @returns {Function} Returns the new pairs function.
  24086. */
  24087. function createToPairs(keysFunc) {
  24088. return function(object) {
  24089. var tag = getTag(object);
  24090. if (tag == mapTag) {
  24091. return mapToArray(object);
  24092. }
  24093. if (tag == setTag) {
  24094. return setToPairs(object);
  24095. }
  24096. return baseToPairs(object, keysFunc(object));
  24097. };
  24098. }
  24099. /**
  24100. * Creates a function that either curries or invokes `func` with optional
  24101. * `this` binding and partially applied arguments.
  24102. *
  24103. * @private
  24104. * @param {Function|string} func The function or method name to wrap.
  24105. * @param {number} bitmask The bitmask flags.
  24106. * 1 - `_.bind`
  24107. * 2 - `_.bindKey`
  24108. * 4 - `_.curry` or `_.curryRight` of a bound function
  24109. * 8 - `_.curry`
  24110. * 16 - `_.curryRight`
  24111. * 32 - `_.partial`
  24112. * 64 - `_.partialRight`
  24113. * 128 - `_.rearg`
  24114. * 256 - `_.ary`
  24115. * 512 - `_.flip`
  24116. * @param {*} [thisArg] The `this` binding of `func`.
  24117. * @param {Array} [partials] The arguments to be partially applied.
  24118. * @param {Array} [holders] The `partials` placeholder indexes.
  24119. * @param {Array} [argPos] The argument positions of the new function.
  24120. * @param {number} [ary] The arity cap of `func`.
  24121. * @param {number} [arity] The arity of `func`.
  24122. * @returns {Function} Returns the new wrapped function.
  24123. */
  24124. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24125. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24126. if (!isBindKey && typeof func != 'function') {
  24127. throw new TypeError(FUNC_ERROR_TEXT);
  24128. }
  24129. var length = partials ? partials.length : 0;
  24130. if (!length) {
  24131. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24132. partials = holders = undefined;
  24133. }
  24134. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24135. arity = arity === undefined ? arity : toInteger(arity);
  24136. length -= holders ? holders.length : 0;
  24137. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24138. var partialsRight = partials,
  24139. holdersRight = holders;
  24140. partials = holders = undefined;
  24141. }
  24142. var data = isBindKey ? undefined : getData(func);
  24143. var newData = [
  24144. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24145. argPos, ary, arity
  24146. ];
  24147. if (data) {
  24148. mergeData(newData, data);
  24149. }
  24150. func = newData[0];
  24151. bitmask = newData[1];
  24152. thisArg = newData[2];
  24153. partials = newData[3];
  24154. holders = newData[4];
  24155. arity = newData[9] = newData[9] === undefined
  24156. ? (isBindKey ? 0 : func.length)
  24157. : nativeMax(newData[9] - length, 0);
  24158. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24159. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24160. }
  24161. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24162. var result = createBind(func, bitmask, thisArg);
  24163. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24164. result = createCurry(func, bitmask, arity);
  24165. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24166. result = createPartial(func, bitmask, thisArg, partials);
  24167. } else {
  24168. result = createHybrid.apply(undefined, newData);
  24169. }
  24170. var setter = data ? baseSetData : setData;
  24171. return setWrapToString(setter(result, newData), func, bitmask);
  24172. }
  24173. /**
  24174. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24175. * of source objects to the destination object for all destination properties
  24176. * that resolve to `undefined`.
  24177. *
  24178. * @private
  24179. * @param {*} objValue The destination value.
  24180. * @param {*} srcValue The source value.
  24181. * @param {string} key The key of the property to assign.
  24182. * @param {Object} object The parent object of `objValue`.
  24183. * @returns {*} Returns the value to assign.
  24184. */
  24185. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24186. if (objValue === undefined ||
  24187. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24188. return srcValue;
  24189. }
  24190. return objValue;
  24191. }
  24192. /**
  24193. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24194. * objects into destination objects that are passed thru.
  24195. *
  24196. * @private
  24197. * @param {*} objValue The destination value.
  24198. * @param {*} srcValue The source value.
  24199. * @param {string} key The key of the property to merge.
  24200. * @param {Object} object The parent object of `objValue`.
  24201. * @param {Object} source The parent object of `srcValue`.
  24202. * @param {Object} [stack] Tracks traversed source values and their merged
  24203. * counterparts.
  24204. * @returns {*} Returns the value to assign.
  24205. */
  24206. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24207. if (isObject(objValue) && isObject(srcValue)) {
  24208. // Recursively merge objects and arrays (susceptible to call stack limits).
  24209. stack.set(srcValue, objValue);
  24210. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24211. stack['delete'](srcValue);
  24212. }
  24213. return objValue;
  24214. }
  24215. /**
  24216. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24217. * objects.
  24218. *
  24219. * @private
  24220. * @param {*} value The value to inspect.
  24221. * @param {string} key The key of the property to inspect.
  24222. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24223. */
  24224. function customOmitClone(value) {
  24225. return isPlainObject(value) ? undefined : value;
  24226. }
  24227. /**
  24228. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24229. * partial deep comparisons.
  24230. *
  24231. * @private
  24232. * @param {Array} array The array to compare.
  24233. * @param {Array} other The other array to compare.
  24234. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24235. * @param {Function} customizer The function to customize comparisons.
  24236. * @param {Function} equalFunc The function to determine equivalents of values.
  24237. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24238. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24239. */
  24240. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24241. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24242. arrLength = array.length,
  24243. othLength = other.length;
  24244. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24245. return false;
  24246. }
  24247. // Assume cyclic values are equal.
  24248. var stacked = stack.get(array);
  24249. if (stacked && stack.get(other)) {
  24250. return stacked == other;
  24251. }
  24252. var index = -1,
  24253. result = true,
  24254. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24255. stack.set(array, other);
  24256. stack.set(other, array);
  24257. // Ignore non-index properties.
  24258. while (++index < arrLength) {
  24259. var arrValue = array[index],
  24260. othValue = other[index];
  24261. if (customizer) {
  24262. var compared = isPartial
  24263. ? customizer(othValue, arrValue, index, other, array, stack)
  24264. : customizer(arrValue, othValue, index, array, other, stack);
  24265. }
  24266. if (compared !== undefined) {
  24267. if (compared) {
  24268. continue;
  24269. }
  24270. result = false;
  24271. break;
  24272. }
  24273. // Recursively compare arrays (susceptible to call stack limits).
  24274. if (seen) {
  24275. if (!arraySome(other, function(othValue, othIndex) {
  24276. if (!cacheHas(seen, othIndex) &&
  24277. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24278. return seen.push(othIndex);
  24279. }
  24280. })) {
  24281. result = false;
  24282. break;
  24283. }
  24284. } else if (!(
  24285. arrValue === othValue ||
  24286. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24287. )) {
  24288. result = false;
  24289. break;
  24290. }
  24291. }
  24292. stack['delete'](array);
  24293. stack['delete'](other);
  24294. return result;
  24295. }
  24296. /**
  24297. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24298. * the same `toStringTag`.
  24299. *
  24300. * **Note:** This function only supports comparing values with tags of
  24301. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24302. *
  24303. * @private
  24304. * @param {Object} object The object to compare.
  24305. * @param {Object} other The other object to compare.
  24306. * @param {string} tag The `toStringTag` of the objects to compare.
  24307. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24308. * @param {Function} customizer The function to customize comparisons.
  24309. * @param {Function} equalFunc The function to determine equivalents of values.
  24310. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24311. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24312. */
  24313. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24314. switch (tag) {
  24315. case dataViewTag:
  24316. if ((object.byteLength != other.byteLength) ||
  24317. (object.byteOffset != other.byteOffset)) {
  24318. return false;
  24319. }
  24320. object = object.buffer;
  24321. other = other.buffer;
  24322. case arrayBufferTag:
  24323. if ((object.byteLength != other.byteLength) ||
  24324. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24325. return false;
  24326. }
  24327. return true;
  24328. case boolTag:
  24329. case dateTag:
  24330. case numberTag:
  24331. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24332. // Invalid dates are coerced to `NaN`.
  24333. return eq(+object, +other);
  24334. case errorTag:
  24335. return object.name == other.name && object.message == other.message;
  24336. case regexpTag:
  24337. case stringTag:
  24338. // Coerce regexes to strings and treat strings, primitives and objects,
  24339. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24340. // for more details.
  24341. return object == (other + '');
  24342. case mapTag:
  24343. var convert = mapToArray;
  24344. case setTag:
  24345. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24346. convert || (convert = setToArray);
  24347. if (object.size != other.size && !isPartial) {
  24348. return false;
  24349. }
  24350. // Assume cyclic values are equal.
  24351. var stacked = stack.get(object);
  24352. if (stacked) {
  24353. return stacked == other;
  24354. }
  24355. bitmask |= COMPARE_UNORDERED_FLAG;
  24356. // Recursively compare objects (susceptible to call stack limits).
  24357. stack.set(object, other);
  24358. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24359. stack['delete'](object);
  24360. return result;
  24361. case symbolTag:
  24362. if (symbolValueOf) {
  24363. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24364. }
  24365. }
  24366. return false;
  24367. }
  24368. /**
  24369. * A specialized version of `baseIsEqualDeep` for objects with support for
  24370. * partial deep comparisons.
  24371. *
  24372. * @private
  24373. * @param {Object} object The object to compare.
  24374. * @param {Object} other The other object to compare.
  24375. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24376. * @param {Function} customizer The function to customize comparisons.
  24377. * @param {Function} equalFunc The function to determine equivalents of values.
  24378. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24379. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24380. */
  24381. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24382. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24383. objProps = getAllKeys(object),
  24384. objLength = objProps.length,
  24385. othProps = getAllKeys(other),
  24386. othLength = othProps.length;
  24387. if (objLength != othLength && !isPartial) {
  24388. return false;
  24389. }
  24390. var index = objLength;
  24391. while (index--) {
  24392. var key = objProps[index];
  24393. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24394. return false;
  24395. }
  24396. }
  24397. // Assume cyclic values are equal.
  24398. var stacked = stack.get(object);
  24399. if (stacked && stack.get(other)) {
  24400. return stacked == other;
  24401. }
  24402. var result = true;
  24403. stack.set(object, other);
  24404. stack.set(other, object);
  24405. var skipCtor = isPartial;
  24406. while (++index < objLength) {
  24407. key = objProps[index];
  24408. var objValue = object[key],
  24409. othValue = other[key];
  24410. if (customizer) {
  24411. var compared = isPartial
  24412. ? customizer(othValue, objValue, key, other, object, stack)
  24413. : customizer(objValue, othValue, key, object, other, stack);
  24414. }
  24415. // Recursively compare objects (susceptible to call stack limits).
  24416. if (!(compared === undefined
  24417. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24418. : compared
  24419. )) {
  24420. result = false;
  24421. break;
  24422. }
  24423. skipCtor || (skipCtor = key == 'constructor');
  24424. }
  24425. if (result && !skipCtor) {
  24426. var objCtor = object.constructor,
  24427. othCtor = other.constructor;
  24428. // Non `Object` object instances with different constructors are not equal.
  24429. if (objCtor != othCtor &&
  24430. ('constructor' in object && 'constructor' in other) &&
  24431. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24432. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24433. result = false;
  24434. }
  24435. }
  24436. stack['delete'](object);
  24437. stack['delete'](other);
  24438. return result;
  24439. }
  24440. /**
  24441. * A specialized version of `baseRest` which flattens the rest array.
  24442. *
  24443. * @private
  24444. * @param {Function} func The function to apply a rest parameter to.
  24445. * @returns {Function} Returns the new function.
  24446. */
  24447. function flatRest(func) {
  24448. return setToString(overRest(func, undefined, flatten), func + '');
  24449. }
  24450. /**
  24451. * Creates an array of own enumerable property names and symbols of `object`.
  24452. *
  24453. * @private
  24454. * @param {Object} object The object to query.
  24455. * @returns {Array} Returns the array of property names and symbols.
  24456. */
  24457. function getAllKeys(object) {
  24458. return baseGetAllKeys(object, keys, getSymbols);
  24459. }
  24460. /**
  24461. * Creates an array of own and inherited enumerable property names and
  24462. * symbols of `object`.
  24463. *
  24464. * @private
  24465. * @param {Object} object The object to query.
  24466. * @returns {Array} Returns the array of property names and symbols.
  24467. */
  24468. function getAllKeysIn(object) {
  24469. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24470. }
  24471. /**
  24472. * Gets metadata for `func`.
  24473. *
  24474. * @private
  24475. * @param {Function} func The function to query.
  24476. * @returns {*} Returns the metadata for `func`.
  24477. */
  24478. var getData = !metaMap ? noop : function(func) {
  24479. return metaMap.get(func);
  24480. };
  24481. /**
  24482. * Gets the name of `func`.
  24483. *
  24484. * @private
  24485. * @param {Function} func The function to query.
  24486. * @returns {string} Returns the function name.
  24487. */
  24488. function getFuncName(func) {
  24489. var result = (func.name + ''),
  24490. array = realNames[result],
  24491. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24492. while (length--) {
  24493. var data = array[length],
  24494. otherFunc = data.func;
  24495. if (otherFunc == null || otherFunc == func) {
  24496. return data.name;
  24497. }
  24498. }
  24499. return result;
  24500. }
  24501. /**
  24502. * Gets the argument placeholder value for `func`.
  24503. *
  24504. * @private
  24505. * @param {Function} func The function to inspect.
  24506. * @returns {*} Returns the placeholder value.
  24507. */
  24508. function getHolder(func) {
  24509. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24510. return object.placeholder;
  24511. }
  24512. /**
  24513. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24514. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24515. * If arguments are provided, the chosen function is invoked with them and
  24516. * its result is returned.
  24517. *
  24518. * @private
  24519. * @param {*} [value] The value to convert to an iteratee.
  24520. * @param {number} [arity] The arity of the created iteratee.
  24521. * @returns {Function} Returns the chosen function or its result.
  24522. */
  24523. function getIteratee() {
  24524. var result = lodash.iteratee || iteratee;
  24525. result = result === iteratee ? baseIteratee : result;
  24526. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24527. }
  24528. /**
  24529. * Gets the data for `map`.
  24530. *
  24531. * @private
  24532. * @param {Object} map The map to query.
  24533. * @param {string} key The reference key.
  24534. * @returns {*} Returns the map data.
  24535. */
  24536. function getMapData(map, key) {
  24537. var data = map.__data__;
  24538. return isKeyable(key)
  24539. ? data[typeof key == 'string' ? 'string' : 'hash']
  24540. : data.map;
  24541. }
  24542. /**
  24543. * Gets the property names, values, and compare flags of `object`.
  24544. *
  24545. * @private
  24546. * @param {Object} object The object to query.
  24547. * @returns {Array} Returns the match data of `object`.
  24548. */
  24549. function getMatchData(object) {
  24550. var result = keys(object),
  24551. length = result.length;
  24552. while (length--) {
  24553. var key = result[length],
  24554. value = object[key];
  24555. result[length] = [key, value, isStrictComparable(value)];
  24556. }
  24557. return result;
  24558. }
  24559. /**
  24560. * Gets the native function at `key` of `object`.
  24561. *
  24562. * @private
  24563. * @param {Object} object The object to query.
  24564. * @param {string} key The key of the method to get.
  24565. * @returns {*} Returns the function if it's native, else `undefined`.
  24566. */
  24567. function getNative(object, key) {
  24568. var value = getValue(object, key);
  24569. return baseIsNative(value) ? value : undefined;
  24570. }
  24571. /**
  24572. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24573. *
  24574. * @private
  24575. * @param {*} value The value to query.
  24576. * @returns {string} Returns the raw `toStringTag`.
  24577. */
  24578. function getRawTag(value) {
  24579. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24580. tag = value[symToStringTag];
  24581. try {
  24582. value[symToStringTag] = undefined;
  24583. var unmasked = true;
  24584. } catch (e) {}
  24585. var result = nativeObjectToString.call(value);
  24586. if (unmasked) {
  24587. if (isOwn) {
  24588. value[symToStringTag] = tag;
  24589. } else {
  24590. delete value[symToStringTag];
  24591. }
  24592. }
  24593. return result;
  24594. }
  24595. /**
  24596. * Creates an array of the own enumerable symbols of `object`.
  24597. *
  24598. * @private
  24599. * @param {Object} object The object to query.
  24600. * @returns {Array} Returns the array of symbols.
  24601. */
  24602. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24603. if (object == null) {
  24604. return [];
  24605. }
  24606. object = Object(object);
  24607. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24608. return propertyIsEnumerable.call(object, symbol);
  24609. });
  24610. };
  24611. /**
  24612. * Creates an array of the own and inherited enumerable symbols of `object`.
  24613. *
  24614. * @private
  24615. * @param {Object} object The object to query.
  24616. * @returns {Array} Returns the array of symbols.
  24617. */
  24618. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24619. var result = [];
  24620. while (object) {
  24621. arrayPush(result, getSymbols(object));
  24622. object = getPrototype(object);
  24623. }
  24624. return result;
  24625. };
  24626. /**
  24627. * Gets the `toStringTag` of `value`.
  24628. *
  24629. * @private
  24630. * @param {*} value The value to query.
  24631. * @returns {string} Returns the `toStringTag`.
  24632. */
  24633. var getTag = baseGetTag;
  24634. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24635. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24636. (Map && getTag(new Map) != mapTag) ||
  24637. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24638. (Set && getTag(new Set) != setTag) ||
  24639. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24640. getTag = function(value) {
  24641. var result = baseGetTag(value),
  24642. Ctor = result == objectTag ? value.constructor : undefined,
  24643. ctorString = Ctor ? toSource(Ctor) : '';
  24644. if (ctorString) {
  24645. switch (ctorString) {
  24646. case dataViewCtorString: return dataViewTag;
  24647. case mapCtorString: return mapTag;
  24648. case promiseCtorString: return promiseTag;
  24649. case setCtorString: return setTag;
  24650. case weakMapCtorString: return weakMapTag;
  24651. }
  24652. }
  24653. return result;
  24654. };
  24655. }
  24656. /**
  24657. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24658. *
  24659. * @private
  24660. * @param {number} start The start of the view.
  24661. * @param {number} end The end of the view.
  24662. * @param {Array} transforms The transformations to apply to the view.
  24663. * @returns {Object} Returns an object containing the `start` and `end`
  24664. * positions of the view.
  24665. */
  24666. function getView(start, end, transforms) {
  24667. var index = -1,
  24668. length = transforms.length;
  24669. while (++index < length) {
  24670. var data = transforms[index],
  24671. size = data.size;
  24672. switch (data.type) {
  24673. case 'drop': start += size; break;
  24674. case 'dropRight': end -= size; break;
  24675. case 'take': end = nativeMin(end, start + size); break;
  24676. case 'takeRight': start = nativeMax(start, end - size); break;
  24677. }
  24678. }
  24679. return { 'start': start, 'end': end };
  24680. }
  24681. /**
  24682. * Extracts wrapper details from the `source` body comment.
  24683. *
  24684. * @private
  24685. * @param {string} source The source to inspect.
  24686. * @returns {Array} Returns the wrapper details.
  24687. */
  24688. function getWrapDetails(source) {
  24689. var match = source.match(reWrapDetails);
  24690. return match ? match[1].split(reSplitDetails) : [];
  24691. }
  24692. /**
  24693. * Checks if `path` exists on `object`.
  24694. *
  24695. * @private
  24696. * @param {Object} object The object to query.
  24697. * @param {Array|string} path The path to check.
  24698. * @param {Function} hasFunc The function to check properties.
  24699. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24700. */
  24701. function hasPath(object, path, hasFunc) {
  24702. path = castPath(path, object);
  24703. var index = -1,
  24704. length = path.length,
  24705. result = false;
  24706. while (++index < length) {
  24707. var key = toKey(path[index]);
  24708. if (!(result = object != null && hasFunc(object, key))) {
  24709. break;
  24710. }
  24711. object = object[key];
  24712. }
  24713. if (result || ++index != length) {
  24714. return result;
  24715. }
  24716. length = object == null ? 0 : object.length;
  24717. return !!length && isLength(length) && isIndex(key, length) &&
  24718. (isArray(object) || isArguments(object));
  24719. }
  24720. /**
  24721. * Initializes an array clone.
  24722. *
  24723. * @private
  24724. * @param {Array} array The array to clone.
  24725. * @returns {Array} Returns the initialized clone.
  24726. */
  24727. function initCloneArray(array) {
  24728. var length = array.length,
  24729. result = new array.constructor(length);
  24730. // Add properties assigned by `RegExp#exec`.
  24731. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24732. result.index = array.index;
  24733. result.input = array.input;
  24734. }
  24735. return result;
  24736. }
  24737. /**
  24738. * Initializes an object clone.
  24739. *
  24740. * @private
  24741. * @param {Object} object The object to clone.
  24742. * @returns {Object} Returns the initialized clone.
  24743. */
  24744. function initCloneObject(object) {
  24745. return (typeof object.constructor == 'function' && !isPrototype(object))
  24746. ? baseCreate(getPrototype(object))
  24747. : {};
  24748. }
  24749. /**
  24750. * Initializes an object clone based on its `toStringTag`.
  24751. *
  24752. * **Note:** This function only supports cloning values with tags of
  24753. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24754. *
  24755. * @private
  24756. * @param {Object} object The object to clone.
  24757. * @param {string} tag The `toStringTag` of the object to clone.
  24758. * @param {boolean} [isDeep] Specify a deep clone.
  24759. * @returns {Object} Returns the initialized clone.
  24760. */
  24761. function initCloneByTag(object, tag, isDeep) {
  24762. var Ctor = object.constructor;
  24763. switch (tag) {
  24764. case arrayBufferTag:
  24765. return cloneArrayBuffer(object);
  24766. case boolTag:
  24767. case dateTag:
  24768. return new Ctor(+object);
  24769. case dataViewTag:
  24770. return cloneDataView(object, isDeep);
  24771. case float32Tag: case float64Tag:
  24772. case int8Tag: case int16Tag: case int32Tag:
  24773. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24774. return cloneTypedArray(object, isDeep);
  24775. case mapTag:
  24776. return new Ctor;
  24777. case numberTag:
  24778. case stringTag:
  24779. return new Ctor(object);
  24780. case regexpTag:
  24781. return cloneRegExp(object);
  24782. case setTag:
  24783. return new Ctor;
  24784. case symbolTag:
  24785. return cloneSymbol(object);
  24786. }
  24787. }
  24788. /**
  24789. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24790. *
  24791. * @private
  24792. * @param {string} source The source to modify.
  24793. * @returns {Array} details The details to insert.
  24794. * @returns {string} Returns the modified source.
  24795. */
  24796. function insertWrapDetails(source, details) {
  24797. var length = details.length;
  24798. if (!length) {
  24799. return source;
  24800. }
  24801. var lastIndex = length - 1;
  24802. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24803. details = details.join(length > 2 ? ', ' : ' ');
  24804. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24805. }
  24806. /**
  24807. * Checks if `value` is a flattenable `arguments` object or array.
  24808. *
  24809. * @private
  24810. * @param {*} value The value to check.
  24811. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24812. */
  24813. function isFlattenable(value) {
  24814. return isArray(value) || isArguments(value) ||
  24815. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24816. }
  24817. /**
  24818. * Checks if `value` is a valid array-like index.
  24819. *
  24820. * @private
  24821. * @param {*} value The value to check.
  24822. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24823. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24824. */
  24825. function isIndex(value, length) {
  24826. var type = typeof value;
  24827. length = length == null ? MAX_SAFE_INTEGER : length;
  24828. return !!length &&
  24829. (type == 'number' ||
  24830. (type != 'symbol' && reIsUint.test(value))) &&
  24831. (value > -1 && value % 1 == 0 && value < length);
  24832. }
  24833. /**
  24834. * Checks if the given arguments are from an iteratee call.
  24835. *
  24836. * @private
  24837. * @param {*} value The potential iteratee value argument.
  24838. * @param {*} index The potential iteratee index or key argument.
  24839. * @param {*} object The potential iteratee object argument.
  24840. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24841. * else `false`.
  24842. */
  24843. function isIterateeCall(value, index, object) {
  24844. if (!isObject(object)) {
  24845. return false;
  24846. }
  24847. var type = typeof index;
  24848. if (type == 'number'
  24849. ? (isArrayLike(object) && isIndex(index, object.length))
  24850. : (type == 'string' && index in object)
  24851. ) {
  24852. return eq(object[index], value);
  24853. }
  24854. return false;
  24855. }
  24856. /**
  24857. * Checks if `value` is a property name and not a property path.
  24858. *
  24859. * @private
  24860. * @param {*} value The value to check.
  24861. * @param {Object} [object] The object to query keys on.
  24862. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24863. */
  24864. function isKey(value, object) {
  24865. if (isArray(value)) {
  24866. return false;
  24867. }
  24868. var type = typeof value;
  24869. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24870. value == null || isSymbol(value)) {
  24871. return true;
  24872. }
  24873. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24874. (object != null && value in Object(object));
  24875. }
  24876. /**
  24877. * Checks if `value` is suitable for use as unique object key.
  24878. *
  24879. * @private
  24880. * @param {*} value The value to check.
  24881. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24882. */
  24883. function isKeyable(value) {
  24884. var type = typeof value;
  24885. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24886. ? (value !== '__proto__')
  24887. : (value === null);
  24888. }
  24889. /**
  24890. * Checks if `func` has a lazy counterpart.
  24891. *
  24892. * @private
  24893. * @param {Function} func The function to check.
  24894. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24895. * else `false`.
  24896. */
  24897. function isLaziable(func) {
  24898. var funcName = getFuncName(func),
  24899. other = lodash[funcName];
  24900. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24901. return false;
  24902. }
  24903. if (func === other) {
  24904. return true;
  24905. }
  24906. var data = getData(other);
  24907. return !!data && func === data[0];
  24908. }
  24909. /**
  24910. * Checks if `func` has its source masked.
  24911. *
  24912. * @private
  24913. * @param {Function} func The function to check.
  24914. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24915. */
  24916. function isMasked(func) {
  24917. return !!maskSrcKey && (maskSrcKey in func);
  24918. }
  24919. /**
  24920. * Checks if `func` is capable of being masked.
  24921. *
  24922. * @private
  24923. * @param {*} value The value to check.
  24924. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24925. */
  24926. var isMaskable = coreJsData ? isFunction : stubFalse;
  24927. /**
  24928. * Checks if `value` is likely a prototype object.
  24929. *
  24930. * @private
  24931. * @param {*} value The value to check.
  24932. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24933. */
  24934. function isPrototype(value) {
  24935. var Ctor = value && value.constructor,
  24936. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24937. return value === proto;
  24938. }
  24939. /**
  24940. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24941. *
  24942. * @private
  24943. * @param {*} value The value to check.
  24944. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24945. * equality comparisons, else `false`.
  24946. */
  24947. function isStrictComparable(value) {
  24948. return value === value && !isObject(value);
  24949. }
  24950. /**
  24951. * A specialized version of `matchesProperty` for source values suitable
  24952. * for strict equality comparisons, i.e. `===`.
  24953. *
  24954. * @private
  24955. * @param {string} key The key of the property to get.
  24956. * @param {*} srcValue The value to match.
  24957. * @returns {Function} Returns the new spec function.
  24958. */
  24959. function matchesStrictComparable(key, srcValue) {
  24960. return function(object) {
  24961. if (object == null) {
  24962. return false;
  24963. }
  24964. return object[key] === srcValue &&
  24965. (srcValue !== undefined || (key in Object(object)));
  24966. };
  24967. }
  24968. /**
  24969. * A specialized version of `_.memoize` which clears the memoized function's
  24970. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24971. *
  24972. * @private
  24973. * @param {Function} func The function to have its output memoized.
  24974. * @returns {Function} Returns the new memoized function.
  24975. */
  24976. function memoizeCapped(func) {
  24977. var result = memoize(func, function(key) {
  24978. if (cache.size === MAX_MEMOIZE_SIZE) {
  24979. cache.clear();
  24980. }
  24981. return key;
  24982. });
  24983. var cache = result.cache;
  24984. return result;
  24985. }
  24986. /**
  24987. * Merges the function metadata of `source` into `data`.
  24988. *
  24989. * Merging metadata reduces the number of wrappers used to invoke a function.
  24990. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24991. * may be applied regardless of execution order. Methods like `_.ary` and
  24992. * `_.rearg` modify function arguments, making the order in which they are
  24993. * executed important, preventing the merging of metadata. However, we make
  24994. * an exception for a safe combined case where curried functions have `_.ary`
  24995. * and or `_.rearg` applied.
  24996. *
  24997. * @private
  24998. * @param {Array} data The destination metadata.
  24999. * @param {Array} source The source metadata.
  25000. * @returns {Array} Returns `data`.
  25001. */
  25002. function mergeData(data, source) {
  25003. var bitmask = data[1],
  25004. srcBitmask = source[1],
  25005. newBitmask = bitmask | srcBitmask,
  25006. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25007. var isCombo =
  25008. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25009. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25010. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25011. // Exit early if metadata can't be merged.
  25012. if (!(isCommon || isCombo)) {
  25013. return data;
  25014. }
  25015. // Use source `thisArg` if available.
  25016. if (srcBitmask & WRAP_BIND_FLAG) {
  25017. data[2] = source[2];
  25018. // Set when currying a bound function.
  25019. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25020. }
  25021. // Compose partial arguments.
  25022. var value = source[3];
  25023. if (value) {
  25024. var partials = data[3];
  25025. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25026. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25027. }
  25028. // Compose partial right arguments.
  25029. value = source[5];
  25030. if (value) {
  25031. partials = data[5];
  25032. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25033. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25034. }
  25035. // Use source `argPos` if available.
  25036. value = source[7];
  25037. if (value) {
  25038. data[7] = value;
  25039. }
  25040. // Use source `ary` if it's smaller.
  25041. if (srcBitmask & WRAP_ARY_FLAG) {
  25042. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25043. }
  25044. // Use source `arity` if one is not provided.
  25045. if (data[9] == null) {
  25046. data[9] = source[9];
  25047. }
  25048. // Use source `func` and merge bitmasks.
  25049. data[0] = source[0];
  25050. data[1] = newBitmask;
  25051. return data;
  25052. }
  25053. /**
  25054. * This function is like
  25055. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25056. * except that it includes inherited enumerable properties.
  25057. *
  25058. * @private
  25059. * @param {Object} object The object to query.
  25060. * @returns {Array} Returns the array of property names.
  25061. */
  25062. function nativeKeysIn(object) {
  25063. var result = [];
  25064. if (object != null) {
  25065. for (var key in Object(object)) {
  25066. result.push(key);
  25067. }
  25068. }
  25069. return result;
  25070. }
  25071. /**
  25072. * Converts `value` to a string using `Object.prototype.toString`.
  25073. *
  25074. * @private
  25075. * @param {*} value The value to convert.
  25076. * @returns {string} Returns the converted string.
  25077. */
  25078. function objectToString(value) {
  25079. return nativeObjectToString.call(value);
  25080. }
  25081. /**
  25082. * A specialized version of `baseRest` which transforms the rest array.
  25083. *
  25084. * @private
  25085. * @param {Function} func The function to apply a rest parameter to.
  25086. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25087. * @param {Function} transform The rest array transform.
  25088. * @returns {Function} Returns the new function.
  25089. */
  25090. function overRest(func, start, transform) {
  25091. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25092. return function() {
  25093. var args = arguments,
  25094. index = -1,
  25095. length = nativeMax(args.length - start, 0),
  25096. array = Array(length);
  25097. while (++index < length) {
  25098. array[index] = args[start + index];
  25099. }
  25100. index = -1;
  25101. var otherArgs = Array(start + 1);
  25102. while (++index < start) {
  25103. otherArgs[index] = args[index];
  25104. }
  25105. otherArgs[start] = transform(array);
  25106. return apply(func, this, otherArgs);
  25107. };
  25108. }
  25109. /**
  25110. * Gets the parent value at `path` of `object`.
  25111. *
  25112. * @private
  25113. * @param {Object} object The object to query.
  25114. * @param {Array} path The path to get the parent value of.
  25115. * @returns {*} Returns the parent value.
  25116. */
  25117. function parent(object, path) {
  25118. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25119. }
  25120. /**
  25121. * Reorder `array` according to the specified indexes where the element at
  25122. * the first index is assigned as the first element, the element at
  25123. * the second index is assigned as the second element, and so on.
  25124. *
  25125. * @private
  25126. * @param {Array} array The array to reorder.
  25127. * @param {Array} indexes The arranged array indexes.
  25128. * @returns {Array} Returns `array`.
  25129. */
  25130. function reorder(array, indexes) {
  25131. var arrLength = array.length,
  25132. length = nativeMin(indexes.length, arrLength),
  25133. oldArray = copyArray(array);
  25134. while (length--) {
  25135. var index = indexes[length];
  25136. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25137. }
  25138. return array;
  25139. }
  25140. /**
  25141. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25142. *
  25143. * @private
  25144. * @param {Object} object The object to query.
  25145. * @param {string} key The key of the property to get.
  25146. * @returns {*} Returns the property value.
  25147. */
  25148. function safeGet(object, key) {
  25149. if (key === 'constructor' && typeof object[key] === 'function') {
  25150. return;
  25151. }
  25152. if (key == '__proto__') {
  25153. return;
  25154. }
  25155. return object[key];
  25156. }
  25157. /**
  25158. * Sets metadata for `func`.
  25159. *
  25160. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25161. * period of time, it will trip its breaker and transition to an identity
  25162. * function to avoid garbage collection pauses in V8. See
  25163. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25164. * for more details.
  25165. *
  25166. * @private
  25167. * @param {Function} func The function to associate metadata with.
  25168. * @param {*} data The metadata.
  25169. * @returns {Function} Returns `func`.
  25170. */
  25171. var setData = shortOut(baseSetData);
  25172. /**
  25173. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25174. *
  25175. * @private
  25176. * @param {Function} func The function to delay.
  25177. * @param {number} wait The number of milliseconds to delay invocation.
  25178. * @returns {number|Object} Returns the timer id or timeout object.
  25179. */
  25180. var setTimeout = ctxSetTimeout || function(func, wait) {
  25181. return root.setTimeout(func, wait);
  25182. };
  25183. /**
  25184. * Sets the `toString` method of `func` to return `string`.
  25185. *
  25186. * @private
  25187. * @param {Function} func The function to modify.
  25188. * @param {Function} string The `toString` result.
  25189. * @returns {Function} Returns `func`.
  25190. */
  25191. var setToString = shortOut(baseSetToString);
  25192. /**
  25193. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25194. * with wrapper details in a comment at the top of the source body.
  25195. *
  25196. * @private
  25197. * @param {Function} wrapper The function to modify.
  25198. * @param {Function} reference The reference function.
  25199. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25200. * @returns {Function} Returns `wrapper`.
  25201. */
  25202. function setWrapToString(wrapper, reference, bitmask) {
  25203. var source = (reference + '');
  25204. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25205. }
  25206. /**
  25207. * Creates a function that'll short out and invoke `identity` instead
  25208. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25209. * milliseconds.
  25210. *
  25211. * @private
  25212. * @param {Function} func The function to restrict.
  25213. * @returns {Function} Returns the new shortable function.
  25214. */
  25215. function shortOut(func) {
  25216. var count = 0,
  25217. lastCalled = 0;
  25218. return function() {
  25219. var stamp = nativeNow(),
  25220. remaining = HOT_SPAN - (stamp - lastCalled);
  25221. lastCalled = stamp;
  25222. if (remaining > 0) {
  25223. if (++count >= HOT_COUNT) {
  25224. return arguments[0];
  25225. }
  25226. } else {
  25227. count = 0;
  25228. }
  25229. return func.apply(undefined, arguments);
  25230. };
  25231. }
  25232. /**
  25233. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25234. *
  25235. * @private
  25236. * @param {Array} array The array to shuffle.
  25237. * @param {number} [size=array.length] The size of `array`.
  25238. * @returns {Array} Returns `array`.
  25239. */
  25240. function shuffleSelf(array, size) {
  25241. var index = -1,
  25242. length = array.length,
  25243. lastIndex = length - 1;
  25244. size = size === undefined ? length : size;
  25245. while (++index < size) {
  25246. var rand = baseRandom(index, lastIndex),
  25247. value = array[rand];
  25248. array[rand] = array[index];
  25249. array[index] = value;
  25250. }
  25251. array.length = size;
  25252. return array;
  25253. }
  25254. /**
  25255. * Converts `string` to a property path array.
  25256. *
  25257. * @private
  25258. * @param {string} string The string to convert.
  25259. * @returns {Array} Returns the property path array.
  25260. */
  25261. var stringToPath = memoizeCapped(function(string) {
  25262. var result = [];
  25263. if (string.charCodeAt(0) === 46 /* . */) {
  25264. result.push('');
  25265. }
  25266. string.replace(rePropName, function(match, number, quote, subString) {
  25267. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25268. });
  25269. return result;
  25270. });
  25271. /**
  25272. * Converts `value` to a string key if it's not a string or symbol.
  25273. *
  25274. * @private
  25275. * @param {*} value The value to inspect.
  25276. * @returns {string|symbol} Returns the key.
  25277. */
  25278. function toKey(value) {
  25279. if (typeof value == 'string' || isSymbol(value)) {
  25280. return value;
  25281. }
  25282. var result = (value + '');
  25283. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25284. }
  25285. /**
  25286. * Converts `func` to its source code.
  25287. *
  25288. * @private
  25289. * @param {Function} func The function to convert.
  25290. * @returns {string} Returns the source code.
  25291. */
  25292. function toSource(func) {
  25293. if (func != null) {
  25294. try {
  25295. return funcToString.call(func);
  25296. } catch (e) {}
  25297. try {
  25298. return (func + '');
  25299. } catch (e) {}
  25300. }
  25301. return '';
  25302. }
  25303. /**
  25304. * Updates wrapper `details` based on `bitmask` flags.
  25305. *
  25306. * @private
  25307. * @returns {Array} details The details to modify.
  25308. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25309. * @returns {Array} Returns `details`.
  25310. */
  25311. function updateWrapDetails(details, bitmask) {
  25312. arrayEach(wrapFlags, function(pair) {
  25313. var value = '_.' + pair[0];
  25314. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25315. details.push(value);
  25316. }
  25317. });
  25318. return details.sort();
  25319. }
  25320. /**
  25321. * Creates a clone of `wrapper`.
  25322. *
  25323. * @private
  25324. * @param {Object} wrapper The wrapper to clone.
  25325. * @returns {Object} Returns the cloned wrapper.
  25326. */
  25327. function wrapperClone(wrapper) {
  25328. if (wrapper instanceof LazyWrapper) {
  25329. return wrapper.clone();
  25330. }
  25331. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25332. result.__actions__ = copyArray(wrapper.__actions__);
  25333. result.__index__ = wrapper.__index__;
  25334. result.__values__ = wrapper.__values__;
  25335. return result;
  25336. }
  25337. /*------------------------------------------------------------------------*/
  25338. /**
  25339. * Creates an array of elements split into groups the length of `size`.
  25340. * If `array` can't be split evenly, the final chunk will be the remaining
  25341. * elements.
  25342. *
  25343. * @static
  25344. * @memberOf _
  25345. * @since 3.0.0
  25346. * @category Array
  25347. * @param {Array} array The array to process.
  25348. * @param {number} [size=1] The length of each chunk
  25349. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25350. * @returns {Array} Returns the new array of chunks.
  25351. * @example
  25352. *
  25353. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25354. * // => [['a', 'b'], ['c', 'd']]
  25355. *
  25356. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25357. * // => [['a', 'b', 'c'], ['d']]
  25358. */
  25359. function chunk(array, size, guard) {
  25360. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25361. size = 1;
  25362. } else {
  25363. size = nativeMax(toInteger(size), 0);
  25364. }
  25365. var length = array == null ? 0 : array.length;
  25366. if (!length || size < 1) {
  25367. return [];
  25368. }
  25369. var index = 0,
  25370. resIndex = 0,
  25371. result = Array(nativeCeil(length / size));
  25372. while (index < length) {
  25373. result[resIndex++] = baseSlice(array, index, (index += size));
  25374. }
  25375. return result;
  25376. }
  25377. /**
  25378. * Creates an array with all falsey values removed. The values `false`, `null`,
  25379. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25380. *
  25381. * @static
  25382. * @memberOf _
  25383. * @since 0.1.0
  25384. * @category Array
  25385. * @param {Array} array The array to compact.
  25386. * @returns {Array} Returns the new array of filtered values.
  25387. * @example
  25388. *
  25389. * _.compact([0, 1, false, 2, '', 3]);
  25390. * // => [1, 2, 3]
  25391. */
  25392. function compact(array) {
  25393. var index = -1,
  25394. length = array == null ? 0 : array.length,
  25395. resIndex = 0,
  25396. result = [];
  25397. while (++index < length) {
  25398. var value = array[index];
  25399. if (value) {
  25400. result[resIndex++] = value;
  25401. }
  25402. }
  25403. return result;
  25404. }
  25405. /**
  25406. * Creates a new array concatenating `array` with any additional arrays
  25407. * and/or values.
  25408. *
  25409. * @static
  25410. * @memberOf _
  25411. * @since 4.0.0
  25412. * @category Array
  25413. * @param {Array} array The array to concatenate.
  25414. * @param {...*} [values] The values to concatenate.
  25415. * @returns {Array} Returns the new concatenated array.
  25416. * @example
  25417. *
  25418. * var array = [1];
  25419. * var other = _.concat(array, 2, [3], [[4]]);
  25420. *
  25421. * console.log(other);
  25422. * // => [1, 2, 3, [4]]
  25423. *
  25424. * console.log(array);
  25425. * // => [1]
  25426. */
  25427. function concat() {
  25428. var length = arguments.length;
  25429. if (!length) {
  25430. return [];
  25431. }
  25432. var args = Array(length - 1),
  25433. array = arguments[0],
  25434. index = length;
  25435. while (index--) {
  25436. args[index - 1] = arguments[index];
  25437. }
  25438. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25439. }
  25440. /**
  25441. * Creates an array of `array` values not included in the other given arrays
  25442. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25443. * for equality comparisons. The order and references of result values are
  25444. * determined by the first array.
  25445. *
  25446. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25447. *
  25448. * @static
  25449. * @memberOf _
  25450. * @since 0.1.0
  25451. * @category Array
  25452. * @param {Array} array The array to inspect.
  25453. * @param {...Array} [values] The values to exclude.
  25454. * @returns {Array} Returns the new array of filtered values.
  25455. * @see _.without, _.xor
  25456. * @example
  25457. *
  25458. * _.difference([2, 1], [2, 3]);
  25459. * // => [1]
  25460. */
  25461. var difference = baseRest(function(array, values) {
  25462. return isArrayLikeObject(array)
  25463. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25464. : [];
  25465. });
  25466. /**
  25467. * This method is like `_.difference` except that it accepts `iteratee` which
  25468. * is invoked for each element of `array` and `values` to generate the criterion
  25469. * by which they're compared. The order and references of result values are
  25470. * determined by the first array. The iteratee is invoked with one argument:
  25471. * (value).
  25472. *
  25473. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25474. *
  25475. * @static
  25476. * @memberOf _
  25477. * @since 4.0.0
  25478. * @category Array
  25479. * @param {Array} array The array to inspect.
  25480. * @param {...Array} [values] The values to exclude.
  25481. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25482. * @returns {Array} Returns the new array of filtered values.
  25483. * @example
  25484. *
  25485. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25486. * // => [1.2]
  25487. *
  25488. * // The `_.property` iteratee shorthand.
  25489. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25490. * // => [{ 'x': 2 }]
  25491. */
  25492. var differenceBy = baseRest(function(array, values) {
  25493. var iteratee = last(values);
  25494. if (isArrayLikeObject(iteratee)) {
  25495. iteratee = undefined;
  25496. }
  25497. return isArrayLikeObject(array)
  25498. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25499. : [];
  25500. });
  25501. /**
  25502. * This method is like `_.difference` except that it accepts `comparator`
  25503. * which is invoked to compare elements of `array` to `values`. The order and
  25504. * references of result values are determined by the first array. The comparator
  25505. * is invoked with two arguments: (arrVal, othVal).
  25506. *
  25507. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25508. *
  25509. * @static
  25510. * @memberOf _
  25511. * @since 4.0.0
  25512. * @category Array
  25513. * @param {Array} array The array to inspect.
  25514. * @param {...Array} [values] The values to exclude.
  25515. * @param {Function} [comparator] The comparator invoked per element.
  25516. * @returns {Array} Returns the new array of filtered values.
  25517. * @example
  25518. *
  25519. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25520. *
  25521. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25522. * // => [{ 'x': 2, 'y': 1 }]
  25523. */
  25524. var differenceWith = baseRest(function(array, values) {
  25525. var comparator = last(values);
  25526. if (isArrayLikeObject(comparator)) {
  25527. comparator = undefined;
  25528. }
  25529. return isArrayLikeObject(array)
  25530. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25531. : [];
  25532. });
  25533. /**
  25534. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25535. *
  25536. * @static
  25537. * @memberOf _
  25538. * @since 0.5.0
  25539. * @category Array
  25540. * @param {Array} array The array to query.
  25541. * @param {number} [n=1] The number of elements to drop.
  25542. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25543. * @returns {Array} Returns the slice of `array`.
  25544. * @example
  25545. *
  25546. * _.drop([1, 2, 3]);
  25547. * // => [2, 3]
  25548. *
  25549. * _.drop([1, 2, 3], 2);
  25550. * // => [3]
  25551. *
  25552. * _.drop([1, 2, 3], 5);
  25553. * // => []
  25554. *
  25555. * _.drop([1, 2, 3], 0);
  25556. * // => [1, 2, 3]
  25557. */
  25558. function drop(array, n, guard) {
  25559. var length = array == null ? 0 : array.length;
  25560. if (!length) {
  25561. return [];
  25562. }
  25563. n = (guard || n === undefined) ? 1 : toInteger(n);
  25564. return baseSlice(array, n < 0 ? 0 : n, length);
  25565. }
  25566. /**
  25567. * Creates a slice of `array` with `n` elements dropped from the end.
  25568. *
  25569. * @static
  25570. * @memberOf _
  25571. * @since 3.0.0
  25572. * @category Array
  25573. * @param {Array} array The array to query.
  25574. * @param {number} [n=1] The number of elements to drop.
  25575. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25576. * @returns {Array} Returns the slice of `array`.
  25577. * @example
  25578. *
  25579. * _.dropRight([1, 2, 3]);
  25580. * // => [1, 2]
  25581. *
  25582. * _.dropRight([1, 2, 3], 2);
  25583. * // => [1]
  25584. *
  25585. * _.dropRight([1, 2, 3], 5);
  25586. * // => []
  25587. *
  25588. * _.dropRight([1, 2, 3], 0);
  25589. * // => [1, 2, 3]
  25590. */
  25591. function dropRight(array, n, guard) {
  25592. var length = array == null ? 0 : array.length;
  25593. if (!length) {
  25594. return [];
  25595. }
  25596. n = (guard || n === undefined) ? 1 : toInteger(n);
  25597. n = length - n;
  25598. return baseSlice(array, 0, n < 0 ? 0 : n);
  25599. }
  25600. /**
  25601. * Creates a slice of `array` excluding elements dropped from the end.
  25602. * Elements are dropped until `predicate` returns falsey. The predicate is
  25603. * invoked with three arguments: (value, index, array).
  25604. *
  25605. * @static
  25606. * @memberOf _
  25607. * @since 3.0.0
  25608. * @category Array
  25609. * @param {Array} array The array to query.
  25610. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25611. * @returns {Array} Returns the slice of `array`.
  25612. * @example
  25613. *
  25614. * var users = [
  25615. * { 'user': 'barney', 'active': true },
  25616. * { 'user': 'fred', 'active': false },
  25617. * { 'user': 'pebbles', 'active': false }
  25618. * ];
  25619. *
  25620. * _.dropRightWhile(users, function(o) { return !o.active; });
  25621. * // => objects for ['barney']
  25622. *
  25623. * // The `_.matches` iteratee shorthand.
  25624. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25625. * // => objects for ['barney', 'fred']
  25626. *
  25627. * // The `_.matchesProperty` iteratee shorthand.
  25628. * _.dropRightWhile(users, ['active', false]);
  25629. * // => objects for ['barney']
  25630. *
  25631. * // The `_.property` iteratee shorthand.
  25632. * _.dropRightWhile(users, 'active');
  25633. * // => objects for ['barney', 'fred', 'pebbles']
  25634. */
  25635. function dropRightWhile(array, predicate) {
  25636. return (array && array.length)
  25637. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25638. : [];
  25639. }
  25640. /**
  25641. * Creates a slice of `array` excluding elements dropped from the beginning.
  25642. * Elements are dropped until `predicate` returns falsey. The predicate is
  25643. * invoked with three arguments: (value, index, array).
  25644. *
  25645. * @static
  25646. * @memberOf _
  25647. * @since 3.0.0
  25648. * @category Array
  25649. * @param {Array} array The array to query.
  25650. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25651. * @returns {Array} Returns the slice of `array`.
  25652. * @example
  25653. *
  25654. * var users = [
  25655. * { 'user': 'barney', 'active': false },
  25656. * { 'user': 'fred', 'active': false },
  25657. * { 'user': 'pebbles', 'active': true }
  25658. * ];
  25659. *
  25660. * _.dropWhile(users, function(o) { return !o.active; });
  25661. * // => objects for ['pebbles']
  25662. *
  25663. * // The `_.matches` iteratee shorthand.
  25664. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25665. * // => objects for ['fred', 'pebbles']
  25666. *
  25667. * // The `_.matchesProperty` iteratee shorthand.
  25668. * _.dropWhile(users, ['active', false]);
  25669. * // => objects for ['pebbles']
  25670. *
  25671. * // The `_.property` iteratee shorthand.
  25672. * _.dropWhile(users, 'active');
  25673. * // => objects for ['barney', 'fred', 'pebbles']
  25674. */
  25675. function dropWhile(array, predicate) {
  25676. return (array && array.length)
  25677. ? baseWhile(array, getIteratee(predicate, 3), true)
  25678. : [];
  25679. }
  25680. /**
  25681. * Fills elements of `array` with `value` from `start` up to, but not
  25682. * including, `end`.
  25683. *
  25684. * **Note:** This method mutates `array`.
  25685. *
  25686. * @static
  25687. * @memberOf _
  25688. * @since 3.2.0
  25689. * @category Array
  25690. * @param {Array} array The array to fill.
  25691. * @param {*} value The value to fill `array` with.
  25692. * @param {number} [start=0] The start position.
  25693. * @param {number} [end=array.length] The end position.
  25694. * @returns {Array} Returns `array`.
  25695. * @example
  25696. *
  25697. * var array = [1, 2, 3];
  25698. *
  25699. * _.fill(array, 'a');
  25700. * console.log(array);
  25701. * // => ['a', 'a', 'a']
  25702. *
  25703. * _.fill(Array(3), 2);
  25704. * // => [2, 2, 2]
  25705. *
  25706. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25707. * // => [4, '*', '*', 10]
  25708. */
  25709. function fill(array, value, start, end) {
  25710. var length = array == null ? 0 : array.length;
  25711. if (!length) {
  25712. return [];
  25713. }
  25714. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25715. start = 0;
  25716. end = length;
  25717. }
  25718. return baseFill(array, value, start, end);
  25719. }
  25720. /**
  25721. * This method is like `_.find` except that it returns the index of the first
  25722. * element `predicate` returns truthy for instead of the element itself.
  25723. *
  25724. * @static
  25725. * @memberOf _
  25726. * @since 1.1.0
  25727. * @category Array
  25728. * @param {Array} array The array to inspect.
  25729. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25730. * @param {number} [fromIndex=0] The index to search from.
  25731. * @returns {number} Returns the index of the found element, else `-1`.
  25732. * @example
  25733. *
  25734. * var users = [
  25735. * { 'user': 'barney', 'active': false },
  25736. * { 'user': 'fred', 'active': false },
  25737. * { 'user': 'pebbles', 'active': true }
  25738. * ];
  25739. *
  25740. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25741. * // => 0
  25742. *
  25743. * // The `_.matches` iteratee shorthand.
  25744. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25745. * // => 1
  25746. *
  25747. * // The `_.matchesProperty` iteratee shorthand.
  25748. * _.findIndex(users, ['active', false]);
  25749. * // => 0
  25750. *
  25751. * // The `_.property` iteratee shorthand.
  25752. * _.findIndex(users, 'active');
  25753. * // => 2
  25754. */
  25755. function findIndex(array, predicate, fromIndex) {
  25756. var length = array == null ? 0 : array.length;
  25757. if (!length) {
  25758. return -1;
  25759. }
  25760. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25761. if (index < 0) {
  25762. index = nativeMax(length + index, 0);
  25763. }
  25764. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25765. }
  25766. /**
  25767. * This method is like `_.findIndex` except that it iterates over elements
  25768. * of `collection` from right to left.
  25769. *
  25770. * @static
  25771. * @memberOf _
  25772. * @since 2.0.0
  25773. * @category Array
  25774. * @param {Array} array The array to inspect.
  25775. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25776. * @param {number} [fromIndex=array.length-1] The index to search from.
  25777. * @returns {number} Returns the index of the found element, else `-1`.
  25778. * @example
  25779. *
  25780. * var users = [
  25781. * { 'user': 'barney', 'active': true },
  25782. * { 'user': 'fred', 'active': false },
  25783. * { 'user': 'pebbles', 'active': false }
  25784. * ];
  25785. *
  25786. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25787. * // => 2
  25788. *
  25789. * // The `_.matches` iteratee shorthand.
  25790. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25791. * // => 0
  25792. *
  25793. * // The `_.matchesProperty` iteratee shorthand.
  25794. * _.findLastIndex(users, ['active', false]);
  25795. * // => 2
  25796. *
  25797. * // The `_.property` iteratee shorthand.
  25798. * _.findLastIndex(users, 'active');
  25799. * // => 0
  25800. */
  25801. function findLastIndex(array, predicate, fromIndex) {
  25802. var length = array == null ? 0 : array.length;
  25803. if (!length) {
  25804. return -1;
  25805. }
  25806. var index = length - 1;
  25807. if (fromIndex !== undefined) {
  25808. index = toInteger(fromIndex);
  25809. index = fromIndex < 0
  25810. ? nativeMax(length + index, 0)
  25811. : nativeMin(index, length - 1);
  25812. }
  25813. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25814. }
  25815. /**
  25816. * Flattens `array` a single level deep.
  25817. *
  25818. * @static
  25819. * @memberOf _
  25820. * @since 0.1.0
  25821. * @category Array
  25822. * @param {Array} array The array to flatten.
  25823. * @returns {Array} Returns the new flattened array.
  25824. * @example
  25825. *
  25826. * _.flatten([1, [2, [3, [4]], 5]]);
  25827. * // => [1, 2, [3, [4]], 5]
  25828. */
  25829. function flatten(array) {
  25830. var length = array == null ? 0 : array.length;
  25831. return length ? baseFlatten(array, 1) : [];
  25832. }
  25833. /**
  25834. * Recursively flattens `array`.
  25835. *
  25836. * @static
  25837. * @memberOf _
  25838. * @since 3.0.0
  25839. * @category Array
  25840. * @param {Array} array The array to flatten.
  25841. * @returns {Array} Returns the new flattened array.
  25842. * @example
  25843. *
  25844. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25845. * // => [1, 2, 3, 4, 5]
  25846. */
  25847. function flattenDeep(array) {
  25848. var length = array == null ? 0 : array.length;
  25849. return length ? baseFlatten(array, INFINITY) : [];
  25850. }
  25851. /**
  25852. * Recursively flatten `array` up to `depth` times.
  25853. *
  25854. * @static
  25855. * @memberOf _
  25856. * @since 4.4.0
  25857. * @category Array
  25858. * @param {Array} array The array to flatten.
  25859. * @param {number} [depth=1] The maximum recursion depth.
  25860. * @returns {Array} Returns the new flattened array.
  25861. * @example
  25862. *
  25863. * var array = [1, [2, [3, [4]], 5]];
  25864. *
  25865. * _.flattenDepth(array, 1);
  25866. * // => [1, 2, [3, [4]], 5]
  25867. *
  25868. * _.flattenDepth(array, 2);
  25869. * // => [1, 2, 3, [4], 5]
  25870. */
  25871. function flattenDepth(array, depth) {
  25872. var length = array == null ? 0 : array.length;
  25873. if (!length) {
  25874. return [];
  25875. }
  25876. depth = depth === undefined ? 1 : toInteger(depth);
  25877. return baseFlatten(array, depth);
  25878. }
  25879. /**
  25880. * The inverse of `_.toPairs`; this method returns an object composed
  25881. * from key-value `pairs`.
  25882. *
  25883. * @static
  25884. * @memberOf _
  25885. * @since 4.0.0
  25886. * @category Array
  25887. * @param {Array} pairs The key-value pairs.
  25888. * @returns {Object} Returns the new object.
  25889. * @example
  25890. *
  25891. * _.fromPairs([['a', 1], ['b', 2]]);
  25892. * // => { 'a': 1, 'b': 2 }
  25893. */
  25894. function fromPairs(pairs) {
  25895. var index = -1,
  25896. length = pairs == null ? 0 : pairs.length,
  25897. result = {};
  25898. while (++index < length) {
  25899. var pair = pairs[index];
  25900. result[pair[0]] = pair[1];
  25901. }
  25902. return result;
  25903. }
  25904. /**
  25905. * Gets the first element of `array`.
  25906. *
  25907. * @static
  25908. * @memberOf _
  25909. * @since 0.1.0
  25910. * @alias first
  25911. * @category Array
  25912. * @param {Array} array The array to query.
  25913. * @returns {*} Returns the first element of `array`.
  25914. * @example
  25915. *
  25916. * _.head([1, 2, 3]);
  25917. * // => 1
  25918. *
  25919. * _.head([]);
  25920. * // => undefined
  25921. */
  25922. function head(array) {
  25923. return (array && array.length) ? array[0] : undefined;
  25924. }
  25925. /**
  25926. * Gets the index at which the first occurrence of `value` is found in `array`
  25927. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25928. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25929. * offset from the end of `array`.
  25930. *
  25931. * @static
  25932. * @memberOf _
  25933. * @since 0.1.0
  25934. * @category Array
  25935. * @param {Array} array The array to inspect.
  25936. * @param {*} value The value to search for.
  25937. * @param {number} [fromIndex=0] The index to search from.
  25938. * @returns {number} Returns the index of the matched value, else `-1`.
  25939. * @example
  25940. *
  25941. * _.indexOf([1, 2, 1, 2], 2);
  25942. * // => 1
  25943. *
  25944. * // Search from the `fromIndex`.
  25945. * _.indexOf([1, 2, 1, 2], 2, 2);
  25946. * // => 3
  25947. */
  25948. function indexOf(array, value, fromIndex) {
  25949. var length = array == null ? 0 : array.length;
  25950. if (!length) {
  25951. return -1;
  25952. }
  25953. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25954. if (index < 0) {
  25955. index = nativeMax(length + index, 0);
  25956. }
  25957. return baseIndexOf(array, value, index);
  25958. }
  25959. /**
  25960. * Gets all but the last element of `array`.
  25961. *
  25962. * @static
  25963. * @memberOf _
  25964. * @since 0.1.0
  25965. * @category Array
  25966. * @param {Array} array The array to query.
  25967. * @returns {Array} Returns the slice of `array`.
  25968. * @example
  25969. *
  25970. * _.initial([1, 2, 3]);
  25971. * // => [1, 2]
  25972. */
  25973. function initial(array) {
  25974. var length = array == null ? 0 : array.length;
  25975. return length ? baseSlice(array, 0, -1) : [];
  25976. }
  25977. /**
  25978. * Creates an array of unique values that are included in all given arrays
  25979. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25980. * for equality comparisons. The order and references of result values are
  25981. * determined by the first array.
  25982. *
  25983. * @static
  25984. * @memberOf _
  25985. * @since 0.1.0
  25986. * @category Array
  25987. * @param {...Array} [arrays] The arrays to inspect.
  25988. * @returns {Array} Returns the new array of intersecting values.
  25989. * @example
  25990. *
  25991. * _.intersection([2, 1], [2, 3]);
  25992. * // => [2]
  25993. */
  25994. var intersection = baseRest(function(arrays) {
  25995. var mapped = arrayMap(arrays, castArrayLikeObject);
  25996. return (mapped.length && mapped[0] === arrays[0])
  25997. ? baseIntersection(mapped)
  25998. : [];
  25999. });
  26000. /**
  26001. * This method is like `_.intersection` except that it accepts `iteratee`
  26002. * which is invoked for each element of each `arrays` to generate the criterion
  26003. * by which they're compared. The order and references of result values are
  26004. * determined by the first array. The iteratee is invoked with one argument:
  26005. * (value).
  26006. *
  26007. * @static
  26008. * @memberOf _
  26009. * @since 4.0.0
  26010. * @category Array
  26011. * @param {...Array} [arrays] The arrays to inspect.
  26012. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26013. * @returns {Array} Returns the new array of intersecting values.
  26014. * @example
  26015. *
  26016. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26017. * // => [2.1]
  26018. *
  26019. * // The `_.property` iteratee shorthand.
  26020. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26021. * // => [{ 'x': 1 }]
  26022. */
  26023. var intersectionBy = baseRest(function(arrays) {
  26024. var iteratee = last(arrays),
  26025. mapped = arrayMap(arrays, castArrayLikeObject);
  26026. if (iteratee === last(mapped)) {
  26027. iteratee = undefined;
  26028. } else {
  26029. mapped.pop();
  26030. }
  26031. return (mapped.length && mapped[0] === arrays[0])
  26032. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26033. : [];
  26034. });
  26035. /**
  26036. * This method is like `_.intersection` except that it accepts `comparator`
  26037. * which is invoked to compare elements of `arrays`. The order and references
  26038. * of result values are determined by the first array. The comparator is
  26039. * invoked with two arguments: (arrVal, othVal).
  26040. *
  26041. * @static
  26042. * @memberOf _
  26043. * @since 4.0.0
  26044. * @category Array
  26045. * @param {...Array} [arrays] The arrays to inspect.
  26046. * @param {Function} [comparator] The comparator invoked per element.
  26047. * @returns {Array} Returns the new array of intersecting values.
  26048. * @example
  26049. *
  26050. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26051. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26052. *
  26053. * _.intersectionWith(objects, others, _.isEqual);
  26054. * // => [{ 'x': 1, 'y': 2 }]
  26055. */
  26056. var intersectionWith = baseRest(function(arrays) {
  26057. var comparator = last(arrays),
  26058. mapped = arrayMap(arrays, castArrayLikeObject);
  26059. comparator = typeof comparator == 'function' ? comparator : undefined;
  26060. if (comparator) {
  26061. mapped.pop();
  26062. }
  26063. return (mapped.length && mapped[0] === arrays[0])
  26064. ? baseIntersection(mapped, undefined, comparator)
  26065. : [];
  26066. });
  26067. /**
  26068. * Converts all elements in `array` into a string separated by `separator`.
  26069. *
  26070. * @static
  26071. * @memberOf _
  26072. * @since 4.0.0
  26073. * @category Array
  26074. * @param {Array} array The array to convert.
  26075. * @param {string} [separator=','] The element separator.
  26076. * @returns {string} Returns the joined string.
  26077. * @example
  26078. *
  26079. * _.join(['a', 'b', 'c'], '~');
  26080. * // => 'a~b~c'
  26081. */
  26082. function join(array, separator) {
  26083. return array == null ? '' : nativeJoin.call(array, separator);
  26084. }
  26085. /**
  26086. * Gets the last element of `array`.
  26087. *
  26088. * @static
  26089. * @memberOf _
  26090. * @since 0.1.0
  26091. * @category Array
  26092. * @param {Array} array The array to query.
  26093. * @returns {*} Returns the last element of `array`.
  26094. * @example
  26095. *
  26096. * _.last([1, 2, 3]);
  26097. * // => 3
  26098. */
  26099. function last(array) {
  26100. var length = array == null ? 0 : array.length;
  26101. return length ? array[length - 1] : undefined;
  26102. }
  26103. /**
  26104. * This method is like `_.indexOf` except that it iterates over elements of
  26105. * `array` from right to left.
  26106. *
  26107. * @static
  26108. * @memberOf _
  26109. * @since 0.1.0
  26110. * @category Array
  26111. * @param {Array} array The array to inspect.
  26112. * @param {*} value The value to search for.
  26113. * @param {number} [fromIndex=array.length-1] The index to search from.
  26114. * @returns {number} Returns the index of the matched value, else `-1`.
  26115. * @example
  26116. *
  26117. * _.lastIndexOf([1, 2, 1, 2], 2);
  26118. * // => 3
  26119. *
  26120. * // Search from the `fromIndex`.
  26121. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26122. * // => 1
  26123. */
  26124. function lastIndexOf(array, value, fromIndex) {
  26125. var length = array == null ? 0 : array.length;
  26126. if (!length) {
  26127. return -1;
  26128. }
  26129. var index = length;
  26130. if (fromIndex !== undefined) {
  26131. index = toInteger(fromIndex);
  26132. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26133. }
  26134. return value === value
  26135. ? strictLastIndexOf(array, value, index)
  26136. : baseFindIndex(array, baseIsNaN, index, true);
  26137. }
  26138. /**
  26139. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26140. * element from the end is returned.
  26141. *
  26142. * @static
  26143. * @memberOf _
  26144. * @since 4.11.0
  26145. * @category Array
  26146. * @param {Array} array The array to query.
  26147. * @param {number} [n=0] The index of the element to return.
  26148. * @returns {*} Returns the nth element of `array`.
  26149. * @example
  26150. *
  26151. * var array = ['a', 'b', 'c', 'd'];
  26152. *
  26153. * _.nth(array, 1);
  26154. * // => 'b'
  26155. *
  26156. * _.nth(array, -2);
  26157. * // => 'c';
  26158. */
  26159. function nth(array, n) {
  26160. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26161. }
  26162. /**
  26163. * Removes all given values from `array` using
  26164. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26165. * for equality comparisons.
  26166. *
  26167. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26168. * to remove elements from an array by predicate.
  26169. *
  26170. * @static
  26171. * @memberOf _
  26172. * @since 2.0.0
  26173. * @category Array
  26174. * @param {Array} array The array to modify.
  26175. * @param {...*} [values] The values to remove.
  26176. * @returns {Array} Returns `array`.
  26177. * @example
  26178. *
  26179. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26180. *
  26181. * _.pull(array, 'a', 'c');
  26182. * console.log(array);
  26183. * // => ['b', 'b']
  26184. */
  26185. var pull = baseRest(pullAll);
  26186. /**
  26187. * This method is like `_.pull` except that it accepts an array of values to remove.
  26188. *
  26189. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26190. *
  26191. * @static
  26192. * @memberOf _
  26193. * @since 4.0.0
  26194. * @category Array
  26195. * @param {Array} array The array to modify.
  26196. * @param {Array} values The values to remove.
  26197. * @returns {Array} Returns `array`.
  26198. * @example
  26199. *
  26200. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26201. *
  26202. * _.pullAll(array, ['a', 'c']);
  26203. * console.log(array);
  26204. * // => ['b', 'b']
  26205. */
  26206. function pullAll(array, values) {
  26207. return (array && array.length && values && values.length)
  26208. ? basePullAll(array, values)
  26209. : array;
  26210. }
  26211. /**
  26212. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26213. * invoked for each element of `array` and `values` to generate the criterion
  26214. * by which they're compared. The iteratee is invoked with one argument: (value).
  26215. *
  26216. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26217. *
  26218. * @static
  26219. * @memberOf _
  26220. * @since 4.0.0
  26221. * @category Array
  26222. * @param {Array} array The array to modify.
  26223. * @param {Array} values The values to remove.
  26224. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26225. * @returns {Array} Returns `array`.
  26226. * @example
  26227. *
  26228. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26229. *
  26230. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26231. * console.log(array);
  26232. * // => [{ 'x': 2 }]
  26233. */
  26234. function pullAllBy(array, values, iteratee) {
  26235. return (array && array.length && values && values.length)
  26236. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26237. : array;
  26238. }
  26239. /**
  26240. * This method is like `_.pullAll` except that it accepts `comparator` which
  26241. * is invoked to compare elements of `array` to `values`. The comparator is
  26242. * invoked with two arguments: (arrVal, othVal).
  26243. *
  26244. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26245. *
  26246. * @static
  26247. * @memberOf _
  26248. * @since 4.6.0
  26249. * @category Array
  26250. * @param {Array} array The array to modify.
  26251. * @param {Array} values The values to remove.
  26252. * @param {Function} [comparator] The comparator invoked per element.
  26253. * @returns {Array} Returns `array`.
  26254. * @example
  26255. *
  26256. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26257. *
  26258. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26259. * console.log(array);
  26260. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26261. */
  26262. function pullAllWith(array, values, comparator) {
  26263. return (array && array.length && values && values.length)
  26264. ? basePullAll(array, values, undefined, comparator)
  26265. : array;
  26266. }
  26267. /**
  26268. * Removes elements from `array` corresponding to `indexes` and returns an
  26269. * array of removed elements.
  26270. *
  26271. * **Note:** Unlike `_.at`, this method mutates `array`.
  26272. *
  26273. * @static
  26274. * @memberOf _
  26275. * @since 3.0.0
  26276. * @category Array
  26277. * @param {Array} array The array to modify.
  26278. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26279. * @returns {Array} Returns the new array of removed elements.
  26280. * @example
  26281. *
  26282. * var array = ['a', 'b', 'c', 'd'];
  26283. * var pulled = _.pullAt(array, [1, 3]);
  26284. *
  26285. * console.log(array);
  26286. * // => ['a', 'c']
  26287. *
  26288. * console.log(pulled);
  26289. * // => ['b', 'd']
  26290. */
  26291. var pullAt = flatRest(function(array, indexes) {
  26292. var length = array == null ? 0 : array.length,
  26293. result = baseAt(array, indexes);
  26294. basePullAt(array, arrayMap(indexes, function(index) {
  26295. return isIndex(index, length) ? +index : index;
  26296. }).sort(compareAscending));
  26297. return result;
  26298. });
  26299. /**
  26300. * Removes all elements from `array` that `predicate` returns truthy for
  26301. * and returns an array of the removed elements. The predicate is invoked
  26302. * with three arguments: (value, index, array).
  26303. *
  26304. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26305. * to pull elements from an array by value.
  26306. *
  26307. * @static
  26308. * @memberOf _
  26309. * @since 2.0.0
  26310. * @category Array
  26311. * @param {Array} array The array to modify.
  26312. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26313. * @returns {Array} Returns the new array of removed elements.
  26314. * @example
  26315. *
  26316. * var array = [1, 2, 3, 4];
  26317. * var evens = _.remove(array, function(n) {
  26318. * return n % 2 == 0;
  26319. * });
  26320. *
  26321. * console.log(array);
  26322. * // => [1, 3]
  26323. *
  26324. * console.log(evens);
  26325. * // => [2, 4]
  26326. */
  26327. function remove(array, predicate) {
  26328. var result = [];
  26329. if (!(array && array.length)) {
  26330. return result;
  26331. }
  26332. var index = -1,
  26333. indexes = [],
  26334. length = array.length;
  26335. predicate = getIteratee(predicate, 3);
  26336. while (++index < length) {
  26337. var value = array[index];
  26338. if (predicate(value, index, array)) {
  26339. result.push(value);
  26340. indexes.push(index);
  26341. }
  26342. }
  26343. basePullAt(array, indexes);
  26344. return result;
  26345. }
  26346. /**
  26347. * Reverses `array` so that the first element becomes the last, the second
  26348. * element becomes the second to last, and so on.
  26349. *
  26350. * **Note:** This method mutates `array` and is based on
  26351. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26352. *
  26353. * @static
  26354. * @memberOf _
  26355. * @since 4.0.0
  26356. * @category Array
  26357. * @param {Array} array The array to modify.
  26358. * @returns {Array} Returns `array`.
  26359. * @example
  26360. *
  26361. * var array = [1, 2, 3];
  26362. *
  26363. * _.reverse(array);
  26364. * // => [3, 2, 1]
  26365. *
  26366. * console.log(array);
  26367. * // => [3, 2, 1]
  26368. */
  26369. function reverse(array) {
  26370. return array == null ? array : nativeReverse.call(array);
  26371. }
  26372. /**
  26373. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26374. *
  26375. * **Note:** This method is used instead of
  26376. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26377. * returned.
  26378. *
  26379. * @static
  26380. * @memberOf _
  26381. * @since 3.0.0
  26382. * @category Array
  26383. * @param {Array} array The array to slice.
  26384. * @param {number} [start=0] The start position.
  26385. * @param {number} [end=array.length] The end position.
  26386. * @returns {Array} Returns the slice of `array`.
  26387. */
  26388. function slice(array, start, end) {
  26389. var length = array == null ? 0 : array.length;
  26390. if (!length) {
  26391. return [];
  26392. }
  26393. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26394. start = 0;
  26395. end = length;
  26396. }
  26397. else {
  26398. start = start == null ? 0 : toInteger(start);
  26399. end = end === undefined ? length : toInteger(end);
  26400. }
  26401. return baseSlice(array, start, end);
  26402. }
  26403. /**
  26404. * Uses a binary search to determine the lowest index at which `value`
  26405. * should be inserted into `array` in order to maintain its sort order.
  26406. *
  26407. * @static
  26408. * @memberOf _
  26409. * @since 0.1.0
  26410. * @category Array
  26411. * @param {Array} array The sorted array to inspect.
  26412. * @param {*} value The value to evaluate.
  26413. * @returns {number} Returns the index at which `value` should be inserted
  26414. * into `array`.
  26415. * @example
  26416. *
  26417. * _.sortedIndex([30, 50], 40);
  26418. * // => 1
  26419. */
  26420. function sortedIndex(array, value) {
  26421. return baseSortedIndex(array, value);
  26422. }
  26423. /**
  26424. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26425. * which is invoked for `value` and each element of `array` to compute their
  26426. * sort ranking. The iteratee is invoked with one argument: (value).
  26427. *
  26428. * @static
  26429. * @memberOf _
  26430. * @since 4.0.0
  26431. * @category Array
  26432. * @param {Array} array The sorted array to inspect.
  26433. * @param {*} value The value to evaluate.
  26434. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26435. * @returns {number} Returns the index at which `value` should be inserted
  26436. * into `array`.
  26437. * @example
  26438. *
  26439. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26440. *
  26441. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26442. * // => 0
  26443. *
  26444. * // The `_.property` iteratee shorthand.
  26445. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26446. * // => 0
  26447. */
  26448. function sortedIndexBy(array, value, iteratee) {
  26449. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26450. }
  26451. /**
  26452. * This method is like `_.indexOf` except that it performs a binary
  26453. * search on a sorted `array`.
  26454. *
  26455. * @static
  26456. * @memberOf _
  26457. * @since 4.0.0
  26458. * @category Array
  26459. * @param {Array} array The array to inspect.
  26460. * @param {*} value The value to search for.
  26461. * @returns {number} Returns the index of the matched value, else `-1`.
  26462. * @example
  26463. *
  26464. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26465. * // => 1
  26466. */
  26467. function sortedIndexOf(array, value) {
  26468. var length = array == null ? 0 : array.length;
  26469. if (length) {
  26470. var index = baseSortedIndex(array, value);
  26471. if (index < length && eq(array[index], value)) {
  26472. return index;
  26473. }
  26474. }
  26475. return -1;
  26476. }
  26477. /**
  26478. * This method is like `_.sortedIndex` except that it returns the highest
  26479. * index at which `value` should be inserted into `array` in order to
  26480. * maintain its sort order.
  26481. *
  26482. * @static
  26483. * @memberOf _
  26484. * @since 3.0.0
  26485. * @category Array
  26486. * @param {Array} array The sorted array to inspect.
  26487. * @param {*} value The value to evaluate.
  26488. * @returns {number} Returns the index at which `value` should be inserted
  26489. * into `array`.
  26490. * @example
  26491. *
  26492. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26493. * // => 4
  26494. */
  26495. function sortedLastIndex(array, value) {
  26496. return baseSortedIndex(array, value, true);
  26497. }
  26498. /**
  26499. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26500. * which is invoked for `value` and each element of `array` to compute their
  26501. * sort ranking. The iteratee is invoked with one argument: (value).
  26502. *
  26503. * @static
  26504. * @memberOf _
  26505. * @since 4.0.0
  26506. * @category Array
  26507. * @param {Array} array The sorted array to inspect.
  26508. * @param {*} value The value to evaluate.
  26509. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26510. * @returns {number} Returns the index at which `value` should be inserted
  26511. * into `array`.
  26512. * @example
  26513. *
  26514. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26515. *
  26516. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26517. * // => 1
  26518. *
  26519. * // The `_.property` iteratee shorthand.
  26520. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26521. * // => 1
  26522. */
  26523. function sortedLastIndexBy(array, value, iteratee) {
  26524. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26525. }
  26526. /**
  26527. * This method is like `_.lastIndexOf` except that it performs a binary
  26528. * search on a sorted `array`.
  26529. *
  26530. * @static
  26531. * @memberOf _
  26532. * @since 4.0.0
  26533. * @category Array
  26534. * @param {Array} array The array to inspect.
  26535. * @param {*} value The value to search for.
  26536. * @returns {number} Returns the index of the matched value, else `-1`.
  26537. * @example
  26538. *
  26539. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26540. * // => 3
  26541. */
  26542. function sortedLastIndexOf(array, value) {
  26543. var length = array == null ? 0 : array.length;
  26544. if (length) {
  26545. var index = baseSortedIndex(array, value, true) - 1;
  26546. if (eq(array[index], value)) {
  26547. return index;
  26548. }
  26549. }
  26550. return -1;
  26551. }
  26552. /**
  26553. * This method is like `_.uniq` except that it's designed and optimized
  26554. * for sorted arrays.
  26555. *
  26556. * @static
  26557. * @memberOf _
  26558. * @since 4.0.0
  26559. * @category Array
  26560. * @param {Array} array The array to inspect.
  26561. * @returns {Array} Returns the new duplicate free array.
  26562. * @example
  26563. *
  26564. * _.sortedUniq([1, 1, 2]);
  26565. * // => [1, 2]
  26566. */
  26567. function sortedUniq(array) {
  26568. return (array && array.length)
  26569. ? baseSortedUniq(array)
  26570. : [];
  26571. }
  26572. /**
  26573. * This method is like `_.uniqBy` except that it's designed and optimized
  26574. * for sorted arrays.
  26575. *
  26576. * @static
  26577. * @memberOf _
  26578. * @since 4.0.0
  26579. * @category Array
  26580. * @param {Array} array The array to inspect.
  26581. * @param {Function} [iteratee] The iteratee invoked per element.
  26582. * @returns {Array} Returns the new duplicate free array.
  26583. * @example
  26584. *
  26585. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26586. * // => [1.1, 2.3]
  26587. */
  26588. function sortedUniqBy(array, iteratee) {
  26589. return (array && array.length)
  26590. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26591. : [];
  26592. }
  26593. /**
  26594. * Gets all but the first element of `array`.
  26595. *
  26596. * @static
  26597. * @memberOf _
  26598. * @since 4.0.0
  26599. * @category Array
  26600. * @param {Array} array The array to query.
  26601. * @returns {Array} Returns the slice of `array`.
  26602. * @example
  26603. *
  26604. * _.tail([1, 2, 3]);
  26605. * // => [2, 3]
  26606. */
  26607. function tail(array) {
  26608. var length = array == null ? 0 : array.length;
  26609. return length ? baseSlice(array, 1, length) : [];
  26610. }
  26611. /**
  26612. * Creates a slice of `array` with `n` elements taken from the beginning.
  26613. *
  26614. * @static
  26615. * @memberOf _
  26616. * @since 0.1.0
  26617. * @category Array
  26618. * @param {Array} array The array to query.
  26619. * @param {number} [n=1] The number of elements to take.
  26620. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26621. * @returns {Array} Returns the slice of `array`.
  26622. * @example
  26623. *
  26624. * _.take([1, 2, 3]);
  26625. * // => [1]
  26626. *
  26627. * _.take([1, 2, 3], 2);
  26628. * // => [1, 2]
  26629. *
  26630. * _.take([1, 2, 3], 5);
  26631. * // => [1, 2, 3]
  26632. *
  26633. * _.take([1, 2, 3], 0);
  26634. * // => []
  26635. */
  26636. function take(array, n, guard) {
  26637. if (!(array && array.length)) {
  26638. return [];
  26639. }
  26640. n = (guard || n === undefined) ? 1 : toInteger(n);
  26641. return baseSlice(array, 0, n < 0 ? 0 : n);
  26642. }
  26643. /**
  26644. * Creates a slice of `array` with `n` elements taken from the end.
  26645. *
  26646. * @static
  26647. * @memberOf _
  26648. * @since 3.0.0
  26649. * @category Array
  26650. * @param {Array} array The array to query.
  26651. * @param {number} [n=1] The number of elements to take.
  26652. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26653. * @returns {Array} Returns the slice of `array`.
  26654. * @example
  26655. *
  26656. * _.takeRight([1, 2, 3]);
  26657. * // => [3]
  26658. *
  26659. * _.takeRight([1, 2, 3], 2);
  26660. * // => [2, 3]
  26661. *
  26662. * _.takeRight([1, 2, 3], 5);
  26663. * // => [1, 2, 3]
  26664. *
  26665. * _.takeRight([1, 2, 3], 0);
  26666. * // => []
  26667. */
  26668. function takeRight(array, n, guard) {
  26669. var length = array == null ? 0 : array.length;
  26670. if (!length) {
  26671. return [];
  26672. }
  26673. n = (guard || n === undefined) ? 1 : toInteger(n);
  26674. n = length - n;
  26675. return baseSlice(array, n < 0 ? 0 : n, length);
  26676. }
  26677. /**
  26678. * Creates a slice of `array` with elements taken from the end. Elements are
  26679. * taken until `predicate` returns falsey. The predicate is invoked with
  26680. * three arguments: (value, index, array).
  26681. *
  26682. * @static
  26683. * @memberOf _
  26684. * @since 3.0.0
  26685. * @category Array
  26686. * @param {Array} array The array to query.
  26687. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26688. * @returns {Array} Returns the slice of `array`.
  26689. * @example
  26690. *
  26691. * var users = [
  26692. * { 'user': 'barney', 'active': true },
  26693. * { 'user': 'fred', 'active': false },
  26694. * { 'user': 'pebbles', 'active': false }
  26695. * ];
  26696. *
  26697. * _.takeRightWhile(users, function(o) { return !o.active; });
  26698. * // => objects for ['fred', 'pebbles']
  26699. *
  26700. * // The `_.matches` iteratee shorthand.
  26701. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26702. * // => objects for ['pebbles']
  26703. *
  26704. * // The `_.matchesProperty` iteratee shorthand.
  26705. * _.takeRightWhile(users, ['active', false]);
  26706. * // => objects for ['fred', 'pebbles']
  26707. *
  26708. * // The `_.property` iteratee shorthand.
  26709. * _.takeRightWhile(users, 'active');
  26710. * // => []
  26711. */
  26712. function takeRightWhile(array, predicate) {
  26713. return (array && array.length)
  26714. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26715. : [];
  26716. }
  26717. /**
  26718. * Creates a slice of `array` with elements taken from the beginning. Elements
  26719. * are taken until `predicate` returns falsey. The predicate is invoked with
  26720. * three arguments: (value, index, array).
  26721. *
  26722. * @static
  26723. * @memberOf _
  26724. * @since 3.0.0
  26725. * @category Array
  26726. * @param {Array} array The array to query.
  26727. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26728. * @returns {Array} Returns the slice of `array`.
  26729. * @example
  26730. *
  26731. * var users = [
  26732. * { 'user': 'barney', 'active': false },
  26733. * { 'user': 'fred', 'active': false },
  26734. * { 'user': 'pebbles', 'active': true }
  26735. * ];
  26736. *
  26737. * _.takeWhile(users, function(o) { return !o.active; });
  26738. * // => objects for ['barney', 'fred']
  26739. *
  26740. * // The `_.matches` iteratee shorthand.
  26741. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26742. * // => objects for ['barney']
  26743. *
  26744. * // The `_.matchesProperty` iteratee shorthand.
  26745. * _.takeWhile(users, ['active', false]);
  26746. * // => objects for ['barney', 'fred']
  26747. *
  26748. * // The `_.property` iteratee shorthand.
  26749. * _.takeWhile(users, 'active');
  26750. * // => []
  26751. */
  26752. function takeWhile(array, predicate) {
  26753. return (array && array.length)
  26754. ? baseWhile(array, getIteratee(predicate, 3))
  26755. : [];
  26756. }
  26757. /**
  26758. * Creates an array of unique values, in order, from all given arrays using
  26759. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26760. * for equality comparisons.
  26761. *
  26762. * @static
  26763. * @memberOf _
  26764. * @since 0.1.0
  26765. * @category Array
  26766. * @param {...Array} [arrays] The arrays to inspect.
  26767. * @returns {Array} Returns the new array of combined values.
  26768. * @example
  26769. *
  26770. * _.union([2], [1, 2]);
  26771. * // => [2, 1]
  26772. */
  26773. var union = baseRest(function(arrays) {
  26774. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26775. });
  26776. /**
  26777. * This method is like `_.union` except that it accepts `iteratee` which is
  26778. * invoked for each element of each `arrays` to generate the criterion by
  26779. * which uniqueness is computed. Result values are chosen from the first
  26780. * array in which the value occurs. The iteratee is invoked with one argument:
  26781. * (value).
  26782. *
  26783. * @static
  26784. * @memberOf _
  26785. * @since 4.0.0
  26786. * @category Array
  26787. * @param {...Array} [arrays] The arrays to inspect.
  26788. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26789. * @returns {Array} Returns the new array of combined values.
  26790. * @example
  26791. *
  26792. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26793. * // => [2.1, 1.2]
  26794. *
  26795. * // The `_.property` iteratee shorthand.
  26796. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26797. * // => [{ 'x': 1 }, { 'x': 2 }]
  26798. */
  26799. var unionBy = baseRest(function(arrays) {
  26800. var iteratee = last(arrays);
  26801. if (isArrayLikeObject(iteratee)) {
  26802. iteratee = undefined;
  26803. }
  26804. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26805. });
  26806. /**
  26807. * This method is like `_.union` except that it accepts `comparator` which
  26808. * is invoked to compare elements of `arrays`. Result values are chosen from
  26809. * the first array in which the value occurs. The comparator is invoked
  26810. * with two arguments: (arrVal, othVal).
  26811. *
  26812. * @static
  26813. * @memberOf _
  26814. * @since 4.0.0
  26815. * @category Array
  26816. * @param {...Array} [arrays] The arrays to inspect.
  26817. * @param {Function} [comparator] The comparator invoked per element.
  26818. * @returns {Array} Returns the new array of combined values.
  26819. * @example
  26820. *
  26821. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26822. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26823. *
  26824. * _.unionWith(objects, others, _.isEqual);
  26825. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26826. */
  26827. var unionWith = baseRest(function(arrays) {
  26828. var comparator = last(arrays);
  26829. comparator = typeof comparator == 'function' ? comparator : undefined;
  26830. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26831. });
  26832. /**
  26833. * Creates a duplicate-free version of an array, using
  26834. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26835. * for equality comparisons, in which only the first occurrence of each element
  26836. * is kept. The order of result values is determined by the order they occur
  26837. * in the array.
  26838. *
  26839. * @static
  26840. * @memberOf _
  26841. * @since 0.1.0
  26842. * @category Array
  26843. * @param {Array} array The array to inspect.
  26844. * @returns {Array} Returns the new duplicate free array.
  26845. * @example
  26846. *
  26847. * _.uniq([2, 1, 2]);
  26848. * // => [2, 1]
  26849. */
  26850. function uniq(array) {
  26851. return (array && array.length) ? baseUniq(array) : [];
  26852. }
  26853. /**
  26854. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26855. * invoked for each element in `array` to generate the criterion by which
  26856. * uniqueness is computed. The order of result values is determined by the
  26857. * order they occur in the array. The iteratee is invoked with one argument:
  26858. * (value).
  26859. *
  26860. * @static
  26861. * @memberOf _
  26862. * @since 4.0.0
  26863. * @category Array
  26864. * @param {Array} array The array to inspect.
  26865. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26866. * @returns {Array} Returns the new duplicate free array.
  26867. * @example
  26868. *
  26869. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26870. * // => [2.1, 1.2]
  26871. *
  26872. * // The `_.property` iteratee shorthand.
  26873. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26874. * // => [{ 'x': 1 }, { 'x': 2 }]
  26875. */
  26876. function uniqBy(array, iteratee) {
  26877. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26878. }
  26879. /**
  26880. * This method is like `_.uniq` except that it accepts `comparator` which
  26881. * is invoked to compare elements of `array`. The order of result values is
  26882. * determined by the order they occur in the array.The comparator is invoked
  26883. * with two arguments: (arrVal, othVal).
  26884. *
  26885. * @static
  26886. * @memberOf _
  26887. * @since 4.0.0
  26888. * @category Array
  26889. * @param {Array} array The array to inspect.
  26890. * @param {Function} [comparator] The comparator invoked per element.
  26891. * @returns {Array} Returns the new duplicate free array.
  26892. * @example
  26893. *
  26894. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26895. *
  26896. * _.uniqWith(objects, _.isEqual);
  26897. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26898. */
  26899. function uniqWith(array, comparator) {
  26900. comparator = typeof comparator == 'function' ? comparator : undefined;
  26901. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26902. }
  26903. /**
  26904. * This method is like `_.zip` except that it accepts an array of grouped
  26905. * elements and creates an array regrouping the elements to their pre-zip
  26906. * configuration.
  26907. *
  26908. * @static
  26909. * @memberOf _
  26910. * @since 1.2.0
  26911. * @category Array
  26912. * @param {Array} array The array of grouped elements to process.
  26913. * @returns {Array} Returns the new array of regrouped elements.
  26914. * @example
  26915. *
  26916. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26917. * // => [['a', 1, true], ['b', 2, false]]
  26918. *
  26919. * _.unzip(zipped);
  26920. * // => [['a', 'b'], [1, 2], [true, false]]
  26921. */
  26922. function unzip(array) {
  26923. if (!(array && array.length)) {
  26924. return [];
  26925. }
  26926. var length = 0;
  26927. array = arrayFilter(array, function(group) {
  26928. if (isArrayLikeObject(group)) {
  26929. length = nativeMax(group.length, length);
  26930. return true;
  26931. }
  26932. });
  26933. return baseTimes(length, function(index) {
  26934. return arrayMap(array, baseProperty(index));
  26935. });
  26936. }
  26937. /**
  26938. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26939. * how regrouped values should be combined. The iteratee is invoked with the
  26940. * elements of each group: (...group).
  26941. *
  26942. * @static
  26943. * @memberOf _
  26944. * @since 3.8.0
  26945. * @category Array
  26946. * @param {Array} array The array of grouped elements to process.
  26947. * @param {Function} [iteratee=_.identity] The function to combine
  26948. * regrouped values.
  26949. * @returns {Array} Returns the new array of regrouped elements.
  26950. * @example
  26951. *
  26952. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26953. * // => [[1, 10, 100], [2, 20, 200]]
  26954. *
  26955. * _.unzipWith(zipped, _.add);
  26956. * // => [3, 30, 300]
  26957. */
  26958. function unzipWith(array, iteratee) {
  26959. if (!(array && array.length)) {
  26960. return [];
  26961. }
  26962. var result = unzip(array);
  26963. if (iteratee == null) {
  26964. return result;
  26965. }
  26966. return arrayMap(result, function(group) {
  26967. return apply(iteratee, undefined, group);
  26968. });
  26969. }
  26970. /**
  26971. * Creates an array excluding all given values using
  26972. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26973. * for equality comparisons.
  26974. *
  26975. * **Note:** Unlike `_.pull`, this method returns a new array.
  26976. *
  26977. * @static
  26978. * @memberOf _
  26979. * @since 0.1.0
  26980. * @category Array
  26981. * @param {Array} array The array to inspect.
  26982. * @param {...*} [values] The values to exclude.
  26983. * @returns {Array} Returns the new array of filtered values.
  26984. * @see _.difference, _.xor
  26985. * @example
  26986. *
  26987. * _.without([2, 1, 2, 3], 1, 2);
  26988. * // => [3]
  26989. */
  26990. var without = baseRest(function(array, values) {
  26991. return isArrayLikeObject(array)
  26992. ? baseDifference(array, values)
  26993. : [];
  26994. });
  26995. /**
  26996. * Creates an array of unique values that is the
  26997. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26998. * of the given arrays. The order of result values is determined by the order
  26999. * they occur in the arrays.
  27000. *
  27001. * @static
  27002. * @memberOf _
  27003. * @since 2.4.0
  27004. * @category Array
  27005. * @param {...Array} [arrays] The arrays to inspect.
  27006. * @returns {Array} Returns the new array of filtered values.
  27007. * @see _.difference, _.without
  27008. * @example
  27009. *
  27010. * _.xor([2, 1], [2, 3]);
  27011. * // => [1, 3]
  27012. */
  27013. var xor = baseRest(function(arrays) {
  27014. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27015. });
  27016. /**
  27017. * This method is like `_.xor` except that it accepts `iteratee` which is
  27018. * invoked for each element of each `arrays` to generate the criterion by
  27019. * which by which they're compared. The order of result values is determined
  27020. * by the order they occur in the arrays. The iteratee is invoked with one
  27021. * argument: (value).
  27022. *
  27023. * @static
  27024. * @memberOf _
  27025. * @since 4.0.0
  27026. * @category Array
  27027. * @param {...Array} [arrays] The arrays to inspect.
  27028. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27029. * @returns {Array} Returns the new array of filtered values.
  27030. * @example
  27031. *
  27032. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27033. * // => [1.2, 3.4]
  27034. *
  27035. * // The `_.property` iteratee shorthand.
  27036. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27037. * // => [{ 'x': 2 }]
  27038. */
  27039. var xorBy = baseRest(function(arrays) {
  27040. var iteratee = last(arrays);
  27041. if (isArrayLikeObject(iteratee)) {
  27042. iteratee = undefined;
  27043. }
  27044. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27045. });
  27046. /**
  27047. * This method is like `_.xor` except that it accepts `comparator` which is
  27048. * invoked to compare elements of `arrays`. The order of result values is
  27049. * determined by the order they occur in the arrays. The comparator is invoked
  27050. * with two arguments: (arrVal, othVal).
  27051. *
  27052. * @static
  27053. * @memberOf _
  27054. * @since 4.0.0
  27055. * @category Array
  27056. * @param {...Array} [arrays] The arrays to inspect.
  27057. * @param {Function} [comparator] The comparator invoked per element.
  27058. * @returns {Array} Returns the new array of filtered values.
  27059. * @example
  27060. *
  27061. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27062. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27063. *
  27064. * _.xorWith(objects, others, _.isEqual);
  27065. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27066. */
  27067. var xorWith = baseRest(function(arrays) {
  27068. var comparator = last(arrays);
  27069. comparator = typeof comparator == 'function' ? comparator : undefined;
  27070. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27071. });
  27072. /**
  27073. * Creates an array of grouped elements, the first of which contains the
  27074. * first elements of the given arrays, the second of which contains the
  27075. * second elements of the given arrays, and so on.
  27076. *
  27077. * @static
  27078. * @memberOf _
  27079. * @since 0.1.0
  27080. * @category Array
  27081. * @param {...Array} [arrays] The arrays to process.
  27082. * @returns {Array} Returns the new array of grouped elements.
  27083. * @example
  27084. *
  27085. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27086. * // => [['a', 1, true], ['b', 2, false]]
  27087. */
  27088. var zip = baseRest(unzip);
  27089. /**
  27090. * This method is like `_.fromPairs` except that it accepts two arrays,
  27091. * one of property identifiers and one of corresponding values.
  27092. *
  27093. * @static
  27094. * @memberOf _
  27095. * @since 0.4.0
  27096. * @category Array
  27097. * @param {Array} [props=[]] The property identifiers.
  27098. * @param {Array} [values=[]] The property values.
  27099. * @returns {Object} Returns the new object.
  27100. * @example
  27101. *
  27102. * _.zipObject(['a', 'b'], [1, 2]);
  27103. * // => { 'a': 1, 'b': 2 }
  27104. */
  27105. function zipObject(props, values) {
  27106. return baseZipObject(props || [], values || [], assignValue);
  27107. }
  27108. /**
  27109. * This method is like `_.zipObject` except that it supports property paths.
  27110. *
  27111. * @static
  27112. * @memberOf _
  27113. * @since 4.1.0
  27114. * @category Array
  27115. * @param {Array} [props=[]] The property identifiers.
  27116. * @param {Array} [values=[]] The property values.
  27117. * @returns {Object} Returns the new object.
  27118. * @example
  27119. *
  27120. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27121. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27122. */
  27123. function zipObjectDeep(props, values) {
  27124. return baseZipObject(props || [], values || [], baseSet);
  27125. }
  27126. /**
  27127. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27128. * how grouped values should be combined. The iteratee is invoked with the
  27129. * elements of each group: (...group).
  27130. *
  27131. * @static
  27132. * @memberOf _
  27133. * @since 3.8.0
  27134. * @category Array
  27135. * @param {...Array} [arrays] The arrays to process.
  27136. * @param {Function} [iteratee=_.identity] The function to combine
  27137. * grouped values.
  27138. * @returns {Array} Returns the new array of grouped elements.
  27139. * @example
  27140. *
  27141. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27142. * return a + b + c;
  27143. * });
  27144. * // => [111, 222]
  27145. */
  27146. var zipWith = baseRest(function(arrays) {
  27147. var length = arrays.length,
  27148. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27149. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27150. return unzipWith(arrays, iteratee);
  27151. });
  27152. /*------------------------------------------------------------------------*/
  27153. /**
  27154. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27155. * chain sequences enabled. The result of such sequences must be unwrapped
  27156. * with `_#value`.
  27157. *
  27158. * @static
  27159. * @memberOf _
  27160. * @since 1.3.0
  27161. * @category Seq
  27162. * @param {*} value The value to wrap.
  27163. * @returns {Object} Returns the new `lodash` wrapper instance.
  27164. * @example
  27165. *
  27166. * var users = [
  27167. * { 'user': 'barney', 'age': 36 },
  27168. * { 'user': 'fred', 'age': 40 },
  27169. * { 'user': 'pebbles', 'age': 1 }
  27170. * ];
  27171. *
  27172. * var youngest = _
  27173. * .chain(users)
  27174. * .sortBy('age')
  27175. * .map(function(o) {
  27176. * return o.user + ' is ' + o.age;
  27177. * })
  27178. * .head()
  27179. * .value();
  27180. * // => 'pebbles is 1'
  27181. */
  27182. function chain(value) {
  27183. var result = lodash(value);
  27184. result.__chain__ = true;
  27185. return result;
  27186. }
  27187. /**
  27188. * This method invokes `interceptor` and returns `value`. The interceptor
  27189. * is invoked with one argument; (value). The purpose of this method is to
  27190. * "tap into" a method chain sequence in order to modify intermediate results.
  27191. *
  27192. * @static
  27193. * @memberOf _
  27194. * @since 0.1.0
  27195. * @category Seq
  27196. * @param {*} value The value to provide to `interceptor`.
  27197. * @param {Function} interceptor The function to invoke.
  27198. * @returns {*} Returns `value`.
  27199. * @example
  27200. *
  27201. * _([1, 2, 3])
  27202. * .tap(function(array) {
  27203. * // Mutate input array.
  27204. * array.pop();
  27205. * })
  27206. * .reverse()
  27207. * .value();
  27208. * // => [2, 1]
  27209. */
  27210. function tap(value, interceptor) {
  27211. interceptor(value);
  27212. return value;
  27213. }
  27214. /**
  27215. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27216. * The purpose of this method is to "pass thru" values replacing intermediate
  27217. * results in a method chain sequence.
  27218. *
  27219. * @static
  27220. * @memberOf _
  27221. * @since 3.0.0
  27222. * @category Seq
  27223. * @param {*} value The value to provide to `interceptor`.
  27224. * @param {Function} interceptor The function to invoke.
  27225. * @returns {*} Returns the result of `interceptor`.
  27226. * @example
  27227. *
  27228. * _(' abc ')
  27229. * .chain()
  27230. * .trim()
  27231. * .thru(function(value) {
  27232. * return [value];
  27233. * })
  27234. * .value();
  27235. * // => ['abc']
  27236. */
  27237. function thru(value, interceptor) {
  27238. return interceptor(value);
  27239. }
  27240. /**
  27241. * This method is the wrapper version of `_.at`.
  27242. *
  27243. * @name at
  27244. * @memberOf _
  27245. * @since 1.0.0
  27246. * @category Seq
  27247. * @param {...(string|string[])} [paths] The property paths to pick.
  27248. * @returns {Object} Returns the new `lodash` wrapper instance.
  27249. * @example
  27250. *
  27251. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27252. *
  27253. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27254. * // => [3, 4]
  27255. */
  27256. var wrapperAt = flatRest(function(paths) {
  27257. var length = paths.length,
  27258. start = length ? paths[0] : 0,
  27259. value = this.__wrapped__,
  27260. interceptor = function(object) { return baseAt(object, paths); };
  27261. if (length > 1 || this.__actions__.length ||
  27262. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27263. return this.thru(interceptor);
  27264. }
  27265. value = value.slice(start, +start + (length ? 1 : 0));
  27266. value.__actions__.push({
  27267. 'func': thru,
  27268. 'args': [interceptor],
  27269. 'thisArg': undefined
  27270. });
  27271. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27272. if (length && !array.length) {
  27273. array.push(undefined);
  27274. }
  27275. return array;
  27276. });
  27277. });
  27278. /**
  27279. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27280. *
  27281. * @name chain
  27282. * @memberOf _
  27283. * @since 0.1.0
  27284. * @category Seq
  27285. * @returns {Object} Returns the new `lodash` wrapper instance.
  27286. * @example
  27287. *
  27288. * var users = [
  27289. * { 'user': 'barney', 'age': 36 },
  27290. * { 'user': 'fred', 'age': 40 }
  27291. * ];
  27292. *
  27293. * // A sequence without explicit chaining.
  27294. * _(users).head();
  27295. * // => { 'user': 'barney', 'age': 36 }
  27296. *
  27297. * // A sequence with explicit chaining.
  27298. * _(users)
  27299. * .chain()
  27300. * .head()
  27301. * .pick('user')
  27302. * .value();
  27303. * // => { 'user': 'barney' }
  27304. */
  27305. function wrapperChain() {
  27306. return chain(this);
  27307. }
  27308. /**
  27309. * Executes the chain sequence and returns the wrapped result.
  27310. *
  27311. * @name commit
  27312. * @memberOf _
  27313. * @since 3.2.0
  27314. * @category Seq
  27315. * @returns {Object} Returns the new `lodash` wrapper instance.
  27316. * @example
  27317. *
  27318. * var array = [1, 2];
  27319. * var wrapped = _(array).push(3);
  27320. *
  27321. * console.log(array);
  27322. * // => [1, 2]
  27323. *
  27324. * wrapped = wrapped.commit();
  27325. * console.log(array);
  27326. * // => [1, 2, 3]
  27327. *
  27328. * wrapped.last();
  27329. * // => 3
  27330. *
  27331. * console.log(array);
  27332. * // => [1, 2, 3]
  27333. */
  27334. function wrapperCommit() {
  27335. return new LodashWrapper(this.value(), this.__chain__);
  27336. }
  27337. /**
  27338. * Gets the next value on a wrapped object following the
  27339. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27340. *
  27341. * @name next
  27342. * @memberOf _
  27343. * @since 4.0.0
  27344. * @category Seq
  27345. * @returns {Object} Returns the next iterator value.
  27346. * @example
  27347. *
  27348. * var wrapped = _([1, 2]);
  27349. *
  27350. * wrapped.next();
  27351. * // => { 'done': false, 'value': 1 }
  27352. *
  27353. * wrapped.next();
  27354. * // => { 'done': false, 'value': 2 }
  27355. *
  27356. * wrapped.next();
  27357. * // => { 'done': true, 'value': undefined }
  27358. */
  27359. function wrapperNext() {
  27360. if (this.__values__ === undefined) {
  27361. this.__values__ = toArray(this.value());
  27362. }
  27363. var done = this.__index__ >= this.__values__.length,
  27364. value = done ? undefined : this.__values__[this.__index__++];
  27365. return { 'done': done, 'value': value };
  27366. }
  27367. /**
  27368. * Enables the wrapper to be iterable.
  27369. *
  27370. * @name Symbol.iterator
  27371. * @memberOf _
  27372. * @since 4.0.0
  27373. * @category Seq
  27374. * @returns {Object} Returns the wrapper object.
  27375. * @example
  27376. *
  27377. * var wrapped = _([1, 2]);
  27378. *
  27379. * wrapped[Symbol.iterator]() === wrapped;
  27380. * // => true
  27381. *
  27382. * Array.from(wrapped);
  27383. * // => [1, 2]
  27384. */
  27385. function wrapperToIterator() {
  27386. return this;
  27387. }
  27388. /**
  27389. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27390. *
  27391. * @name plant
  27392. * @memberOf _
  27393. * @since 3.2.0
  27394. * @category Seq
  27395. * @param {*} value The value to plant.
  27396. * @returns {Object} Returns the new `lodash` wrapper instance.
  27397. * @example
  27398. *
  27399. * function square(n) {
  27400. * return n * n;
  27401. * }
  27402. *
  27403. * var wrapped = _([1, 2]).map(square);
  27404. * var other = wrapped.plant([3, 4]);
  27405. *
  27406. * other.value();
  27407. * // => [9, 16]
  27408. *
  27409. * wrapped.value();
  27410. * // => [1, 4]
  27411. */
  27412. function wrapperPlant(value) {
  27413. var result,
  27414. parent = this;
  27415. while (parent instanceof baseLodash) {
  27416. var clone = wrapperClone(parent);
  27417. clone.__index__ = 0;
  27418. clone.__values__ = undefined;
  27419. if (result) {
  27420. previous.__wrapped__ = clone;
  27421. } else {
  27422. result = clone;
  27423. }
  27424. var previous = clone;
  27425. parent = parent.__wrapped__;
  27426. }
  27427. previous.__wrapped__ = value;
  27428. return result;
  27429. }
  27430. /**
  27431. * This method is the wrapper version of `_.reverse`.
  27432. *
  27433. * **Note:** This method mutates the wrapped array.
  27434. *
  27435. * @name reverse
  27436. * @memberOf _
  27437. * @since 0.1.0
  27438. * @category Seq
  27439. * @returns {Object} Returns the new `lodash` wrapper instance.
  27440. * @example
  27441. *
  27442. * var array = [1, 2, 3];
  27443. *
  27444. * _(array).reverse().value()
  27445. * // => [3, 2, 1]
  27446. *
  27447. * console.log(array);
  27448. * // => [3, 2, 1]
  27449. */
  27450. function wrapperReverse() {
  27451. var value = this.__wrapped__;
  27452. if (value instanceof LazyWrapper) {
  27453. var wrapped = value;
  27454. if (this.__actions__.length) {
  27455. wrapped = new LazyWrapper(this);
  27456. }
  27457. wrapped = wrapped.reverse();
  27458. wrapped.__actions__.push({
  27459. 'func': thru,
  27460. 'args': [reverse],
  27461. 'thisArg': undefined
  27462. });
  27463. return new LodashWrapper(wrapped, this.__chain__);
  27464. }
  27465. return this.thru(reverse);
  27466. }
  27467. /**
  27468. * Executes the chain sequence to resolve the unwrapped value.
  27469. *
  27470. * @name value
  27471. * @memberOf _
  27472. * @since 0.1.0
  27473. * @alias toJSON, valueOf
  27474. * @category Seq
  27475. * @returns {*} Returns the resolved unwrapped value.
  27476. * @example
  27477. *
  27478. * _([1, 2, 3]).value();
  27479. * // => [1, 2, 3]
  27480. */
  27481. function wrapperValue() {
  27482. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27483. }
  27484. /*------------------------------------------------------------------------*/
  27485. /**
  27486. * Creates an object composed of keys generated from the results of running
  27487. * each element of `collection` thru `iteratee`. The corresponding value of
  27488. * each key is the number of times the key was returned by `iteratee`. The
  27489. * iteratee is invoked with one argument: (value).
  27490. *
  27491. * @static
  27492. * @memberOf _
  27493. * @since 0.5.0
  27494. * @category Collection
  27495. * @param {Array|Object} collection The collection to iterate over.
  27496. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27497. * @returns {Object} Returns the composed aggregate object.
  27498. * @example
  27499. *
  27500. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27501. * // => { '4': 1, '6': 2 }
  27502. *
  27503. * // The `_.property` iteratee shorthand.
  27504. * _.countBy(['one', 'two', 'three'], 'length');
  27505. * // => { '3': 2, '5': 1 }
  27506. */
  27507. var countBy = createAggregator(function(result, value, key) {
  27508. if (hasOwnProperty.call(result, key)) {
  27509. ++result[key];
  27510. } else {
  27511. baseAssignValue(result, key, 1);
  27512. }
  27513. });
  27514. /**
  27515. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27516. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27517. * invoked with three arguments: (value, index|key, collection).
  27518. *
  27519. * **Note:** This method returns `true` for
  27520. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27521. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27522. * elements of empty collections.
  27523. *
  27524. * @static
  27525. * @memberOf _
  27526. * @since 0.1.0
  27527. * @category Collection
  27528. * @param {Array|Object} collection The collection to iterate over.
  27529. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27530. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27531. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27532. * else `false`.
  27533. * @example
  27534. *
  27535. * _.every([true, 1, null, 'yes'], Boolean);
  27536. * // => false
  27537. *
  27538. * var users = [
  27539. * { 'user': 'barney', 'age': 36, 'active': false },
  27540. * { 'user': 'fred', 'age': 40, 'active': false }
  27541. * ];
  27542. *
  27543. * // The `_.matches` iteratee shorthand.
  27544. * _.every(users, { 'user': 'barney', 'active': false });
  27545. * // => false
  27546. *
  27547. * // The `_.matchesProperty` iteratee shorthand.
  27548. * _.every(users, ['active', false]);
  27549. * // => true
  27550. *
  27551. * // The `_.property` iteratee shorthand.
  27552. * _.every(users, 'active');
  27553. * // => false
  27554. */
  27555. function every(collection, predicate, guard) {
  27556. var func = isArray(collection) ? arrayEvery : baseEvery;
  27557. if (guard && isIterateeCall(collection, predicate, guard)) {
  27558. predicate = undefined;
  27559. }
  27560. return func(collection, getIteratee(predicate, 3));
  27561. }
  27562. /**
  27563. * Iterates over elements of `collection`, returning an array of all elements
  27564. * `predicate` returns truthy for. The predicate is invoked with three
  27565. * arguments: (value, index|key, collection).
  27566. *
  27567. * **Note:** Unlike `_.remove`, this method returns a new array.
  27568. *
  27569. * @static
  27570. * @memberOf _
  27571. * @since 0.1.0
  27572. * @category Collection
  27573. * @param {Array|Object} collection The collection to iterate over.
  27574. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27575. * @returns {Array} Returns the new filtered array.
  27576. * @see _.reject
  27577. * @example
  27578. *
  27579. * var users = [
  27580. * { 'user': 'barney', 'age': 36, 'active': true },
  27581. * { 'user': 'fred', 'age': 40, 'active': false }
  27582. * ];
  27583. *
  27584. * _.filter(users, function(o) { return !o.active; });
  27585. * // => objects for ['fred']
  27586. *
  27587. * // The `_.matches` iteratee shorthand.
  27588. * _.filter(users, { 'age': 36, 'active': true });
  27589. * // => objects for ['barney']
  27590. *
  27591. * // The `_.matchesProperty` iteratee shorthand.
  27592. * _.filter(users, ['active', false]);
  27593. * // => objects for ['fred']
  27594. *
  27595. * // The `_.property` iteratee shorthand.
  27596. * _.filter(users, 'active');
  27597. * // => objects for ['barney']
  27598. */
  27599. function filter(collection, predicate) {
  27600. var func = isArray(collection) ? arrayFilter : baseFilter;
  27601. return func(collection, getIteratee(predicate, 3));
  27602. }
  27603. /**
  27604. * Iterates over elements of `collection`, returning the first element
  27605. * `predicate` returns truthy for. The predicate is invoked with three
  27606. * arguments: (value, index|key, collection).
  27607. *
  27608. * @static
  27609. * @memberOf _
  27610. * @since 0.1.0
  27611. * @category Collection
  27612. * @param {Array|Object} collection The collection to inspect.
  27613. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27614. * @param {number} [fromIndex=0] The index to search from.
  27615. * @returns {*} Returns the matched element, else `undefined`.
  27616. * @example
  27617. *
  27618. * var users = [
  27619. * { 'user': 'barney', 'age': 36, 'active': true },
  27620. * { 'user': 'fred', 'age': 40, 'active': false },
  27621. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27622. * ];
  27623. *
  27624. * _.find(users, function(o) { return o.age < 40; });
  27625. * // => object for 'barney'
  27626. *
  27627. * // The `_.matches` iteratee shorthand.
  27628. * _.find(users, { 'age': 1, 'active': true });
  27629. * // => object for 'pebbles'
  27630. *
  27631. * // The `_.matchesProperty` iteratee shorthand.
  27632. * _.find(users, ['active', false]);
  27633. * // => object for 'fred'
  27634. *
  27635. * // The `_.property` iteratee shorthand.
  27636. * _.find(users, 'active');
  27637. * // => object for 'barney'
  27638. */
  27639. var find = createFind(findIndex);
  27640. /**
  27641. * This method is like `_.find` except that it iterates over elements of
  27642. * `collection` from right to left.
  27643. *
  27644. * @static
  27645. * @memberOf _
  27646. * @since 2.0.0
  27647. * @category Collection
  27648. * @param {Array|Object} collection The collection to inspect.
  27649. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27650. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27651. * @returns {*} Returns the matched element, else `undefined`.
  27652. * @example
  27653. *
  27654. * _.findLast([1, 2, 3, 4], function(n) {
  27655. * return n % 2 == 1;
  27656. * });
  27657. * // => 3
  27658. */
  27659. var findLast = createFind(findLastIndex);
  27660. /**
  27661. * Creates a flattened array of values by running each element in `collection`
  27662. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27663. * with three arguments: (value, index|key, collection).
  27664. *
  27665. * @static
  27666. * @memberOf _
  27667. * @since 4.0.0
  27668. * @category Collection
  27669. * @param {Array|Object} collection The collection to iterate over.
  27670. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27671. * @returns {Array} Returns the new flattened array.
  27672. * @example
  27673. *
  27674. * function duplicate(n) {
  27675. * return [n, n];
  27676. * }
  27677. *
  27678. * _.flatMap([1, 2], duplicate);
  27679. * // => [1, 1, 2, 2]
  27680. */
  27681. function flatMap(collection, iteratee) {
  27682. return baseFlatten(map(collection, iteratee), 1);
  27683. }
  27684. /**
  27685. * This method is like `_.flatMap` except that it recursively flattens the
  27686. * mapped results.
  27687. *
  27688. * @static
  27689. * @memberOf _
  27690. * @since 4.7.0
  27691. * @category Collection
  27692. * @param {Array|Object} collection The collection to iterate over.
  27693. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27694. * @returns {Array} Returns the new flattened array.
  27695. * @example
  27696. *
  27697. * function duplicate(n) {
  27698. * return [[[n, n]]];
  27699. * }
  27700. *
  27701. * _.flatMapDeep([1, 2], duplicate);
  27702. * // => [1, 1, 2, 2]
  27703. */
  27704. function flatMapDeep(collection, iteratee) {
  27705. return baseFlatten(map(collection, iteratee), INFINITY);
  27706. }
  27707. /**
  27708. * This method is like `_.flatMap` except that it recursively flattens the
  27709. * mapped results up to `depth` times.
  27710. *
  27711. * @static
  27712. * @memberOf _
  27713. * @since 4.7.0
  27714. * @category Collection
  27715. * @param {Array|Object} collection The collection to iterate over.
  27716. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27717. * @param {number} [depth=1] The maximum recursion depth.
  27718. * @returns {Array} Returns the new flattened array.
  27719. * @example
  27720. *
  27721. * function duplicate(n) {
  27722. * return [[[n, n]]];
  27723. * }
  27724. *
  27725. * _.flatMapDepth([1, 2], duplicate, 2);
  27726. * // => [[1, 1], [2, 2]]
  27727. */
  27728. function flatMapDepth(collection, iteratee, depth) {
  27729. depth = depth === undefined ? 1 : toInteger(depth);
  27730. return baseFlatten(map(collection, iteratee), depth);
  27731. }
  27732. /**
  27733. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27734. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27735. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27736. *
  27737. * **Note:** As with other "Collections" methods, objects with a "length"
  27738. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27739. * or `_.forOwn` for object iteration.
  27740. *
  27741. * @static
  27742. * @memberOf _
  27743. * @since 0.1.0
  27744. * @alias each
  27745. * @category Collection
  27746. * @param {Array|Object} collection The collection to iterate over.
  27747. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27748. * @returns {Array|Object} Returns `collection`.
  27749. * @see _.forEachRight
  27750. * @example
  27751. *
  27752. * _.forEach([1, 2], function(value) {
  27753. * console.log(value);
  27754. * });
  27755. * // => Logs `1` then `2`.
  27756. *
  27757. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27758. * console.log(key);
  27759. * });
  27760. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27761. */
  27762. function forEach(collection, iteratee) {
  27763. var func = isArray(collection) ? arrayEach : baseEach;
  27764. return func(collection, getIteratee(iteratee, 3));
  27765. }
  27766. /**
  27767. * This method is like `_.forEach` except that it iterates over elements of
  27768. * `collection` from right to left.
  27769. *
  27770. * @static
  27771. * @memberOf _
  27772. * @since 2.0.0
  27773. * @alias eachRight
  27774. * @category Collection
  27775. * @param {Array|Object} collection The collection to iterate over.
  27776. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27777. * @returns {Array|Object} Returns `collection`.
  27778. * @see _.forEach
  27779. * @example
  27780. *
  27781. * _.forEachRight([1, 2], function(value) {
  27782. * console.log(value);
  27783. * });
  27784. * // => Logs `2` then `1`.
  27785. */
  27786. function forEachRight(collection, iteratee) {
  27787. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27788. return func(collection, getIteratee(iteratee, 3));
  27789. }
  27790. /**
  27791. * Creates an object composed of keys generated from the results of running
  27792. * each element of `collection` thru `iteratee`. The order of grouped values
  27793. * is determined by the order they occur in `collection`. The corresponding
  27794. * value of each key is an array of elements responsible for generating the
  27795. * key. The iteratee is invoked with one argument: (value).
  27796. *
  27797. * @static
  27798. * @memberOf _
  27799. * @since 0.1.0
  27800. * @category Collection
  27801. * @param {Array|Object} collection The collection to iterate over.
  27802. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27803. * @returns {Object} Returns the composed aggregate object.
  27804. * @example
  27805. *
  27806. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27807. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27808. *
  27809. * // The `_.property` iteratee shorthand.
  27810. * _.groupBy(['one', 'two', 'three'], 'length');
  27811. * // => { '3': ['one', 'two'], '5': ['three'] }
  27812. */
  27813. var groupBy = createAggregator(function(result, value, key) {
  27814. if (hasOwnProperty.call(result, key)) {
  27815. result[key].push(value);
  27816. } else {
  27817. baseAssignValue(result, key, [value]);
  27818. }
  27819. });
  27820. /**
  27821. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27822. * checked for a substring of `value`, otherwise
  27823. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27824. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27825. * the offset from the end of `collection`.
  27826. *
  27827. * @static
  27828. * @memberOf _
  27829. * @since 0.1.0
  27830. * @category Collection
  27831. * @param {Array|Object|string} collection The collection to inspect.
  27832. * @param {*} value The value to search for.
  27833. * @param {number} [fromIndex=0] The index to search from.
  27834. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27835. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27836. * @example
  27837. *
  27838. * _.includes([1, 2, 3], 1);
  27839. * // => true
  27840. *
  27841. * _.includes([1, 2, 3], 1, 2);
  27842. * // => false
  27843. *
  27844. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27845. * // => true
  27846. *
  27847. * _.includes('abcd', 'bc');
  27848. * // => true
  27849. */
  27850. function includes(collection, value, fromIndex, guard) {
  27851. collection = isArrayLike(collection) ? collection : values(collection);
  27852. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27853. var length = collection.length;
  27854. if (fromIndex < 0) {
  27855. fromIndex = nativeMax(length + fromIndex, 0);
  27856. }
  27857. return isString(collection)
  27858. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27859. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27860. }
  27861. /**
  27862. * Invokes the method at `path` of each element in `collection`, returning
  27863. * an array of the results of each invoked method. Any additional arguments
  27864. * are provided to each invoked method. If `path` is a function, it's invoked
  27865. * for, and `this` bound to, each element in `collection`.
  27866. *
  27867. * @static
  27868. * @memberOf _
  27869. * @since 4.0.0
  27870. * @category Collection
  27871. * @param {Array|Object} collection The collection to iterate over.
  27872. * @param {Array|Function|string} path The path of the method to invoke or
  27873. * the function invoked per iteration.
  27874. * @param {...*} [args] The arguments to invoke each method with.
  27875. * @returns {Array} Returns the array of results.
  27876. * @example
  27877. *
  27878. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27879. * // => [[1, 5, 7], [1, 2, 3]]
  27880. *
  27881. * _.invokeMap([123, 456], String.prototype.split, '');
  27882. * // => [['1', '2', '3'], ['4', '5', '6']]
  27883. */
  27884. var invokeMap = baseRest(function(collection, path, args) {
  27885. var index = -1,
  27886. isFunc = typeof path == 'function',
  27887. result = isArrayLike(collection) ? Array(collection.length) : [];
  27888. baseEach(collection, function(value) {
  27889. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27890. });
  27891. return result;
  27892. });
  27893. /**
  27894. * Creates an object composed of keys generated from the results of running
  27895. * each element of `collection` thru `iteratee`. The corresponding value of
  27896. * each key is the last element responsible for generating the key. The
  27897. * iteratee is invoked with one argument: (value).
  27898. *
  27899. * @static
  27900. * @memberOf _
  27901. * @since 4.0.0
  27902. * @category Collection
  27903. * @param {Array|Object} collection The collection to iterate over.
  27904. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27905. * @returns {Object} Returns the composed aggregate object.
  27906. * @example
  27907. *
  27908. * var array = [
  27909. * { 'dir': 'left', 'code': 97 },
  27910. * { 'dir': 'right', 'code': 100 }
  27911. * ];
  27912. *
  27913. * _.keyBy(array, function(o) {
  27914. * return String.fromCharCode(o.code);
  27915. * });
  27916. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27917. *
  27918. * _.keyBy(array, 'dir');
  27919. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27920. */
  27921. var keyBy = createAggregator(function(result, value, key) {
  27922. baseAssignValue(result, key, value);
  27923. });
  27924. /**
  27925. * Creates an array of values by running each element in `collection` thru
  27926. * `iteratee`. The iteratee is invoked with three arguments:
  27927. * (value, index|key, collection).
  27928. *
  27929. * Many lodash methods are guarded to work as iteratees for methods like
  27930. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27931. *
  27932. * The guarded methods are:
  27933. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27934. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27935. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27936. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27937. *
  27938. * @static
  27939. * @memberOf _
  27940. * @since 0.1.0
  27941. * @category Collection
  27942. * @param {Array|Object} collection The collection to iterate over.
  27943. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27944. * @returns {Array} Returns the new mapped array.
  27945. * @example
  27946. *
  27947. * function square(n) {
  27948. * return n * n;
  27949. * }
  27950. *
  27951. * _.map([4, 8], square);
  27952. * // => [16, 64]
  27953. *
  27954. * _.map({ 'a': 4, 'b': 8 }, square);
  27955. * // => [16, 64] (iteration order is not guaranteed)
  27956. *
  27957. * var users = [
  27958. * { 'user': 'barney' },
  27959. * { 'user': 'fred' }
  27960. * ];
  27961. *
  27962. * // The `_.property` iteratee shorthand.
  27963. * _.map(users, 'user');
  27964. * // => ['barney', 'fred']
  27965. */
  27966. function map(collection, iteratee) {
  27967. var func = isArray(collection) ? arrayMap : baseMap;
  27968. return func(collection, getIteratee(iteratee, 3));
  27969. }
  27970. /**
  27971. * This method is like `_.sortBy` except that it allows specifying the sort
  27972. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27973. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27974. * descending or "asc" for ascending sort order of corresponding values.
  27975. *
  27976. * @static
  27977. * @memberOf _
  27978. * @since 4.0.0
  27979. * @category Collection
  27980. * @param {Array|Object} collection The collection to iterate over.
  27981. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27982. * The iteratees to sort by.
  27983. * @param {string[]} [orders] The sort orders of `iteratees`.
  27984. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27985. * @returns {Array} Returns the new sorted array.
  27986. * @example
  27987. *
  27988. * var users = [
  27989. * { 'user': 'fred', 'age': 48 },
  27990. * { 'user': 'barney', 'age': 34 },
  27991. * { 'user': 'fred', 'age': 40 },
  27992. * { 'user': 'barney', 'age': 36 }
  27993. * ];
  27994. *
  27995. * // Sort by `user` in ascending order and by `age` in descending order.
  27996. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27997. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27998. */
  27999. function orderBy(collection, iteratees, orders, guard) {
  28000. if (collection == null) {
  28001. return [];
  28002. }
  28003. if (!isArray(iteratees)) {
  28004. iteratees = iteratees == null ? [] : [iteratees];
  28005. }
  28006. orders = guard ? undefined : orders;
  28007. if (!isArray(orders)) {
  28008. orders = orders == null ? [] : [orders];
  28009. }
  28010. return baseOrderBy(collection, iteratees, orders);
  28011. }
  28012. /**
  28013. * Creates an array of elements split into two groups, the first of which
  28014. * contains elements `predicate` returns truthy for, the second of which
  28015. * contains elements `predicate` returns falsey for. The predicate is
  28016. * invoked with one argument: (value).
  28017. *
  28018. * @static
  28019. * @memberOf _
  28020. * @since 3.0.0
  28021. * @category Collection
  28022. * @param {Array|Object} collection The collection to iterate over.
  28023. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28024. * @returns {Array} Returns the array of grouped elements.
  28025. * @example
  28026. *
  28027. * var users = [
  28028. * { 'user': 'barney', 'age': 36, 'active': false },
  28029. * { 'user': 'fred', 'age': 40, 'active': true },
  28030. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28031. * ];
  28032. *
  28033. * _.partition(users, function(o) { return o.active; });
  28034. * // => objects for [['fred'], ['barney', 'pebbles']]
  28035. *
  28036. * // The `_.matches` iteratee shorthand.
  28037. * _.partition(users, { 'age': 1, 'active': false });
  28038. * // => objects for [['pebbles'], ['barney', 'fred']]
  28039. *
  28040. * // The `_.matchesProperty` iteratee shorthand.
  28041. * _.partition(users, ['active', false]);
  28042. * // => objects for [['barney', 'pebbles'], ['fred']]
  28043. *
  28044. * // The `_.property` iteratee shorthand.
  28045. * _.partition(users, 'active');
  28046. * // => objects for [['fred'], ['barney', 'pebbles']]
  28047. */
  28048. var partition = createAggregator(function(result, value, key) {
  28049. result[key ? 0 : 1].push(value);
  28050. }, function() { return [[], []]; });
  28051. /**
  28052. * Reduces `collection` to a value which is the accumulated result of running
  28053. * each element in `collection` thru `iteratee`, where each successive
  28054. * invocation is supplied the return value of the previous. If `accumulator`
  28055. * is not given, the first element of `collection` is used as the initial
  28056. * value. The iteratee is invoked with four arguments:
  28057. * (accumulator, value, index|key, collection).
  28058. *
  28059. * Many lodash methods are guarded to work as iteratees for methods like
  28060. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28061. *
  28062. * The guarded methods are:
  28063. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28064. * and `sortBy`
  28065. *
  28066. * @static
  28067. * @memberOf _
  28068. * @since 0.1.0
  28069. * @category Collection
  28070. * @param {Array|Object} collection The collection to iterate over.
  28071. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28072. * @param {*} [accumulator] The initial value.
  28073. * @returns {*} Returns the accumulated value.
  28074. * @see _.reduceRight
  28075. * @example
  28076. *
  28077. * _.reduce([1, 2], function(sum, n) {
  28078. * return sum + n;
  28079. * }, 0);
  28080. * // => 3
  28081. *
  28082. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28083. * (result[value] || (result[value] = [])).push(key);
  28084. * return result;
  28085. * }, {});
  28086. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28087. */
  28088. function reduce(collection, iteratee, accumulator) {
  28089. var func = isArray(collection) ? arrayReduce : baseReduce,
  28090. initAccum = arguments.length < 3;
  28091. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28092. }
  28093. /**
  28094. * This method is like `_.reduce` except that it iterates over elements of
  28095. * `collection` from right to left.
  28096. *
  28097. * @static
  28098. * @memberOf _
  28099. * @since 0.1.0
  28100. * @category Collection
  28101. * @param {Array|Object} collection The collection to iterate over.
  28102. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28103. * @param {*} [accumulator] The initial value.
  28104. * @returns {*} Returns the accumulated value.
  28105. * @see _.reduce
  28106. * @example
  28107. *
  28108. * var array = [[0, 1], [2, 3], [4, 5]];
  28109. *
  28110. * _.reduceRight(array, function(flattened, other) {
  28111. * return flattened.concat(other);
  28112. * }, []);
  28113. * // => [4, 5, 2, 3, 0, 1]
  28114. */
  28115. function reduceRight(collection, iteratee, accumulator) {
  28116. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28117. initAccum = arguments.length < 3;
  28118. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28119. }
  28120. /**
  28121. * The opposite of `_.filter`; this method returns the elements of `collection`
  28122. * that `predicate` does **not** return truthy for.
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 0.1.0
  28127. * @category Collection
  28128. * @param {Array|Object} collection The collection to iterate over.
  28129. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28130. * @returns {Array} Returns the new filtered array.
  28131. * @see _.filter
  28132. * @example
  28133. *
  28134. * var users = [
  28135. * { 'user': 'barney', 'age': 36, 'active': false },
  28136. * { 'user': 'fred', 'age': 40, 'active': true }
  28137. * ];
  28138. *
  28139. * _.reject(users, function(o) { return !o.active; });
  28140. * // => objects for ['fred']
  28141. *
  28142. * // The `_.matches` iteratee shorthand.
  28143. * _.reject(users, { 'age': 40, 'active': true });
  28144. * // => objects for ['barney']
  28145. *
  28146. * // The `_.matchesProperty` iteratee shorthand.
  28147. * _.reject(users, ['active', false]);
  28148. * // => objects for ['fred']
  28149. *
  28150. * // The `_.property` iteratee shorthand.
  28151. * _.reject(users, 'active');
  28152. * // => objects for ['barney']
  28153. */
  28154. function reject(collection, predicate) {
  28155. var func = isArray(collection) ? arrayFilter : baseFilter;
  28156. return func(collection, negate(getIteratee(predicate, 3)));
  28157. }
  28158. /**
  28159. * Gets a random element from `collection`.
  28160. *
  28161. * @static
  28162. * @memberOf _
  28163. * @since 2.0.0
  28164. * @category Collection
  28165. * @param {Array|Object} collection The collection to sample.
  28166. * @returns {*} Returns the random element.
  28167. * @example
  28168. *
  28169. * _.sample([1, 2, 3, 4]);
  28170. * // => 2
  28171. */
  28172. function sample(collection) {
  28173. var func = isArray(collection) ? arraySample : baseSample;
  28174. return func(collection);
  28175. }
  28176. /**
  28177. * Gets `n` random elements at unique keys from `collection` up to the
  28178. * size of `collection`.
  28179. *
  28180. * @static
  28181. * @memberOf _
  28182. * @since 4.0.0
  28183. * @category Collection
  28184. * @param {Array|Object} collection The collection to sample.
  28185. * @param {number} [n=1] The number of elements to sample.
  28186. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28187. * @returns {Array} Returns the random elements.
  28188. * @example
  28189. *
  28190. * _.sampleSize([1, 2, 3], 2);
  28191. * // => [3, 1]
  28192. *
  28193. * _.sampleSize([1, 2, 3], 4);
  28194. * // => [2, 3, 1]
  28195. */
  28196. function sampleSize(collection, n, guard) {
  28197. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28198. n = 1;
  28199. } else {
  28200. n = toInteger(n);
  28201. }
  28202. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28203. return func(collection, n);
  28204. }
  28205. /**
  28206. * Creates an array of shuffled values, using a version of the
  28207. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28208. *
  28209. * @static
  28210. * @memberOf _
  28211. * @since 0.1.0
  28212. * @category Collection
  28213. * @param {Array|Object} collection The collection to shuffle.
  28214. * @returns {Array} Returns the new shuffled array.
  28215. * @example
  28216. *
  28217. * _.shuffle([1, 2, 3, 4]);
  28218. * // => [4, 1, 3, 2]
  28219. */
  28220. function shuffle(collection) {
  28221. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28222. return func(collection);
  28223. }
  28224. /**
  28225. * Gets the size of `collection` by returning its length for array-like
  28226. * values or the number of own enumerable string keyed properties for objects.
  28227. *
  28228. * @static
  28229. * @memberOf _
  28230. * @since 0.1.0
  28231. * @category Collection
  28232. * @param {Array|Object|string} collection The collection to inspect.
  28233. * @returns {number} Returns the collection size.
  28234. * @example
  28235. *
  28236. * _.size([1, 2, 3]);
  28237. * // => 3
  28238. *
  28239. * _.size({ 'a': 1, 'b': 2 });
  28240. * // => 2
  28241. *
  28242. * _.size('pebbles');
  28243. * // => 7
  28244. */
  28245. function size(collection) {
  28246. if (collection == null) {
  28247. return 0;
  28248. }
  28249. if (isArrayLike(collection)) {
  28250. return isString(collection) ? stringSize(collection) : collection.length;
  28251. }
  28252. var tag = getTag(collection);
  28253. if (tag == mapTag || tag == setTag) {
  28254. return collection.size;
  28255. }
  28256. return baseKeys(collection).length;
  28257. }
  28258. /**
  28259. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28260. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28261. * invoked with three arguments: (value, index|key, collection).
  28262. *
  28263. * @static
  28264. * @memberOf _
  28265. * @since 0.1.0
  28266. * @category Collection
  28267. * @param {Array|Object} collection The collection to iterate over.
  28268. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28269. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28270. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28271. * else `false`.
  28272. * @example
  28273. *
  28274. * _.some([null, 0, 'yes', false], Boolean);
  28275. * // => true
  28276. *
  28277. * var users = [
  28278. * { 'user': 'barney', 'active': true },
  28279. * { 'user': 'fred', 'active': false }
  28280. * ];
  28281. *
  28282. * // The `_.matches` iteratee shorthand.
  28283. * _.some(users, { 'user': 'barney', 'active': false });
  28284. * // => false
  28285. *
  28286. * // The `_.matchesProperty` iteratee shorthand.
  28287. * _.some(users, ['active', false]);
  28288. * // => true
  28289. *
  28290. * // The `_.property` iteratee shorthand.
  28291. * _.some(users, 'active');
  28292. * // => true
  28293. */
  28294. function some(collection, predicate, guard) {
  28295. var func = isArray(collection) ? arraySome : baseSome;
  28296. if (guard && isIterateeCall(collection, predicate, guard)) {
  28297. predicate = undefined;
  28298. }
  28299. return func(collection, getIteratee(predicate, 3));
  28300. }
  28301. /**
  28302. * Creates an array of elements, sorted in ascending order by the results of
  28303. * running each element in a collection thru each iteratee. This method
  28304. * performs a stable sort, that is, it preserves the original sort order of
  28305. * equal elements. The iteratees are invoked with one argument: (value).
  28306. *
  28307. * @static
  28308. * @memberOf _
  28309. * @since 0.1.0
  28310. * @category Collection
  28311. * @param {Array|Object} collection The collection to iterate over.
  28312. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28313. * The iteratees to sort by.
  28314. * @returns {Array} Returns the new sorted array.
  28315. * @example
  28316. *
  28317. * var users = [
  28318. * { 'user': 'fred', 'age': 48 },
  28319. * { 'user': 'barney', 'age': 36 },
  28320. * { 'user': 'fred', 'age': 40 },
  28321. * { 'user': 'barney', 'age': 34 }
  28322. * ];
  28323. *
  28324. * _.sortBy(users, [function(o) { return o.user; }]);
  28325. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28326. *
  28327. * _.sortBy(users, ['user', 'age']);
  28328. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28329. */
  28330. var sortBy = baseRest(function(collection, iteratees) {
  28331. if (collection == null) {
  28332. return [];
  28333. }
  28334. var length = iteratees.length;
  28335. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28336. iteratees = [];
  28337. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28338. iteratees = [iteratees[0]];
  28339. }
  28340. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28341. });
  28342. /*------------------------------------------------------------------------*/
  28343. /**
  28344. * Gets the timestamp of the number of milliseconds that have elapsed since
  28345. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28346. *
  28347. * @static
  28348. * @memberOf _
  28349. * @since 2.4.0
  28350. * @category Date
  28351. * @returns {number} Returns the timestamp.
  28352. * @example
  28353. *
  28354. * _.defer(function(stamp) {
  28355. * console.log(_.now() - stamp);
  28356. * }, _.now());
  28357. * // => Logs the number of milliseconds it took for the deferred invocation.
  28358. */
  28359. var now = ctxNow || function() {
  28360. return root.Date.now();
  28361. };
  28362. /*------------------------------------------------------------------------*/
  28363. /**
  28364. * The opposite of `_.before`; this method creates a function that invokes
  28365. * `func` once it's called `n` or more times.
  28366. *
  28367. * @static
  28368. * @memberOf _
  28369. * @since 0.1.0
  28370. * @category Function
  28371. * @param {number} n The number of calls before `func` is invoked.
  28372. * @param {Function} func The function to restrict.
  28373. * @returns {Function} Returns the new restricted function.
  28374. * @example
  28375. *
  28376. * var saves = ['profile', 'settings'];
  28377. *
  28378. * var done = _.after(saves.length, function() {
  28379. * console.log('done saving!');
  28380. * });
  28381. *
  28382. * _.forEach(saves, function(type) {
  28383. * asyncSave({ 'type': type, 'complete': done });
  28384. * });
  28385. * // => Logs 'done saving!' after the two async saves have completed.
  28386. */
  28387. function after(n, func) {
  28388. if (typeof func != 'function') {
  28389. throw new TypeError(FUNC_ERROR_TEXT);
  28390. }
  28391. n = toInteger(n);
  28392. return function() {
  28393. if (--n < 1) {
  28394. return func.apply(this, arguments);
  28395. }
  28396. };
  28397. }
  28398. /**
  28399. * Creates a function that invokes `func`, with up to `n` arguments,
  28400. * ignoring any additional arguments.
  28401. *
  28402. * @static
  28403. * @memberOf _
  28404. * @since 3.0.0
  28405. * @category Function
  28406. * @param {Function} func The function to cap arguments for.
  28407. * @param {number} [n=func.length] The arity cap.
  28408. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28409. * @returns {Function} Returns the new capped function.
  28410. * @example
  28411. *
  28412. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28413. * // => [6, 8, 10]
  28414. */
  28415. function ary(func, n, guard) {
  28416. n = guard ? undefined : n;
  28417. n = (func && n == null) ? func.length : n;
  28418. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28419. }
  28420. /**
  28421. * Creates a function that invokes `func`, with the `this` binding and arguments
  28422. * of the created function, while it's called less than `n` times. Subsequent
  28423. * calls to the created function return the result of the last `func` invocation.
  28424. *
  28425. * @static
  28426. * @memberOf _
  28427. * @since 3.0.0
  28428. * @category Function
  28429. * @param {number} n The number of calls at which `func` is no longer invoked.
  28430. * @param {Function} func The function to restrict.
  28431. * @returns {Function} Returns the new restricted function.
  28432. * @example
  28433. *
  28434. * jQuery(element).on('click', _.before(5, addContactToList));
  28435. * // => Allows adding up to 4 contacts to the list.
  28436. */
  28437. function before(n, func) {
  28438. var result;
  28439. if (typeof func != 'function') {
  28440. throw new TypeError(FUNC_ERROR_TEXT);
  28441. }
  28442. n = toInteger(n);
  28443. return function() {
  28444. if (--n > 0) {
  28445. result = func.apply(this, arguments);
  28446. }
  28447. if (n <= 1) {
  28448. func = undefined;
  28449. }
  28450. return result;
  28451. };
  28452. }
  28453. /**
  28454. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28455. * and `partials` prepended to the arguments it receives.
  28456. *
  28457. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28458. * may be used as a placeholder for partially applied arguments.
  28459. *
  28460. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28461. * property of bound functions.
  28462. *
  28463. * @static
  28464. * @memberOf _
  28465. * @since 0.1.0
  28466. * @category Function
  28467. * @param {Function} func The function to bind.
  28468. * @param {*} thisArg The `this` binding of `func`.
  28469. * @param {...*} [partials] The arguments to be partially applied.
  28470. * @returns {Function} Returns the new bound function.
  28471. * @example
  28472. *
  28473. * function greet(greeting, punctuation) {
  28474. * return greeting + ' ' + this.user + punctuation;
  28475. * }
  28476. *
  28477. * var object = { 'user': 'fred' };
  28478. *
  28479. * var bound = _.bind(greet, object, 'hi');
  28480. * bound('!');
  28481. * // => 'hi fred!'
  28482. *
  28483. * // Bound with placeholders.
  28484. * var bound = _.bind(greet, object, _, '!');
  28485. * bound('hi');
  28486. * // => 'hi fred!'
  28487. */
  28488. var bind = baseRest(function(func, thisArg, partials) {
  28489. var bitmask = WRAP_BIND_FLAG;
  28490. if (partials.length) {
  28491. var holders = replaceHolders(partials, getHolder(bind));
  28492. bitmask |= WRAP_PARTIAL_FLAG;
  28493. }
  28494. return createWrap(func, bitmask, thisArg, partials, holders);
  28495. });
  28496. /**
  28497. * Creates a function that invokes the method at `object[key]` with `partials`
  28498. * prepended to the arguments it receives.
  28499. *
  28500. * This method differs from `_.bind` by allowing bound functions to reference
  28501. * methods that may be redefined or don't yet exist. See
  28502. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28503. * for more details.
  28504. *
  28505. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28506. * builds, may be used as a placeholder for partially applied arguments.
  28507. *
  28508. * @static
  28509. * @memberOf _
  28510. * @since 0.10.0
  28511. * @category Function
  28512. * @param {Object} object The object to invoke the method on.
  28513. * @param {string} key The key of the method.
  28514. * @param {...*} [partials] The arguments to be partially applied.
  28515. * @returns {Function} Returns the new bound function.
  28516. * @example
  28517. *
  28518. * var object = {
  28519. * 'user': 'fred',
  28520. * 'greet': function(greeting, punctuation) {
  28521. * return greeting + ' ' + this.user + punctuation;
  28522. * }
  28523. * };
  28524. *
  28525. * var bound = _.bindKey(object, 'greet', 'hi');
  28526. * bound('!');
  28527. * // => 'hi fred!'
  28528. *
  28529. * object.greet = function(greeting, punctuation) {
  28530. * return greeting + 'ya ' + this.user + punctuation;
  28531. * };
  28532. *
  28533. * bound('!');
  28534. * // => 'hiya fred!'
  28535. *
  28536. * // Bound with placeholders.
  28537. * var bound = _.bindKey(object, 'greet', _, '!');
  28538. * bound('hi');
  28539. * // => 'hiya fred!'
  28540. */
  28541. var bindKey = baseRest(function(object, key, partials) {
  28542. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28543. if (partials.length) {
  28544. var holders = replaceHolders(partials, getHolder(bindKey));
  28545. bitmask |= WRAP_PARTIAL_FLAG;
  28546. }
  28547. return createWrap(key, bitmask, object, partials, holders);
  28548. });
  28549. /**
  28550. * Creates a function that accepts arguments of `func` and either invokes
  28551. * `func` returning its result, if at least `arity` number of arguments have
  28552. * been provided, or returns a function that accepts the remaining `func`
  28553. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28554. * is not sufficient.
  28555. *
  28556. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28557. * may be used as a placeholder for provided arguments.
  28558. *
  28559. * **Note:** This method doesn't set the "length" property of curried functions.
  28560. *
  28561. * @static
  28562. * @memberOf _
  28563. * @since 2.0.0
  28564. * @category Function
  28565. * @param {Function} func The function to curry.
  28566. * @param {number} [arity=func.length] The arity of `func`.
  28567. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28568. * @returns {Function} Returns the new curried function.
  28569. * @example
  28570. *
  28571. * var abc = function(a, b, c) {
  28572. * return [a, b, c];
  28573. * };
  28574. *
  28575. * var curried = _.curry(abc);
  28576. *
  28577. * curried(1)(2)(3);
  28578. * // => [1, 2, 3]
  28579. *
  28580. * curried(1, 2)(3);
  28581. * // => [1, 2, 3]
  28582. *
  28583. * curried(1, 2, 3);
  28584. * // => [1, 2, 3]
  28585. *
  28586. * // Curried with placeholders.
  28587. * curried(1)(_, 3)(2);
  28588. * // => [1, 2, 3]
  28589. */
  28590. function curry(func, arity, guard) {
  28591. arity = guard ? undefined : arity;
  28592. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28593. result.placeholder = curry.placeholder;
  28594. return result;
  28595. }
  28596. /**
  28597. * This method is like `_.curry` except that arguments are applied to `func`
  28598. * in the manner of `_.partialRight` instead of `_.partial`.
  28599. *
  28600. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28601. * builds, may be used as a placeholder for provided arguments.
  28602. *
  28603. * **Note:** This method doesn't set the "length" property of curried functions.
  28604. *
  28605. * @static
  28606. * @memberOf _
  28607. * @since 3.0.0
  28608. * @category Function
  28609. * @param {Function} func The function to curry.
  28610. * @param {number} [arity=func.length] The arity of `func`.
  28611. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28612. * @returns {Function} Returns the new curried function.
  28613. * @example
  28614. *
  28615. * var abc = function(a, b, c) {
  28616. * return [a, b, c];
  28617. * };
  28618. *
  28619. * var curried = _.curryRight(abc);
  28620. *
  28621. * curried(3)(2)(1);
  28622. * // => [1, 2, 3]
  28623. *
  28624. * curried(2, 3)(1);
  28625. * // => [1, 2, 3]
  28626. *
  28627. * curried(1, 2, 3);
  28628. * // => [1, 2, 3]
  28629. *
  28630. * // Curried with placeholders.
  28631. * curried(3)(1, _)(2);
  28632. * // => [1, 2, 3]
  28633. */
  28634. function curryRight(func, arity, guard) {
  28635. arity = guard ? undefined : arity;
  28636. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28637. result.placeholder = curryRight.placeholder;
  28638. return result;
  28639. }
  28640. /**
  28641. * Creates a debounced function that delays invoking `func` until after `wait`
  28642. * milliseconds have elapsed since the last time the debounced function was
  28643. * invoked. The debounced function comes with a `cancel` method to cancel
  28644. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28645. * Provide `options` to indicate whether `func` should be invoked on the
  28646. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28647. * with the last arguments provided to the debounced function. Subsequent
  28648. * calls to the debounced function return the result of the last `func`
  28649. * invocation.
  28650. *
  28651. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28652. * invoked on the trailing edge of the timeout only if the debounced function
  28653. * is invoked more than once during the `wait` timeout.
  28654. *
  28655. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28656. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28657. *
  28658. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28659. * for details over the differences between `_.debounce` and `_.throttle`.
  28660. *
  28661. * @static
  28662. * @memberOf _
  28663. * @since 0.1.0
  28664. * @category Function
  28665. * @param {Function} func The function to debounce.
  28666. * @param {number} [wait=0] The number of milliseconds to delay.
  28667. * @param {Object} [options={}] The options object.
  28668. * @param {boolean} [options.leading=false]
  28669. * Specify invoking on the leading edge of the timeout.
  28670. * @param {number} [options.maxWait]
  28671. * The maximum time `func` is allowed to be delayed before it's invoked.
  28672. * @param {boolean} [options.trailing=true]
  28673. * Specify invoking on the trailing edge of the timeout.
  28674. * @returns {Function} Returns the new debounced function.
  28675. * @example
  28676. *
  28677. * // Avoid costly calculations while the window size is in flux.
  28678. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28679. *
  28680. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28681. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28682. * 'leading': true,
  28683. * 'trailing': false
  28684. * }));
  28685. *
  28686. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28687. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28688. * var source = new EventSource('/stream');
  28689. * jQuery(source).on('message', debounced);
  28690. *
  28691. * // Cancel the trailing debounced invocation.
  28692. * jQuery(window).on('popstate', debounced.cancel);
  28693. */
  28694. function debounce(func, wait, options) {
  28695. var lastArgs,
  28696. lastThis,
  28697. maxWait,
  28698. result,
  28699. timerId,
  28700. lastCallTime,
  28701. lastInvokeTime = 0,
  28702. leading = false,
  28703. maxing = false,
  28704. trailing = true;
  28705. if (typeof func != 'function') {
  28706. throw new TypeError(FUNC_ERROR_TEXT);
  28707. }
  28708. wait = toNumber(wait) || 0;
  28709. if (isObject(options)) {
  28710. leading = !!options.leading;
  28711. maxing = 'maxWait' in options;
  28712. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28713. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28714. }
  28715. function invokeFunc(time) {
  28716. var args = lastArgs,
  28717. thisArg = lastThis;
  28718. lastArgs = lastThis = undefined;
  28719. lastInvokeTime = time;
  28720. result = func.apply(thisArg, args);
  28721. return result;
  28722. }
  28723. function leadingEdge(time) {
  28724. // Reset any `maxWait` timer.
  28725. lastInvokeTime = time;
  28726. // Start the timer for the trailing edge.
  28727. timerId = setTimeout(timerExpired, wait);
  28728. // Invoke the leading edge.
  28729. return leading ? invokeFunc(time) : result;
  28730. }
  28731. function remainingWait(time) {
  28732. var timeSinceLastCall = time - lastCallTime,
  28733. timeSinceLastInvoke = time - lastInvokeTime,
  28734. timeWaiting = wait - timeSinceLastCall;
  28735. return maxing
  28736. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28737. : timeWaiting;
  28738. }
  28739. function shouldInvoke(time) {
  28740. var timeSinceLastCall = time - lastCallTime,
  28741. timeSinceLastInvoke = time - lastInvokeTime;
  28742. // Either this is the first call, activity has stopped and we're at the
  28743. // trailing edge, the system time has gone backwards and we're treating
  28744. // it as the trailing edge, or we've hit the `maxWait` limit.
  28745. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28746. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28747. }
  28748. function timerExpired() {
  28749. var time = now();
  28750. if (shouldInvoke(time)) {
  28751. return trailingEdge(time);
  28752. }
  28753. // Restart the timer.
  28754. timerId = setTimeout(timerExpired, remainingWait(time));
  28755. }
  28756. function trailingEdge(time) {
  28757. timerId = undefined;
  28758. // Only invoke if we have `lastArgs` which means `func` has been
  28759. // debounced at least once.
  28760. if (trailing && lastArgs) {
  28761. return invokeFunc(time);
  28762. }
  28763. lastArgs = lastThis = undefined;
  28764. return result;
  28765. }
  28766. function cancel() {
  28767. if (timerId !== undefined) {
  28768. clearTimeout(timerId);
  28769. }
  28770. lastInvokeTime = 0;
  28771. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28772. }
  28773. function flush() {
  28774. return timerId === undefined ? result : trailingEdge(now());
  28775. }
  28776. function debounced() {
  28777. var time = now(),
  28778. isInvoking = shouldInvoke(time);
  28779. lastArgs = arguments;
  28780. lastThis = this;
  28781. lastCallTime = time;
  28782. if (isInvoking) {
  28783. if (timerId === undefined) {
  28784. return leadingEdge(lastCallTime);
  28785. }
  28786. if (maxing) {
  28787. // Handle invocations in a tight loop.
  28788. clearTimeout(timerId);
  28789. timerId = setTimeout(timerExpired, wait);
  28790. return invokeFunc(lastCallTime);
  28791. }
  28792. }
  28793. if (timerId === undefined) {
  28794. timerId = setTimeout(timerExpired, wait);
  28795. }
  28796. return result;
  28797. }
  28798. debounced.cancel = cancel;
  28799. debounced.flush = flush;
  28800. return debounced;
  28801. }
  28802. /**
  28803. * Defers invoking the `func` until the current call stack has cleared. Any
  28804. * additional arguments are provided to `func` when it's invoked.
  28805. *
  28806. * @static
  28807. * @memberOf _
  28808. * @since 0.1.0
  28809. * @category Function
  28810. * @param {Function} func The function to defer.
  28811. * @param {...*} [args] The arguments to invoke `func` with.
  28812. * @returns {number} Returns the timer id.
  28813. * @example
  28814. *
  28815. * _.defer(function(text) {
  28816. * console.log(text);
  28817. * }, 'deferred');
  28818. * // => Logs 'deferred' after one millisecond.
  28819. */
  28820. var defer = baseRest(function(func, args) {
  28821. return baseDelay(func, 1, args);
  28822. });
  28823. /**
  28824. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28825. * provided to `func` when it's invoked.
  28826. *
  28827. * @static
  28828. * @memberOf _
  28829. * @since 0.1.0
  28830. * @category Function
  28831. * @param {Function} func The function to delay.
  28832. * @param {number} wait The number of milliseconds to delay invocation.
  28833. * @param {...*} [args] The arguments to invoke `func` with.
  28834. * @returns {number} Returns the timer id.
  28835. * @example
  28836. *
  28837. * _.delay(function(text) {
  28838. * console.log(text);
  28839. * }, 1000, 'later');
  28840. * // => Logs 'later' after one second.
  28841. */
  28842. var delay = baseRest(function(func, wait, args) {
  28843. return baseDelay(func, toNumber(wait) || 0, args);
  28844. });
  28845. /**
  28846. * Creates a function that invokes `func` with arguments reversed.
  28847. *
  28848. * @static
  28849. * @memberOf _
  28850. * @since 4.0.0
  28851. * @category Function
  28852. * @param {Function} func The function to flip arguments for.
  28853. * @returns {Function} Returns the new flipped function.
  28854. * @example
  28855. *
  28856. * var flipped = _.flip(function() {
  28857. * return _.toArray(arguments);
  28858. * });
  28859. *
  28860. * flipped('a', 'b', 'c', 'd');
  28861. * // => ['d', 'c', 'b', 'a']
  28862. */
  28863. function flip(func) {
  28864. return createWrap(func, WRAP_FLIP_FLAG);
  28865. }
  28866. /**
  28867. * Creates a function that memoizes the result of `func`. If `resolver` is
  28868. * provided, it determines the cache key for storing the result based on the
  28869. * arguments provided to the memoized function. By default, the first argument
  28870. * provided to the memoized function is used as the map cache key. The `func`
  28871. * is invoked with the `this` binding of the memoized function.
  28872. *
  28873. * **Note:** The cache is exposed as the `cache` property on the memoized
  28874. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28875. * constructor with one whose instances implement the
  28876. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28877. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28878. *
  28879. * @static
  28880. * @memberOf _
  28881. * @since 0.1.0
  28882. * @category Function
  28883. * @param {Function} func The function to have its output memoized.
  28884. * @param {Function} [resolver] The function to resolve the cache key.
  28885. * @returns {Function} Returns the new memoized function.
  28886. * @example
  28887. *
  28888. * var object = { 'a': 1, 'b': 2 };
  28889. * var other = { 'c': 3, 'd': 4 };
  28890. *
  28891. * var values = _.memoize(_.values);
  28892. * values(object);
  28893. * // => [1, 2]
  28894. *
  28895. * values(other);
  28896. * // => [3, 4]
  28897. *
  28898. * object.a = 2;
  28899. * values(object);
  28900. * // => [1, 2]
  28901. *
  28902. * // Modify the result cache.
  28903. * values.cache.set(object, ['a', 'b']);
  28904. * values(object);
  28905. * // => ['a', 'b']
  28906. *
  28907. * // Replace `_.memoize.Cache`.
  28908. * _.memoize.Cache = WeakMap;
  28909. */
  28910. function memoize(func, resolver) {
  28911. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28912. throw new TypeError(FUNC_ERROR_TEXT);
  28913. }
  28914. var memoized = function() {
  28915. var args = arguments,
  28916. key = resolver ? resolver.apply(this, args) : args[0],
  28917. cache = memoized.cache;
  28918. if (cache.has(key)) {
  28919. return cache.get(key);
  28920. }
  28921. var result = func.apply(this, args);
  28922. memoized.cache = cache.set(key, result) || cache;
  28923. return result;
  28924. };
  28925. memoized.cache = new (memoize.Cache || MapCache);
  28926. return memoized;
  28927. }
  28928. // Expose `MapCache`.
  28929. memoize.Cache = MapCache;
  28930. /**
  28931. * Creates a function that negates the result of the predicate `func`. The
  28932. * `func` predicate is invoked with the `this` binding and arguments of the
  28933. * created function.
  28934. *
  28935. * @static
  28936. * @memberOf _
  28937. * @since 3.0.0
  28938. * @category Function
  28939. * @param {Function} predicate The predicate to negate.
  28940. * @returns {Function} Returns the new negated function.
  28941. * @example
  28942. *
  28943. * function isEven(n) {
  28944. * return n % 2 == 0;
  28945. * }
  28946. *
  28947. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28948. * // => [1, 3, 5]
  28949. */
  28950. function negate(predicate) {
  28951. if (typeof predicate != 'function') {
  28952. throw new TypeError(FUNC_ERROR_TEXT);
  28953. }
  28954. return function() {
  28955. var args = arguments;
  28956. switch (args.length) {
  28957. case 0: return !predicate.call(this);
  28958. case 1: return !predicate.call(this, args[0]);
  28959. case 2: return !predicate.call(this, args[0], args[1]);
  28960. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28961. }
  28962. return !predicate.apply(this, args);
  28963. };
  28964. }
  28965. /**
  28966. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28967. * to the function return the value of the first invocation. The `func` is
  28968. * invoked with the `this` binding and arguments of the created function.
  28969. *
  28970. * @static
  28971. * @memberOf _
  28972. * @since 0.1.0
  28973. * @category Function
  28974. * @param {Function} func The function to restrict.
  28975. * @returns {Function} Returns the new restricted function.
  28976. * @example
  28977. *
  28978. * var initialize = _.once(createApplication);
  28979. * initialize();
  28980. * initialize();
  28981. * // => `createApplication` is invoked once
  28982. */
  28983. function once(func) {
  28984. return before(2, func);
  28985. }
  28986. /**
  28987. * Creates a function that invokes `func` with its arguments transformed.
  28988. *
  28989. * @static
  28990. * @since 4.0.0
  28991. * @memberOf _
  28992. * @category Function
  28993. * @param {Function} func The function to wrap.
  28994. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28995. * The argument transforms.
  28996. * @returns {Function} Returns the new function.
  28997. * @example
  28998. *
  28999. * function doubled(n) {
  29000. * return n * 2;
  29001. * }
  29002. *
  29003. * function square(n) {
  29004. * return n * n;
  29005. * }
  29006. *
  29007. * var func = _.overArgs(function(x, y) {
  29008. * return [x, y];
  29009. * }, [square, doubled]);
  29010. *
  29011. * func(9, 3);
  29012. * // => [81, 6]
  29013. *
  29014. * func(10, 5);
  29015. * // => [100, 10]
  29016. */
  29017. var overArgs = castRest(function(func, transforms) {
  29018. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29019. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29020. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29021. var funcsLength = transforms.length;
  29022. return baseRest(function(args) {
  29023. var index = -1,
  29024. length = nativeMin(args.length, funcsLength);
  29025. while (++index < length) {
  29026. args[index] = transforms[index].call(this, args[index]);
  29027. }
  29028. return apply(func, this, args);
  29029. });
  29030. });
  29031. /**
  29032. * Creates a function that invokes `func` with `partials` prepended to the
  29033. * arguments it receives. This method is like `_.bind` except it does **not**
  29034. * alter the `this` binding.
  29035. *
  29036. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29037. * builds, may be used as a placeholder for partially applied arguments.
  29038. *
  29039. * **Note:** This method doesn't set the "length" property of partially
  29040. * applied functions.
  29041. *
  29042. * @static
  29043. * @memberOf _
  29044. * @since 0.2.0
  29045. * @category Function
  29046. * @param {Function} func The function to partially apply arguments to.
  29047. * @param {...*} [partials] The arguments to be partially applied.
  29048. * @returns {Function} Returns the new partially applied function.
  29049. * @example
  29050. *
  29051. * function greet(greeting, name) {
  29052. * return greeting + ' ' + name;
  29053. * }
  29054. *
  29055. * var sayHelloTo = _.partial(greet, 'hello');
  29056. * sayHelloTo('fred');
  29057. * // => 'hello fred'
  29058. *
  29059. * // Partially applied with placeholders.
  29060. * var greetFred = _.partial(greet, _, 'fred');
  29061. * greetFred('hi');
  29062. * // => 'hi fred'
  29063. */
  29064. var partial = baseRest(function(func, partials) {
  29065. var holders = replaceHolders(partials, getHolder(partial));
  29066. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29067. });
  29068. /**
  29069. * This method is like `_.partial` except that partially applied arguments
  29070. * are appended to the arguments it receives.
  29071. *
  29072. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29073. * builds, may be used as a placeholder for partially applied arguments.
  29074. *
  29075. * **Note:** This method doesn't set the "length" property of partially
  29076. * applied functions.
  29077. *
  29078. * @static
  29079. * @memberOf _
  29080. * @since 1.0.0
  29081. * @category Function
  29082. * @param {Function} func The function to partially apply arguments to.
  29083. * @param {...*} [partials] The arguments to be partially applied.
  29084. * @returns {Function} Returns the new partially applied function.
  29085. * @example
  29086. *
  29087. * function greet(greeting, name) {
  29088. * return greeting + ' ' + name;
  29089. * }
  29090. *
  29091. * var greetFred = _.partialRight(greet, 'fred');
  29092. * greetFred('hi');
  29093. * // => 'hi fred'
  29094. *
  29095. * // Partially applied with placeholders.
  29096. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29097. * sayHelloTo('fred');
  29098. * // => 'hello fred'
  29099. */
  29100. var partialRight = baseRest(function(func, partials) {
  29101. var holders = replaceHolders(partials, getHolder(partialRight));
  29102. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29103. });
  29104. /**
  29105. * Creates a function that invokes `func` with arguments arranged according
  29106. * to the specified `indexes` where the argument value at the first index is
  29107. * provided as the first argument, the argument value at the second index is
  29108. * provided as the second argument, and so on.
  29109. *
  29110. * @static
  29111. * @memberOf _
  29112. * @since 3.0.0
  29113. * @category Function
  29114. * @param {Function} func The function to rearrange arguments for.
  29115. * @param {...(number|number[])} indexes The arranged argument indexes.
  29116. * @returns {Function} Returns the new function.
  29117. * @example
  29118. *
  29119. * var rearged = _.rearg(function(a, b, c) {
  29120. * return [a, b, c];
  29121. * }, [2, 0, 1]);
  29122. *
  29123. * rearged('b', 'c', 'a')
  29124. * // => ['a', 'b', 'c']
  29125. */
  29126. var rearg = flatRest(function(func, indexes) {
  29127. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29128. });
  29129. /**
  29130. * Creates a function that invokes `func` with the `this` binding of the
  29131. * created function and arguments from `start` and beyond provided as
  29132. * an array.
  29133. *
  29134. * **Note:** This method is based on the
  29135. * [rest parameter](https://mdn.io/rest_parameters).
  29136. *
  29137. * @static
  29138. * @memberOf _
  29139. * @since 4.0.0
  29140. * @category Function
  29141. * @param {Function} func The function to apply a rest parameter to.
  29142. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29143. * @returns {Function} Returns the new function.
  29144. * @example
  29145. *
  29146. * var say = _.rest(function(what, names) {
  29147. * return what + ' ' + _.initial(names).join(', ') +
  29148. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29149. * });
  29150. *
  29151. * say('hello', 'fred', 'barney', 'pebbles');
  29152. * // => 'hello fred, barney, & pebbles'
  29153. */
  29154. function rest(func, start) {
  29155. if (typeof func != 'function') {
  29156. throw new TypeError(FUNC_ERROR_TEXT);
  29157. }
  29158. start = start === undefined ? start : toInteger(start);
  29159. return baseRest(func, start);
  29160. }
  29161. /**
  29162. * Creates a function that invokes `func` with the `this` binding of the
  29163. * create function and an array of arguments much like
  29164. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29165. *
  29166. * **Note:** This method is based on the
  29167. * [spread operator](https://mdn.io/spread_operator).
  29168. *
  29169. * @static
  29170. * @memberOf _
  29171. * @since 3.2.0
  29172. * @category Function
  29173. * @param {Function} func The function to spread arguments over.
  29174. * @param {number} [start=0] The start position of the spread.
  29175. * @returns {Function} Returns the new function.
  29176. * @example
  29177. *
  29178. * var say = _.spread(function(who, what) {
  29179. * return who + ' says ' + what;
  29180. * });
  29181. *
  29182. * say(['fred', 'hello']);
  29183. * // => 'fred says hello'
  29184. *
  29185. * var numbers = Promise.all([
  29186. * Promise.resolve(40),
  29187. * Promise.resolve(36)
  29188. * ]);
  29189. *
  29190. * numbers.then(_.spread(function(x, y) {
  29191. * return x + y;
  29192. * }));
  29193. * // => a Promise of 76
  29194. */
  29195. function spread(func, start) {
  29196. if (typeof func != 'function') {
  29197. throw new TypeError(FUNC_ERROR_TEXT);
  29198. }
  29199. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29200. return baseRest(function(args) {
  29201. var array = args[start],
  29202. otherArgs = castSlice(args, 0, start);
  29203. if (array) {
  29204. arrayPush(otherArgs, array);
  29205. }
  29206. return apply(func, this, otherArgs);
  29207. });
  29208. }
  29209. /**
  29210. * Creates a throttled function that only invokes `func` at most once per
  29211. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29212. * method to cancel delayed `func` invocations and a `flush` method to
  29213. * immediately invoke them. Provide `options` to indicate whether `func`
  29214. * should be invoked on the leading and/or trailing edge of the `wait`
  29215. * timeout. The `func` is invoked with the last arguments provided to the
  29216. * throttled function. Subsequent calls to the throttled function return the
  29217. * result of the last `func` invocation.
  29218. *
  29219. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29220. * invoked on the trailing edge of the timeout only if the throttled function
  29221. * is invoked more than once during the `wait` timeout.
  29222. *
  29223. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29224. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29225. *
  29226. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29227. * for details over the differences between `_.throttle` and `_.debounce`.
  29228. *
  29229. * @static
  29230. * @memberOf _
  29231. * @since 0.1.0
  29232. * @category Function
  29233. * @param {Function} func The function to throttle.
  29234. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29235. * @param {Object} [options={}] The options object.
  29236. * @param {boolean} [options.leading=true]
  29237. * Specify invoking on the leading edge of the timeout.
  29238. * @param {boolean} [options.trailing=true]
  29239. * Specify invoking on the trailing edge of the timeout.
  29240. * @returns {Function} Returns the new throttled function.
  29241. * @example
  29242. *
  29243. * // Avoid excessively updating the position while scrolling.
  29244. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29245. *
  29246. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29247. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29248. * jQuery(element).on('click', throttled);
  29249. *
  29250. * // Cancel the trailing throttled invocation.
  29251. * jQuery(window).on('popstate', throttled.cancel);
  29252. */
  29253. function throttle(func, wait, options) {
  29254. var leading = true,
  29255. trailing = true;
  29256. if (typeof func != 'function') {
  29257. throw new TypeError(FUNC_ERROR_TEXT);
  29258. }
  29259. if (isObject(options)) {
  29260. leading = 'leading' in options ? !!options.leading : leading;
  29261. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29262. }
  29263. return debounce(func, wait, {
  29264. 'leading': leading,
  29265. 'maxWait': wait,
  29266. 'trailing': trailing
  29267. });
  29268. }
  29269. /**
  29270. * Creates a function that accepts up to one argument, ignoring any
  29271. * additional arguments.
  29272. *
  29273. * @static
  29274. * @memberOf _
  29275. * @since 4.0.0
  29276. * @category Function
  29277. * @param {Function} func The function to cap arguments for.
  29278. * @returns {Function} Returns the new capped function.
  29279. * @example
  29280. *
  29281. * _.map(['6', '8', '10'], _.unary(parseInt));
  29282. * // => [6, 8, 10]
  29283. */
  29284. function unary(func) {
  29285. return ary(func, 1);
  29286. }
  29287. /**
  29288. * Creates a function that provides `value` to `wrapper` as its first
  29289. * argument. Any additional arguments provided to the function are appended
  29290. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29291. * binding of the created function.
  29292. *
  29293. * @static
  29294. * @memberOf _
  29295. * @since 0.1.0
  29296. * @category Function
  29297. * @param {*} value The value to wrap.
  29298. * @param {Function} [wrapper=identity] The wrapper function.
  29299. * @returns {Function} Returns the new function.
  29300. * @example
  29301. *
  29302. * var p = _.wrap(_.escape, function(func, text) {
  29303. * return '<p>' + func(text) + '</p>';
  29304. * });
  29305. *
  29306. * p('fred, barney, & pebbles');
  29307. * // => '<p>fred, barney, &amp; pebbles</p>'
  29308. */
  29309. function wrap(value, wrapper) {
  29310. return partial(castFunction(wrapper), value);
  29311. }
  29312. /*------------------------------------------------------------------------*/
  29313. /**
  29314. * Casts `value` as an array if it's not one.
  29315. *
  29316. * @static
  29317. * @memberOf _
  29318. * @since 4.4.0
  29319. * @category Lang
  29320. * @param {*} value The value to inspect.
  29321. * @returns {Array} Returns the cast array.
  29322. * @example
  29323. *
  29324. * _.castArray(1);
  29325. * // => [1]
  29326. *
  29327. * _.castArray({ 'a': 1 });
  29328. * // => [{ 'a': 1 }]
  29329. *
  29330. * _.castArray('abc');
  29331. * // => ['abc']
  29332. *
  29333. * _.castArray(null);
  29334. * // => [null]
  29335. *
  29336. * _.castArray(undefined);
  29337. * // => [undefined]
  29338. *
  29339. * _.castArray();
  29340. * // => []
  29341. *
  29342. * var array = [1, 2, 3];
  29343. * console.log(_.castArray(array) === array);
  29344. * // => true
  29345. */
  29346. function castArray() {
  29347. if (!arguments.length) {
  29348. return [];
  29349. }
  29350. var value = arguments[0];
  29351. return isArray(value) ? value : [value];
  29352. }
  29353. /**
  29354. * Creates a shallow clone of `value`.
  29355. *
  29356. * **Note:** This method is loosely based on the
  29357. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29358. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29359. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29360. * arrays. The own enumerable properties of `arguments` objects are cloned
  29361. * as plain objects. An empty object is returned for uncloneable values such
  29362. * as error objects, functions, DOM nodes, and WeakMaps.
  29363. *
  29364. * @static
  29365. * @memberOf _
  29366. * @since 0.1.0
  29367. * @category Lang
  29368. * @param {*} value The value to clone.
  29369. * @returns {*} Returns the cloned value.
  29370. * @see _.cloneDeep
  29371. * @example
  29372. *
  29373. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29374. *
  29375. * var shallow = _.clone(objects);
  29376. * console.log(shallow[0] === objects[0]);
  29377. * // => true
  29378. */
  29379. function clone(value) {
  29380. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29381. }
  29382. /**
  29383. * This method is like `_.clone` except that it accepts `customizer` which
  29384. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29385. * cloning is handled by the method instead. The `customizer` is invoked with
  29386. * up to four arguments; (value [, index|key, object, stack]).
  29387. *
  29388. * @static
  29389. * @memberOf _
  29390. * @since 4.0.0
  29391. * @category Lang
  29392. * @param {*} value The value to clone.
  29393. * @param {Function} [customizer] The function to customize cloning.
  29394. * @returns {*} Returns the cloned value.
  29395. * @see _.cloneDeepWith
  29396. * @example
  29397. *
  29398. * function customizer(value) {
  29399. * if (_.isElement(value)) {
  29400. * return value.cloneNode(false);
  29401. * }
  29402. * }
  29403. *
  29404. * var el = _.cloneWith(document.body, customizer);
  29405. *
  29406. * console.log(el === document.body);
  29407. * // => false
  29408. * console.log(el.nodeName);
  29409. * // => 'BODY'
  29410. * console.log(el.childNodes.length);
  29411. * // => 0
  29412. */
  29413. function cloneWith(value, customizer) {
  29414. customizer = typeof customizer == 'function' ? customizer : undefined;
  29415. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29416. }
  29417. /**
  29418. * This method is like `_.clone` except that it recursively clones `value`.
  29419. *
  29420. * @static
  29421. * @memberOf _
  29422. * @since 1.0.0
  29423. * @category Lang
  29424. * @param {*} value The value to recursively clone.
  29425. * @returns {*} Returns the deep cloned value.
  29426. * @see _.clone
  29427. * @example
  29428. *
  29429. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29430. *
  29431. * var deep = _.cloneDeep(objects);
  29432. * console.log(deep[0] === objects[0]);
  29433. * // => false
  29434. */
  29435. function cloneDeep(value) {
  29436. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29437. }
  29438. /**
  29439. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29440. *
  29441. * @static
  29442. * @memberOf _
  29443. * @since 4.0.0
  29444. * @category Lang
  29445. * @param {*} value The value to recursively clone.
  29446. * @param {Function} [customizer] The function to customize cloning.
  29447. * @returns {*} Returns the deep cloned value.
  29448. * @see _.cloneWith
  29449. * @example
  29450. *
  29451. * function customizer(value) {
  29452. * if (_.isElement(value)) {
  29453. * return value.cloneNode(true);
  29454. * }
  29455. * }
  29456. *
  29457. * var el = _.cloneDeepWith(document.body, customizer);
  29458. *
  29459. * console.log(el === document.body);
  29460. * // => false
  29461. * console.log(el.nodeName);
  29462. * // => 'BODY'
  29463. * console.log(el.childNodes.length);
  29464. * // => 20
  29465. */
  29466. function cloneDeepWith(value, customizer) {
  29467. customizer = typeof customizer == 'function' ? customizer : undefined;
  29468. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29469. }
  29470. /**
  29471. * Checks if `object` conforms to `source` by invoking the predicate
  29472. * properties of `source` with the corresponding property values of `object`.
  29473. *
  29474. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29475. * partially applied.
  29476. *
  29477. * @static
  29478. * @memberOf _
  29479. * @since 4.14.0
  29480. * @category Lang
  29481. * @param {Object} object The object to inspect.
  29482. * @param {Object} source The object of property predicates to conform to.
  29483. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29484. * @example
  29485. *
  29486. * var object = { 'a': 1, 'b': 2 };
  29487. *
  29488. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29489. * // => true
  29490. *
  29491. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29492. * // => false
  29493. */
  29494. function conformsTo(object, source) {
  29495. return source == null || baseConformsTo(object, source, keys(source));
  29496. }
  29497. /**
  29498. * Performs a
  29499. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29500. * comparison between two values to determine if they are equivalent.
  29501. *
  29502. * @static
  29503. * @memberOf _
  29504. * @since 4.0.0
  29505. * @category Lang
  29506. * @param {*} value The value to compare.
  29507. * @param {*} other The other value to compare.
  29508. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29509. * @example
  29510. *
  29511. * var object = { 'a': 1 };
  29512. * var other = { 'a': 1 };
  29513. *
  29514. * _.eq(object, object);
  29515. * // => true
  29516. *
  29517. * _.eq(object, other);
  29518. * // => false
  29519. *
  29520. * _.eq('a', 'a');
  29521. * // => true
  29522. *
  29523. * _.eq('a', Object('a'));
  29524. * // => false
  29525. *
  29526. * _.eq(NaN, NaN);
  29527. * // => true
  29528. */
  29529. function eq(value, other) {
  29530. return value === other || (value !== value && other !== other);
  29531. }
  29532. /**
  29533. * Checks if `value` is greater than `other`.
  29534. *
  29535. * @static
  29536. * @memberOf _
  29537. * @since 3.9.0
  29538. * @category Lang
  29539. * @param {*} value The value to compare.
  29540. * @param {*} other The other value to compare.
  29541. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29542. * else `false`.
  29543. * @see _.lt
  29544. * @example
  29545. *
  29546. * _.gt(3, 1);
  29547. * // => true
  29548. *
  29549. * _.gt(3, 3);
  29550. * // => false
  29551. *
  29552. * _.gt(1, 3);
  29553. * // => false
  29554. */
  29555. var gt = createRelationalOperation(baseGt);
  29556. /**
  29557. * Checks if `value` is greater than or equal to `other`.
  29558. *
  29559. * @static
  29560. * @memberOf _
  29561. * @since 3.9.0
  29562. * @category Lang
  29563. * @param {*} value The value to compare.
  29564. * @param {*} other The other value to compare.
  29565. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29566. * `other`, else `false`.
  29567. * @see _.lte
  29568. * @example
  29569. *
  29570. * _.gte(3, 1);
  29571. * // => true
  29572. *
  29573. * _.gte(3, 3);
  29574. * // => true
  29575. *
  29576. * _.gte(1, 3);
  29577. * // => false
  29578. */
  29579. var gte = createRelationalOperation(function(value, other) {
  29580. return value >= other;
  29581. });
  29582. /**
  29583. * Checks if `value` is likely an `arguments` object.
  29584. *
  29585. * @static
  29586. * @memberOf _
  29587. * @since 0.1.0
  29588. * @category Lang
  29589. * @param {*} value The value to check.
  29590. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29591. * else `false`.
  29592. * @example
  29593. *
  29594. * _.isArguments(function() { return arguments; }());
  29595. * // => true
  29596. *
  29597. * _.isArguments([1, 2, 3]);
  29598. * // => false
  29599. */
  29600. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29601. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29602. !propertyIsEnumerable.call(value, 'callee');
  29603. };
  29604. /**
  29605. * Checks if `value` is classified as an `Array` object.
  29606. *
  29607. * @static
  29608. * @memberOf _
  29609. * @since 0.1.0
  29610. * @category Lang
  29611. * @param {*} value The value to check.
  29612. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29613. * @example
  29614. *
  29615. * _.isArray([1, 2, 3]);
  29616. * // => true
  29617. *
  29618. * _.isArray(document.body.children);
  29619. * // => false
  29620. *
  29621. * _.isArray('abc');
  29622. * // => false
  29623. *
  29624. * _.isArray(_.noop);
  29625. * // => false
  29626. */
  29627. var isArray = Array.isArray;
  29628. /**
  29629. * Checks if `value` is classified as an `ArrayBuffer` object.
  29630. *
  29631. * @static
  29632. * @memberOf _
  29633. * @since 4.3.0
  29634. * @category Lang
  29635. * @param {*} value The value to check.
  29636. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29637. * @example
  29638. *
  29639. * _.isArrayBuffer(new ArrayBuffer(2));
  29640. * // => true
  29641. *
  29642. * _.isArrayBuffer(new Array(2));
  29643. * // => false
  29644. */
  29645. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29646. /**
  29647. * Checks if `value` is array-like. A value is considered array-like if it's
  29648. * not a function and has a `value.length` that's an integer greater than or
  29649. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29650. *
  29651. * @static
  29652. * @memberOf _
  29653. * @since 4.0.0
  29654. * @category Lang
  29655. * @param {*} value The value to check.
  29656. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29657. * @example
  29658. *
  29659. * _.isArrayLike([1, 2, 3]);
  29660. * // => true
  29661. *
  29662. * _.isArrayLike(document.body.children);
  29663. * // => true
  29664. *
  29665. * _.isArrayLike('abc');
  29666. * // => true
  29667. *
  29668. * _.isArrayLike(_.noop);
  29669. * // => false
  29670. */
  29671. function isArrayLike(value) {
  29672. return value != null && isLength(value.length) && !isFunction(value);
  29673. }
  29674. /**
  29675. * This method is like `_.isArrayLike` except that it also checks if `value`
  29676. * is an object.
  29677. *
  29678. * @static
  29679. * @memberOf _
  29680. * @since 4.0.0
  29681. * @category Lang
  29682. * @param {*} value The value to check.
  29683. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29684. * else `false`.
  29685. * @example
  29686. *
  29687. * _.isArrayLikeObject([1, 2, 3]);
  29688. * // => true
  29689. *
  29690. * _.isArrayLikeObject(document.body.children);
  29691. * // => true
  29692. *
  29693. * _.isArrayLikeObject('abc');
  29694. * // => false
  29695. *
  29696. * _.isArrayLikeObject(_.noop);
  29697. * // => false
  29698. */
  29699. function isArrayLikeObject(value) {
  29700. return isObjectLike(value) && isArrayLike(value);
  29701. }
  29702. /**
  29703. * Checks if `value` is classified as a boolean primitive or object.
  29704. *
  29705. * @static
  29706. * @memberOf _
  29707. * @since 0.1.0
  29708. * @category Lang
  29709. * @param {*} value The value to check.
  29710. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29711. * @example
  29712. *
  29713. * _.isBoolean(false);
  29714. * // => true
  29715. *
  29716. * _.isBoolean(null);
  29717. * // => false
  29718. */
  29719. function isBoolean(value) {
  29720. return value === true || value === false ||
  29721. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29722. }
  29723. /**
  29724. * Checks if `value` is a buffer.
  29725. *
  29726. * @static
  29727. * @memberOf _
  29728. * @since 4.3.0
  29729. * @category Lang
  29730. * @param {*} value The value to check.
  29731. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29732. * @example
  29733. *
  29734. * _.isBuffer(new Buffer(2));
  29735. * // => true
  29736. *
  29737. * _.isBuffer(new Uint8Array(2));
  29738. * // => false
  29739. */
  29740. var isBuffer = nativeIsBuffer || stubFalse;
  29741. /**
  29742. * Checks if `value` is classified as a `Date` object.
  29743. *
  29744. * @static
  29745. * @memberOf _
  29746. * @since 0.1.0
  29747. * @category Lang
  29748. * @param {*} value The value to check.
  29749. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29750. * @example
  29751. *
  29752. * _.isDate(new Date);
  29753. * // => true
  29754. *
  29755. * _.isDate('Mon April 23 2012');
  29756. * // => false
  29757. */
  29758. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29759. /**
  29760. * Checks if `value` is likely a DOM element.
  29761. *
  29762. * @static
  29763. * @memberOf _
  29764. * @since 0.1.0
  29765. * @category Lang
  29766. * @param {*} value The value to check.
  29767. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29768. * @example
  29769. *
  29770. * _.isElement(document.body);
  29771. * // => true
  29772. *
  29773. * _.isElement('<body>');
  29774. * // => false
  29775. */
  29776. function isElement(value) {
  29777. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29778. }
  29779. /**
  29780. * Checks if `value` is an empty object, collection, map, or set.
  29781. *
  29782. * Objects are considered empty if they have no own enumerable string keyed
  29783. * properties.
  29784. *
  29785. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29786. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29787. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29788. *
  29789. * @static
  29790. * @memberOf _
  29791. * @since 0.1.0
  29792. * @category Lang
  29793. * @param {*} value The value to check.
  29794. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29795. * @example
  29796. *
  29797. * _.isEmpty(null);
  29798. * // => true
  29799. *
  29800. * _.isEmpty(true);
  29801. * // => true
  29802. *
  29803. * _.isEmpty(1);
  29804. * // => true
  29805. *
  29806. * _.isEmpty([1, 2, 3]);
  29807. * // => false
  29808. *
  29809. * _.isEmpty({ 'a': 1 });
  29810. * // => false
  29811. */
  29812. function isEmpty(value) {
  29813. if (value == null) {
  29814. return true;
  29815. }
  29816. if (isArrayLike(value) &&
  29817. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29818. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29819. return !value.length;
  29820. }
  29821. var tag = getTag(value);
  29822. if (tag == mapTag || tag == setTag) {
  29823. return !value.size;
  29824. }
  29825. if (isPrototype(value)) {
  29826. return !baseKeys(value).length;
  29827. }
  29828. for (var key in value) {
  29829. if (hasOwnProperty.call(value, key)) {
  29830. return false;
  29831. }
  29832. }
  29833. return true;
  29834. }
  29835. /**
  29836. * Performs a deep comparison between two values to determine if they are
  29837. * equivalent.
  29838. *
  29839. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29840. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29841. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29842. * by their own, not inherited, enumerable properties. Functions and DOM
  29843. * nodes are compared by strict equality, i.e. `===`.
  29844. *
  29845. * @static
  29846. * @memberOf _
  29847. * @since 0.1.0
  29848. * @category Lang
  29849. * @param {*} value The value to compare.
  29850. * @param {*} other The other value to compare.
  29851. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29852. * @example
  29853. *
  29854. * var object = { 'a': 1 };
  29855. * var other = { 'a': 1 };
  29856. *
  29857. * _.isEqual(object, other);
  29858. * // => true
  29859. *
  29860. * object === other;
  29861. * // => false
  29862. */
  29863. function isEqual(value, other) {
  29864. return baseIsEqual(value, other);
  29865. }
  29866. /**
  29867. * This method is like `_.isEqual` except that it accepts `customizer` which
  29868. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29869. * are handled by the method instead. The `customizer` is invoked with up to
  29870. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29871. *
  29872. * @static
  29873. * @memberOf _
  29874. * @since 4.0.0
  29875. * @category Lang
  29876. * @param {*} value The value to compare.
  29877. * @param {*} other The other value to compare.
  29878. * @param {Function} [customizer] The function to customize comparisons.
  29879. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29880. * @example
  29881. *
  29882. * function isGreeting(value) {
  29883. * return /^h(?:i|ello)$/.test(value);
  29884. * }
  29885. *
  29886. * function customizer(objValue, othValue) {
  29887. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29888. * return true;
  29889. * }
  29890. * }
  29891. *
  29892. * var array = ['hello', 'goodbye'];
  29893. * var other = ['hi', 'goodbye'];
  29894. *
  29895. * _.isEqualWith(array, other, customizer);
  29896. * // => true
  29897. */
  29898. function isEqualWith(value, other, customizer) {
  29899. customizer = typeof customizer == 'function' ? customizer : undefined;
  29900. var result = customizer ? customizer(value, other) : undefined;
  29901. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29902. }
  29903. /**
  29904. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29905. * `SyntaxError`, `TypeError`, or `URIError` object.
  29906. *
  29907. * @static
  29908. * @memberOf _
  29909. * @since 3.0.0
  29910. * @category Lang
  29911. * @param {*} value The value to check.
  29912. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29913. * @example
  29914. *
  29915. * _.isError(new Error);
  29916. * // => true
  29917. *
  29918. * _.isError(Error);
  29919. * // => false
  29920. */
  29921. function isError(value) {
  29922. if (!isObjectLike(value)) {
  29923. return false;
  29924. }
  29925. var tag = baseGetTag(value);
  29926. return tag == errorTag || tag == domExcTag ||
  29927. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29928. }
  29929. /**
  29930. * Checks if `value` is a finite primitive number.
  29931. *
  29932. * **Note:** This method is based on
  29933. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29934. *
  29935. * @static
  29936. * @memberOf _
  29937. * @since 0.1.0
  29938. * @category Lang
  29939. * @param {*} value The value to check.
  29940. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29941. * @example
  29942. *
  29943. * _.isFinite(3);
  29944. * // => true
  29945. *
  29946. * _.isFinite(Number.MIN_VALUE);
  29947. * // => true
  29948. *
  29949. * _.isFinite(Infinity);
  29950. * // => false
  29951. *
  29952. * _.isFinite('3');
  29953. * // => false
  29954. */
  29955. function isFinite(value) {
  29956. return typeof value == 'number' && nativeIsFinite(value);
  29957. }
  29958. /**
  29959. * Checks if `value` is classified as a `Function` object.
  29960. *
  29961. * @static
  29962. * @memberOf _
  29963. * @since 0.1.0
  29964. * @category Lang
  29965. * @param {*} value The value to check.
  29966. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29967. * @example
  29968. *
  29969. * _.isFunction(_);
  29970. * // => true
  29971. *
  29972. * _.isFunction(/abc/);
  29973. * // => false
  29974. */
  29975. function isFunction(value) {
  29976. if (!isObject(value)) {
  29977. return false;
  29978. }
  29979. // The use of `Object#toString` avoids issues with the `typeof` operator
  29980. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29981. var tag = baseGetTag(value);
  29982. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29983. }
  29984. /**
  29985. * Checks if `value` is an integer.
  29986. *
  29987. * **Note:** This method is based on
  29988. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29989. *
  29990. * @static
  29991. * @memberOf _
  29992. * @since 4.0.0
  29993. * @category Lang
  29994. * @param {*} value The value to check.
  29995. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29996. * @example
  29997. *
  29998. * _.isInteger(3);
  29999. * // => true
  30000. *
  30001. * _.isInteger(Number.MIN_VALUE);
  30002. * // => false
  30003. *
  30004. * _.isInteger(Infinity);
  30005. * // => false
  30006. *
  30007. * _.isInteger('3');
  30008. * // => false
  30009. */
  30010. function isInteger(value) {
  30011. return typeof value == 'number' && value == toInteger(value);
  30012. }
  30013. /**
  30014. * Checks if `value` is a valid array-like length.
  30015. *
  30016. * **Note:** This method is loosely based on
  30017. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30018. *
  30019. * @static
  30020. * @memberOf _
  30021. * @since 4.0.0
  30022. * @category Lang
  30023. * @param {*} value The value to check.
  30024. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30025. * @example
  30026. *
  30027. * _.isLength(3);
  30028. * // => true
  30029. *
  30030. * _.isLength(Number.MIN_VALUE);
  30031. * // => false
  30032. *
  30033. * _.isLength(Infinity);
  30034. * // => false
  30035. *
  30036. * _.isLength('3');
  30037. * // => false
  30038. */
  30039. function isLength(value) {
  30040. return typeof value == 'number' &&
  30041. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30042. }
  30043. /**
  30044. * Checks if `value` is the
  30045. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30046. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30047. *
  30048. * @static
  30049. * @memberOf _
  30050. * @since 0.1.0
  30051. * @category Lang
  30052. * @param {*} value The value to check.
  30053. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30054. * @example
  30055. *
  30056. * _.isObject({});
  30057. * // => true
  30058. *
  30059. * _.isObject([1, 2, 3]);
  30060. * // => true
  30061. *
  30062. * _.isObject(_.noop);
  30063. * // => true
  30064. *
  30065. * _.isObject(null);
  30066. * // => false
  30067. */
  30068. function isObject(value) {
  30069. var type = typeof value;
  30070. return value != null && (type == 'object' || type == 'function');
  30071. }
  30072. /**
  30073. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30074. * and has a `typeof` result of "object".
  30075. *
  30076. * @static
  30077. * @memberOf _
  30078. * @since 4.0.0
  30079. * @category Lang
  30080. * @param {*} value The value to check.
  30081. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30082. * @example
  30083. *
  30084. * _.isObjectLike({});
  30085. * // => true
  30086. *
  30087. * _.isObjectLike([1, 2, 3]);
  30088. * // => true
  30089. *
  30090. * _.isObjectLike(_.noop);
  30091. * // => false
  30092. *
  30093. * _.isObjectLike(null);
  30094. * // => false
  30095. */
  30096. function isObjectLike(value) {
  30097. return value != null && typeof value == 'object';
  30098. }
  30099. /**
  30100. * Checks if `value` is classified as a `Map` object.
  30101. *
  30102. * @static
  30103. * @memberOf _
  30104. * @since 4.3.0
  30105. * @category Lang
  30106. * @param {*} value The value to check.
  30107. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30108. * @example
  30109. *
  30110. * _.isMap(new Map);
  30111. * // => true
  30112. *
  30113. * _.isMap(new WeakMap);
  30114. * // => false
  30115. */
  30116. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30117. /**
  30118. * Performs a partial deep comparison between `object` and `source` to
  30119. * determine if `object` contains equivalent property values.
  30120. *
  30121. * **Note:** This method is equivalent to `_.matches` when `source` is
  30122. * partially applied.
  30123. *
  30124. * Partial comparisons will match empty array and empty object `source`
  30125. * values against any array or object value, respectively. See `_.isEqual`
  30126. * for a list of supported value comparisons.
  30127. *
  30128. * @static
  30129. * @memberOf _
  30130. * @since 3.0.0
  30131. * @category Lang
  30132. * @param {Object} object The object to inspect.
  30133. * @param {Object} source The object of property values to match.
  30134. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30135. * @example
  30136. *
  30137. * var object = { 'a': 1, 'b': 2 };
  30138. *
  30139. * _.isMatch(object, { 'b': 2 });
  30140. * // => true
  30141. *
  30142. * _.isMatch(object, { 'b': 1 });
  30143. * // => false
  30144. */
  30145. function isMatch(object, source) {
  30146. return object === source || baseIsMatch(object, source, getMatchData(source));
  30147. }
  30148. /**
  30149. * This method is like `_.isMatch` except that it accepts `customizer` which
  30150. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30151. * are handled by the method instead. The `customizer` is invoked with five
  30152. * arguments: (objValue, srcValue, index|key, object, source).
  30153. *
  30154. * @static
  30155. * @memberOf _
  30156. * @since 4.0.0
  30157. * @category Lang
  30158. * @param {Object} object The object to inspect.
  30159. * @param {Object} source The object of property values to match.
  30160. * @param {Function} [customizer] The function to customize comparisons.
  30161. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30162. * @example
  30163. *
  30164. * function isGreeting(value) {
  30165. * return /^h(?:i|ello)$/.test(value);
  30166. * }
  30167. *
  30168. * function customizer(objValue, srcValue) {
  30169. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30170. * return true;
  30171. * }
  30172. * }
  30173. *
  30174. * var object = { 'greeting': 'hello' };
  30175. * var source = { 'greeting': 'hi' };
  30176. *
  30177. * _.isMatchWith(object, source, customizer);
  30178. * // => true
  30179. */
  30180. function isMatchWith(object, source, customizer) {
  30181. customizer = typeof customizer == 'function' ? customizer : undefined;
  30182. return baseIsMatch(object, source, getMatchData(source), customizer);
  30183. }
  30184. /**
  30185. * Checks if `value` is `NaN`.
  30186. *
  30187. * **Note:** This method is based on
  30188. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30189. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30190. * `undefined` and other non-number values.
  30191. *
  30192. * @static
  30193. * @memberOf _
  30194. * @since 0.1.0
  30195. * @category Lang
  30196. * @param {*} value The value to check.
  30197. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30198. * @example
  30199. *
  30200. * _.isNaN(NaN);
  30201. * // => true
  30202. *
  30203. * _.isNaN(new Number(NaN));
  30204. * // => true
  30205. *
  30206. * isNaN(undefined);
  30207. * // => true
  30208. *
  30209. * _.isNaN(undefined);
  30210. * // => false
  30211. */
  30212. function isNaN(value) {
  30213. // An `NaN` primitive is the only value that is not equal to itself.
  30214. // Perform the `toStringTag` check first to avoid errors with some
  30215. // ActiveX objects in IE.
  30216. return isNumber(value) && value != +value;
  30217. }
  30218. /**
  30219. * Checks if `value` is a pristine native function.
  30220. *
  30221. * **Note:** This method can't reliably detect native functions in the presence
  30222. * of the core-js package because core-js circumvents this kind of detection.
  30223. * Despite multiple requests, the core-js maintainer has made it clear: any
  30224. * attempt to fix the detection will be obstructed. As a result, we're left
  30225. * with little choice but to throw an error. Unfortunately, this also affects
  30226. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30227. * which rely on core-js.
  30228. *
  30229. * @static
  30230. * @memberOf _
  30231. * @since 3.0.0
  30232. * @category Lang
  30233. * @param {*} value The value to check.
  30234. * @returns {boolean} Returns `true` if `value` is a native function,
  30235. * else `false`.
  30236. * @example
  30237. *
  30238. * _.isNative(Array.prototype.push);
  30239. * // => true
  30240. *
  30241. * _.isNative(_);
  30242. * // => false
  30243. */
  30244. function isNative(value) {
  30245. if (isMaskable(value)) {
  30246. throw new Error(CORE_ERROR_TEXT);
  30247. }
  30248. return baseIsNative(value);
  30249. }
  30250. /**
  30251. * Checks if `value` is `null`.
  30252. *
  30253. * @static
  30254. * @memberOf _
  30255. * @since 0.1.0
  30256. * @category Lang
  30257. * @param {*} value The value to check.
  30258. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30259. * @example
  30260. *
  30261. * _.isNull(null);
  30262. * // => true
  30263. *
  30264. * _.isNull(void 0);
  30265. * // => false
  30266. */
  30267. function isNull(value) {
  30268. return value === null;
  30269. }
  30270. /**
  30271. * Checks if `value` is `null` or `undefined`.
  30272. *
  30273. * @static
  30274. * @memberOf _
  30275. * @since 4.0.0
  30276. * @category Lang
  30277. * @param {*} value The value to check.
  30278. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30279. * @example
  30280. *
  30281. * _.isNil(null);
  30282. * // => true
  30283. *
  30284. * _.isNil(void 0);
  30285. * // => true
  30286. *
  30287. * _.isNil(NaN);
  30288. * // => false
  30289. */
  30290. function isNil(value) {
  30291. return value == null;
  30292. }
  30293. /**
  30294. * Checks if `value` is classified as a `Number` primitive or object.
  30295. *
  30296. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30297. * classified as numbers, use the `_.isFinite` method.
  30298. *
  30299. * @static
  30300. * @memberOf _
  30301. * @since 0.1.0
  30302. * @category Lang
  30303. * @param {*} value The value to check.
  30304. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30305. * @example
  30306. *
  30307. * _.isNumber(3);
  30308. * // => true
  30309. *
  30310. * _.isNumber(Number.MIN_VALUE);
  30311. * // => true
  30312. *
  30313. * _.isNumber(Infinity);
  30314. * // => true
  30315. *
  30316. * _.isNumber('3');
  30317. * // => false
  30318. */
  30319. function isNumber(value) {
  30320. return typeof value == 'number' ||
  30321. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30322. }
  30323. /**
  30324. * Checks if `value` is a plain object, that is, an object created by the
  30325. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30326. *
  30327. * @static
  30328. * @memberOf _
  30329. * @since 0.8.0
  30330. * @category Lang
  30331. * @param {*} value The value to check.
  30332. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30333. * @example
  30334. *
  30335. * function Foo() {
  30336. * this.a = 1;
  30337. * }
  30338. *
  30339. * _.isPlainObject(new Foo);
  30340. * // => false
  30341. *
  30342. * _.isPlainObject([1, 2, 3]);
  30343. * // => false
  30344. *
  30345. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30346. * // => true
  30347. *
  30348. * _.isPlainObject(Object.create(null));
  30349. * // => true
  30350. */
  30351. function isPlainObject(value) {
  30352. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30353. return false;
  30354. }
  30355. var proto = getPrototype(value);
  30356. if (proto === null) {
  30357. return true;
  30358. }
  30359. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30360. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30361. funcToString.call(Ctor) == objectCtorString;
  30362. }
  30363. /**
  30364. * Checks if `value` is classified as a `RegExp` object.
  30365. *
  30366. * @static
  30367. * @memberOf _
  30368. * @since 0.1.0
  30369. * @category Lang
  30370. * @param {*} value The value to check.
  30371. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30372. * @example
  30373. *
  30374. * _.isRegExp(/abc/);
  30375. * // => true
  30376. *
  30377. * _.isRegExp('/abc/');
  30378. * // => false
  30379. */
  30380. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30381. /**
  30382. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30383. * double precision number which isn't the result of a rounded unsafe integer.
  30384. *
  30385. * **Note:** This method is based on
  30386. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30387. *
  30388. * @static
  30389. * @memberOf _
  30390. * @since 4.0.0
  30391. * @category Lang
  30392. * @param {*} value The value to check.
  30393. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30394. * @example
  30395. *
  30396. * _.isSafeInteger(3);
  30397. * // => true
  30398. *
  30399. * _.isSafeInteger(Number.MIN_VALUE);
  30400. * // => false
  30401. *
  30402. * _.isSafeInteger(Infinity);
  30403. * // => false
  30404. *
  30405. * _.isSafeInteger('3');
  30406. * // => false
  30407. */
  30408. function isSafeInteger(value) {
  30409. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30410. }
  30411. /**
  30412. * Checks if `value` is classified as a `Set` object.
  30413. *
  30414. * @static
  30415. * @memberOf _
  30416. * @since 4.3.0
  30417. * @category Lang
  30418. * @param {*} value The value to check.
  30419. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30420. * @example
  30421. *
  30422. * _.isSet(new Set);
  30423. * // => true
  30424. *
  30425. * _.isSet(new WeakSet);
  30426. * // => false
  30427. */
  30428. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30429. /**
  30430. * Checks if `value` is classified as a `String` primitive or object.
  30431. *
  30432. * @static
  30433. * @since 0.1.0
  30434. * @memberOf _
  30435. * @category Lang
  30436. * @param {*} value The value to check.
  30437. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30438. * @example
  30439. *
  30440. * _.isString('abc');
  30441. * // => true
  30442. *
  30443. * _.isString(1);
  30444. * // => false
  30445. */
  30446. function isString(value) {
  30447. return typeof value == 'string' ||
  30448. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30449. }
  30450. /**
  30451. * Checks if `value` is classified as a `Symbol` primitive or object.
  30452. *
  30453. * @static
  30454. * @memberOf _
  30455. * @since 4.0.0
  30456. * @category Lang
  30457. * @param {*} value The value to check.
  30458. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30459. * @example
  30460. *
  30461. * _.isSymbol(Symbol.iterator);
  30462. * // => true
  30463. *
  30464. * _.isSymbol('abc');
  30465. * // => false
  30466. */
  30467. function isSymbol(value) {
  30468. return typeof value == 'symbol' ||
  30469. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30470. }
  30471. /**
  30472. * Checks if `value` is classified as a typed array.
  30473. *
  30474. * @static
  30475. * @memberOf _
  30476. * @since 3.0.0
  30477. * @category Lang
  30478. * @param {*} value The value to check.
  30479. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30480. * @example
  30481. *
  30482. * _.isTypedArray(new Uint8Array);
  30483. * // => true
  30484. *
  30485. * _.isTypedArray([]);
  30486. * // => false
  30487. */
  30488. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30489. /**
  30490. * Checks if `value` is `undefined`.
  30491. *
  30492. * @static
  30493. * @since 0.1.0
  30494. * @memberOf _
  30495. * @category Lang
  30496. * @param {*} value The value to check.
  30497. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30498. * @example
  30499. *
  30500. * _.isUndefined(void 0);
  30501. * // => true
  30502. *
  30503. * _.isUndefined(null);
  30504. * // => false
  30505. */
  30506. function isUndefined(value) {
  30507. return value === undefined;
  30508. }
  30509. /**
  30510. * Checks if `value` is classified as a `WeakMap` object.
  30511. *
  30512. * @static
  30513. * @memberOf _
  30514. * @since 4.3.0
  30515. * @category Lang
  30516. * @param {*} value The value to check.
  30517. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30518. * @example
  30519. *
  30520. * _.isWeakMap(new WeakMap);
  30521. * // => true
  30522. *
  30523. * _.isWeakMap(new Map);
  30524. * // => false
  30525. */
  30526. function isWeakMap(value) {
  30527. return isObjectLike(value) && getTag(value) == weakMapTag;
  30528. }
  30529. /**
  30530. * Checks if `value` is classified as a `WeakSet` object.
  30531. *
  30532. * @static
  30533. * @memberOf _
  30534. * @since 4.3.0
  30535. * @category Lang
  30536. * @param {*} value The value to check.
  30537. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30538. * @example
  30539. *
  30540. * _.isWeakSet(new WeakSet);
  30541. * // => true
  30542. *
  30543. * _.isWeakSet(new Set);
  30544. * // => false
  30545. */
  30546. function isWeakSet(value) {
  30547. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30548. }
  30549. /**
  30550. * Checks if `value` is less than `other`.
  30551. *
  30552. * @static
  30553. * @memberOf _
  30554. * @since 3.9.0
  30555. * @category Lang
  30556. * @param {*} value The value to compare.
  30557. * @param {*} other The other value to compare.
  30558. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30559. * else `false`.
  30560. * @see _.gt
  30561. * @example
  30562. *
  30563. * _.lt(1, 3);
  30564. * // => true
  30565. *
  30566. * _.lt(3, 3);
  30567. * // => false
  30568. *
  30569. * _.lt(3, 1);
  30570. * // => false
  30571. */
  30572. var lt = createRelationalOperation(baseLt);
  30573. /**
  30574. * Checks if `value` is less than or equal to `other`.
  30575. *
  30576. * @static
  30577. * @memberOf _
  30578. * @since 3.9.0
  30579. * @category Lang
  30580. * @param {*} value The value to compare.
  30581. * @param {*} other The other value to compare.
  30582. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30583. * `other`, else `false`.
  30584. * @see _.gte
  30585. * @example
  30586. *
  30587. * _.lte(1, 3);
  30588. * // => true
  30589. *
  30590. * _.lte(3, 3);
  30591. * // => true
  30592. *
  30593. * _.lte(3, 1);
  30594. * // => false
  30595. */
  30596. var lte = createRelationalOperation(function(value, other) {
  30597. return value <= other;
  30598. });
  30599. /**
  30600. * Converts `value` to an array.
  30601. *
  30602. * @static
  30603. * @since 0.1.0
  30604. * @memberOf _
  30605. * @category Lang
  30606. * @param {*} value The value to convert.
  30607. * @returns {Array} Returns the converted array.
  30608. * @example
  30609. *
  30610. * _.toArray({ 'a': 1, 'b': 2 });
  30611. * // => [1, 2]
  30612. *
  30613. * _.toArray('abc');
  30614. * // => ['a', 'b', 'c']
  30615. *
  30616. * _.toArray(1);
  30617. * // => []
  30618. *
  30619. * _.toArray(null);
  30620. * // => []
  30621. */
  30622. function toArray(value) {
  30623. if (!value) {
  30624. return [];
  30625. }
  30626. if (isArrayLike(value)) {
  30627. return isString(value) ? stringToArray(value) : copyArray(value);
  30628. }
  30629. if (symIterator && value[symIterator]) {
  30630. return iteratorToArray(value[symIterator]());
  30631. }
  30632. var tag = getTag(value),
  30633. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30634. return func(value);
  30635. }
  30636. /**
  30637. * Converts `value` to a finite number.
  30638. *
  30639. * @static
  30640. * @memberOf _
  30641. * @since 4.12.0
  30642. * @category Lang
  30643. * @param {*} value The value to convert.
  30644. * @returns {number} Returns the converted number.
  30645. * @example
  30646. *
  30647. * _.toFinite(3.2);
  30648. * // => 3.2
  30649. *
  30650. * _.toFinite(Number.MIN_VALUE);
  30651. * // => 5e-324
  30652. *
  30653. * _.toFinite(Infinity);
  30654. * // => 1.7976931348623157e+308
  30655. *
  30656. * _.toFinite('3.2');
  30657. * // => 3.2
  30658. */
  30659. function toFinite(value) {
  30660. if (!value) {
  30661. return value === 0 ? value : 0;
  30662. }
  30663. value = toNumber(value);
  30664. if (value === INFINITY || value === -INFINITY) {
  30665. var sign = (value < 0 ? -1 : 1);
  30666. return sign * MAX_INTEGER;
  30667. }
  30668. return value === value ? value : 0;
  30669. }
  30670. /**
  30671. * Converts `value` to an integer.
  30672. *
  30673. * **Note:** This method is loosely based on
  30674. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30675. *
  30676. * @static
  30677. * @memberOf _
  30678. * @since 4.0.0
  30679. * @category Lang
  30680. * @param {*} value The value to convert.
  30681. * @returns {number} Returns the converted integer.
  30682. * @example
  30683. *
  30684. * _.toInteger(3.2);
  30685. * // => 3
  30686. *
  30687. * _.toInteger(Number.MIN_VALUE);
  30688. * // => 0
  30689. *
  30690. * _.toInteger(Infinity);
  30691. * // => 1.7976931348623157e+308
  30692. *
  30693. * _.toInteger('3.2');
  30694. * // => 3
  30695. */
  30696. function toInteger(value) {
  30697. var result = toFinite(value),
  30698. remainder = result % 1;
  30699. return result === result ? (remainder ? result - remainder : result) : 0;
  30700. }
  30701. /**
  30702. * Converts `value` to an integer suitable for use as the length of an
  30703. * array-like object.
  30704. *
  30705. * **Note:** This method is based on
  30706. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30707. *
  30708. * @static
  30709. * @memberOf _
  30710. * @since 4.0.0
  30711. * @category Lang
  30712. * @param {*} value The value to convert.
  30713. * @returns {number} Returns the converted integer.
  30714. * @example
  30715. *
  30716. * _.toLength(3.2);
  30717. * // => 3
  30718. *
  30719. * _.toLength(Number.MIN_VALUE);
  30720. * // => 0
  30721. *
  30722. * _.toLength(Infinity);
  30723. * // => 4294967295
  30724. *
  30725. * _.toLength('3.2');
  30726. * // => 3
  30727. */
  30728. function toLength(value) {
  30729. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30730. }
  30731. /**
  30732. * Converts `value` to a number.
  30733. *
  30734. * @static
  30735. * @memberOf _
  30736. * @since 4.0.0
  30737. * @category Lang
  30738. * @param {*} value The value to process.
  30739. * @returns {number} Returns the number.
  30740. * @example
  30741. *
  30742. * _.toNumber(3.2);
  30743. * // => 3.2
  30744. *
  30745. * _.toNumber(Number.MIN_VALUE);
  30746. * // => 5e-324
  30747. *
  30748. * _.toNumber(Infinity);
  30749. * // => Infinity
  30750. *
  30751. * _.toNumber('3.2');
  30752. * // => 3.2
  30753. */
  30754. function toNumber(value) {
  30755. if (typeof value == 'number') {
  30756. return value;
  30757. }
  30758. if (isSymbol(value)) {
  30759. return NAN;
  30760. }
  30761. if (isObject(value)) {
  30762. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30763. value = isObject(other) ? (other + '') : other;
  30764. }
  30765. if (typeof value != 'string') {
  30766. return value === 0 ? value : +value;
  30767. }
  30768. value = value.replace(reTrim, '');
  30769. var isBinary = reIsBinary.test(value);
  30770. return (isBinary || reIsOctal.test(value))
  30771. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30772. : (reIsBadHex.test(value) ? NAN : +value);
  30773. }
  30774. /**
  30775. * Converts `value` to a plain object flattening inherited enumerable string
  30776. * keyed properties of `value` to own properties of the plain object.
  30777. *
  30778. * @static
  30779. * @memberOf _
  30780. * @since 3.0.0
  30781. * @category Lang
  30782. * @param {*} value The value to convert.
  30783. * @returns {Object} Returns the converted plain object.
  30784. * @example
  30785. *
  30786. * function Foo() {
  30787. * this.b = 2;
  30788. * }
  30789. *
  30790. * Foo.prototype.c = 3;
  30791. *
  30792. * _.assign({ 'a': 1 }, new Foo);
  30793. * // => { 'a': 1, 'b': 2 }
  30794. *
  30795. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30796. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30797. */
  30798. function toPlainObject(value) {
  30799. return copyObject(value, keysIn(value));
  30800. }
  30801. /**
  30802. * Converts `value` to a safe integer. A safe integer can be compared and
  30803. * represented correctly.
  30804. *
  30805. * @static
  30806. * @memberOf _
  30807. * @since 4.0.0
  30808. * @category Lang
  30809. * @param {*} value The value to convert.
  30810. * @returns {number} Returns the converted integer.
  30811. * @example
  30812. *
  30813. * _.toSafeInteger(3.2);
  30814. * // => 3
  30815. *
  30816. * _.toSafeInteger(Number.MIN_VALUE);
  30817. * // => 0
  30818. *
  30819. * _.toSafeInteger(Infinity);
  30820. * // => 9007199254740991
  30821. *
  30822. * _.toSafeInteger('3.2');
  30823. * // => 3
  30824. */
  30825. function toSafeInteger(value) {
  30826. return value
  30827. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30828. : (value === 0 ? value : 0);
  30829. }
  30830. /**
  30831. * Converts `value` to a string. An empty string is returned for `null`
  30832. * and `undefined` values. The sign of `-0` is preserved.
  30833. *
  30834. * @static
  30835. * @memberOf _
  30836. * @since 4.0.0
  30837. * @category Lang
  30838. * @param {*} value The value to convert.
  30839. * @returns {string} Returns the converted string.
  30840. * @example
  30841. *
  30842. * _.toString(null);
  30843. * // => ''
  30844. *
  30845. * _.toString(-0);
  30846. * // => '-0'
  30847. *
  30848. * _.toString([1, 2, 3]);
  30849. * // => '1,2,3'
  30850. */
  30851. function toString(value) {
  30852. return value == null ? '' : baseToString(value);
  30853. }
  30854. /*------------------------------------------------------------------------*/
  30855. /**
  30856. * Assigns own enumerable string keyed properties of source objects to the
  30857. * destination object. Source objects are applied from left to right.
  30858. * Subsequent sources overwrite property assignments of previous sources.
  30859. *
  30860. * **Note:** This method mutates `object` and is loosely based on
  30861. * [`Object.assign`](https://mdn.io/Object/assign).
  30862. *
  30863. * @static
  30864. * @memberOf _
  30865. * @since 0.10.0
  30866. * @category Object
  30867. * @param {Object} object The destination object.
  30868. * @param {...Object} [sources] The source objects.
  30869. * @returns {Object} Returns `object`.
  30870. * @see _.assignIn
  30871. * @example
  30872. *
  30873. * function Foo() {
  30874. * this.a = 1;
  30875. * }
  30876. *
  30877. * function Bar() {
  30878. * this.c = 3;
  30879. * }
  30880. *
  30881. * Foo.prototype.b = 2;
  30882. * Bar.prototype.d = 4;
  30883. *
  30884. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30885. * // => { 'a': 1, 'c': 3 }
  30886. */
  30887. var assign = createAssigner(function(object, source) {
  30888. if (isPrototype(source) || isArrayLike(source)) {
  30889. copyObject(source, keys(source), object);
  30890. return;
  30891. }
  30892. for (var key in source) {
  30893. if (hasOwnProperty.call(source, key)) {
  30894. assignValue(object, key, source[key]);
  30895. }
  30896. }
  30897. });
  30898. /**
  30899. * This method is like `_.assign` except that it iterates over own and
  30900. * inherited source properties.
  30901. *
  30902. * **Note:** This method mutates `object`.
  30903. *
  30904. * @static
  30905. * @memberOf _
  30906. * @since 4.0.0
  30907. * @alias extend
  30908. * @category Object
  30909. * @param {Object} object The destination object.
  30910. * @param {...Object} [sources] The source objects.
  30911. * @returns {Object} Returns `object`.
  30912. * @see _.assign
  30913. * @example
  30914. *
  30915. * function Foo() {
  30916. * this.a = 1;
  30917. * }
  30918. *
  30919. * function Bar() {
  30920. * this.c = 3;
  30921. * }
  30922. *
  30923. * Foo.prototype.b = 2;
  30924. * Bar.prototype.d = 4;
  30925. *
  30926. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30927. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30928. */
  30929. var assignIn = createAssigner(function(object, source) {
  30930. copyObject(source, keysIn(source), object);
  30931. });
  30932. /**
  30933. * This method is like `_.assignIn` except that it accepts `customizer`
  30934. * which is invoked to produce the assigned values. If `customizer` returns
  30935. * `undefined`, assignment is handled by the method instead. The `customizer`
  30936. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30937. *
  30938. * **Note:** This method mutates `object`.
  30939. *
  30940. * @static
  30941. * @memberOf _
  30942. * @since 4.0.0
  30943. * @alias extendWith
  30944. * @category Object
  30945. * @param {Object} object The destination object.
  30946. * @param {...Object} sources The source objects.
  30947. * @param {Function} [customizer] The function to customize assigned values.
  30948. * @returns {Object} Returns `object`.
  30949. * @see _.assignWith
  30950. * @example
  30951. *
  30952. * function customizer(objValue, srcValue) {
  30953. * return _.isUndefined(objValue) ? srcValue : objValue;
  30954. * }
  30955. *
  30956. * var defaults = _.partialRight(_.assignInWith, customizer);
  30957. *
  30958. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30959. * // => { 'a': 1, 'b': 2 }
  30960. */
  30961. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30962. copyObject(source, keysIn(source), object, customizer);
  30963. });
  30964. /**
  30965. * This method is like `_.assign` except that it accepts `customizer`
  30966. * which is invoked to produce the assigned values. If `customizer` returns
  30967. * `undefined`, assignment is handled by the method instead. The `customizer`
  30968. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30969. *
  30970. * **Note:** This method mutates `object`.
  30971. *
  30972. * @static
  30973. * @memberOf _
  30974. * @since 4.0.0
  30975. * @category Object
  30976. * @param {Object} object The destination object.
  30977. * @param {...Object} sources The source objects.
  30978. * @param {Function} [customizer] The function to customize assigned values.
  30979. * @returns {Object} Returns `object`.
  30980. * @see _.assignInWith
  30981. * @example
  30982. *
  30983. * function customizer(objValue, srcValue) {
  30984. * return _.isUndefined(objValue) ? srcValue : objValue;
  30985. * }
  30986. *
  30987. * var defaults = _.partialRight(_.assignWith, customizer);
  30988. *
  30989. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30990. * // => { 'a': 1, 'b': 2 }
  30991. */
  30992. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30993. copyObject(source, keys(source), object, customizer);
  30994. });
  30995. /**
  30996. * Creates an array of values corresponding to `paths` of `object`.
  30997. *
  30998. * @static
  30999. * @memberOf _
  31000. * @since 1.0.0
  31001. * @category Object
  31002. * @param {Object} object The object to iterate over.
  31003. * @param {...(string|string[])} [paths] The property paths to pick.
  31004. * @returns {Array} Returns the picked values.
  31005. * @example
  31006. *
  31007. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31008. *
  31009. * _.at(object, ['a[0].b.c', 'a[1]']);
  31010. * // => [3, 4]
  31011. */
  31012. var at = flatRest(baseAt);
  31013. /**
  31014. * Creates an object that inherits from the `prototype` object. If a
  31015. * `properties` object is given, its own enumerable string keyed properties
  31016. * are assigned to the created object.
  31017. *
  31018. * @static
  31019. * @memberOf _
  31020. * @since 2.3.0
  31021. * @category Object
  31022. * @param {Object} prototype The object to inherit from.
  31023. * @param {Object} [properties] The properties to assign to the object.
  31024. * @returns {Object} Returns the new object.
  31025. * @example
  31026. *
  31027. * function Shape() {
  31028. * this.x = 0;
  31029. * this.y = 0;
  31030. * }
  31031. *
  31032. * function Circle() {
  31033. * Shape.call(this);
  31034. * }
  31035. *
  31036. * Circle.prototype = _.create(Shape.prototype, {
  31037. * 'constructor': Circle
  31038. * });
  31039. *
  31040. * var circle = new Circle;
  31041. * circle instanceof Circle;
  31042. * // => true
  31043. *
  31044. * circle instanceof Shape;
  31045. * // => true
  31046. */
  31047. function create(prototype, properties) {
  31048. var result = baseCreate(prototype);
  31049. return properties == null ? result : baseAssign(result, properties);
  31050. }
  31051. /**
  31052. * Assigns own and inherited enumerable string keyed properties of source
  31053. * objects to the destination object for all destination properties that
  31054. * resolve to `undefined`. Source objects are applied from left to right.
  31055. * Once a property is set, additional values of the same property are ignored.
  31056. *
  31057. * **Note:** This method mutates `object`.
  31058. *
  31059. * @static
  31060. * @since 0.1.0
  31061. * @memberOf _
  31062. * @category Object
  31063. * @param {Object} object The destination object.
  31064. * @param {...Object} [sources] The source objects.
  31065. * @returns {Object} Returns `object`.
  31066. * @see _.defaultsDeep
  31067. * @example
  31068. *
  31069. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31070. * // => { 'a': 1, 'b': 2 }
  31071. */
  31072. var defaults = baseRest(function(object, sources) {
  31073. object = Object(object);
  31074. var index = -1;
  31075. var length = sources.length;
  31076. var guard = length > 2 ? sources[2] : undefined;
  31077. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31078. length = 1;
  31079. }
  31080. while (++index < length) {
  31081. var source = sources[index];
  31082. var props = keysIn(source);
  31083. var propsIndex = -1;
  31084. var propsLength = props.length;
  31085. while (++propsIndex < propsLength) {
  31086. var key = props[propsIndex];
  31087. var value = object[key];
  31088. if (value === undefined ||
  31089. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31090. object[key] = source[key];
  31091. }
  31092. }
  31093. }
  31094. return object;
  31095. });
  31096. /**
  31097. * This method is like `_.defaults` except that it recursively assigns
  31098. * default properties.
  31099. *
  31100. * **Note:** This method mutates `object`.
  31101. *
  31102. * @static
  31103. * @memberOf _
  31104. * @since 3.10.0
  31105. * @category Object
  31106. * @param {Object} object The destination object.
  31107. * @param {...Object} [sources] The source objects.
  31108. * @returns {Object} Returns `object`.
  31109. * @see _.defaults
  31110. * @example
  31111. *
  31112. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31113. * // => { 'a': { 'b': 2, 'c': 3 } }
  31114. */
  31115. var defaultsDeep = baseRest(function(args) {
  31116. args.push(undefined, customDefaultsMerge);
  31117. return apply(mergeWith, undefined, args);
  31118. });
  31119. /**
  31120. * This method is like `_.find` except that it returns the key of the first
  31121. * element `predicate` returns truthy for instead of the element itself.
  31122. *
  31123. * @static
  31124. * @memberOf _
  31125. * @since 1.1.0
  31126. * @category Object
  31127. * @param {Object} object The object to inspect.
  31128. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31129. * @returns {string|undefined} Returns the key of the matched element,
  31130. * else `undefined`.
  31131. * @example
  31132. *
  31133. * var users = {
  31134. * 'barney': { 'age': 36, 'active': true },
  31135. * 'fred': { 'age': 40, 'active': false },
  31136. * 'pebbles': { 'age': 1, 'active': true }
  31137. * };
  31138. *
  31139. * _.findKey(users, function(o) { return o.age < 40; });
  31140. * // => 'barney' (iteration order is not guaranteed)
  31141. *
  31142. * // The `_.matches` iteratee shorthand.
  31143. * _.findKey(users, { 'age': 1, 'active': true });
  31144. * // => 'pebbles'
  31145. *
  31146. * // The `_.matchesProperty` iteratee shorthand.
  31147. * _.findKey(users, ['active', false]);
  31148. * // => 'fred'
  31149. *
  31150. * // The `_.property` iteratee shorthand.
  31151. * _.findKey(users, 'active');
  31152. * // => 'barney'
  31153. */
  31154. function findKey(object, predicate) {
  31155. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31156. }
  31157. /**
  31158. * This method is like `_.findKey` except that it iterates over elements of
  31159. * a collection in the opposite order.
  31160. *
  31161. * @static
  31162. * @memberOf _
  31163. * @since 2.0.0
  31164. * @category Object
  31165. * @param {Object} object The object to inspect.
  31166. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31167. * @returns {string|undefined} Returns the key of the matched element,
  31168. * else `undefined`.
  31169. * @example
  31170. *
  31171. * var users = {
  31172. * 'barney': { 'age': 36, 'active': true },
  31173. * 'fred': { 'age': 40, 'active': false },
  31174. * 'pebbles': { 'age': 1, 'active': true }
  31175. * };
  31176. *
  31177. * _.findLastKey(users, function(o) { return o.age < 40; });
  31178. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31179. *
  31180. * // The `_.matches` iteratee shorthand.
  31181. * _.findLastKey(users, { 'age': 36, 'active': true });
  31182. * // => 'barney'
  31183. *
  31184. * // The `_.matchesProperty` iteratee shorthand.
  31185. * _.findLastKey(users, ['active', false]);
  31186. * // => 'fred'
  31187. *
  31188. * // The `_.property` iteratee shorthand.
  31189. * _.findLastKey(users, 'active');
  31190. * // => 'pebbles'
  31191. */
  31192. function findLastKey(object, predicate) {
  31193. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31194. }
  31195. /**
  31196. * Iterates over own and inherited enumerable string keyed properties of an
  31197. * object and invokes `iteratee` for each property. The iteratee is invoked
  31198. * with three arguments: (value, key, object). Iteratee functions may exit
  31199. * iteration early by explicitly returning `false`.
  31200. *
  31201. * @static
  31202. * @memberOf _
  31203. * @since 0.3.0
  31204. * @category Object
  31205. * @param {Object} object The object to iterate over.
  31206. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31207. * @returns {Object} Returns `object`.
  31208. * @see _.forInRight
  31209. * @example
  31210. *
  31211. * function Foo() {
  31212. * this.a = 1;
  31213. * this.b = 2;
  31214. * }
  31215. *
  31216. * Foo.prototype.c = 3;
  31217. *
  31218. * _.forIn(new Foo, function(value, key) {
  31219. * console.log(key);
  31220. * });
  31221. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31222. */
  31223. function forIn(object, iteratee) {
  31224. return object == null
  31225. ? object
  31226. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31227. }
  31228. /**
  31229. * This method is like `_.forIn` except that it iterates over properties of
  31230. * `object` in the opposite order.
  31231. *
  31232. * @static
  31233. * @memberOf _
  31234. * @since 2.0.0
  31235. * @category Object
  31236. * @param {Object} object The object to iterate over.
  31237. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31238. * @returns {Object} Returns `object`.
  31239. * @see _.forIn
  31240. * @example
  31241. *
  31242. * function Foo() {
  31243. * this.a = 1;
  31244. * this.b = 2;
  31245. * }
  31246. *
  31247. * Foo.prototype.c = 3;
  31248. *
  31249. * _.forInRight(new Foo, function(value, key) {
  31250. * console.log(key);
  31251. * });
  31252. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31253. */
  31254. function forInRight(object, iteratee) {
  31255. return object == null
  31256. ? object
  31257. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31258. }
  31259. /**
  31260. * Iterates over own enumerable string keyed properties of an object and
  31261. * invokes `iteratee` for each property. The iteratee is invoked with three
  31262. * arguments: (value, key, object). Iteratee functions may exit iteration
  31263. * early by explicitly returning `false`.
  31264. *
  31265. * @static
  31266. * @memberOf _
  31267. * @since 0.3.0
  31268. * @category Object
  31269. * @param {Object} object The object to iterate over.
  31270. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31271. * @returns {Object} Returns `object`.
  31272. * @see _.forOwnRight
  31273. * @example
  31274. *
  31275. * function Foo() {
  31276. * this.a = 1;
  31277. * this.b = 2;
  31278. * }
  31279. *
  31280. * Foo.prototype.c = 3;
  31281. *
  31282. * _.forOwn(new Foo, function(value, key) {
  31283. * console.log(key);
  31284. * });
  31285. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31286. */
  31287. function forOwn(object, iteratee) {
  31288. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31289. }
  31290. /**
  31291. * This method is like `_.forOwn` except that it iterates over properties of
  31292. * `object` in the opposite order.
  31293. *
  31294. * @static
  31295. * @memberOf _
  31296. * @since 2.0.0
  31297. * @category Object
  31298. * @param {Object} object The object to iterate over.
  31299. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31300. * @returns {Object} Returns `object`.
  31301. * @see _.forOwn
  31302. * @example
  31303. *
  31304. * function Foo() {
  31305. * this.a = 1;
  31306. * this.b = 2;
  31307. * }
  31308. *
  31309. * Foo.prototype.c = 3;
  31310. *
  31311. * _.forOwnRight(new Foo, function(value, key) {
  31312. * console.log(key);
  31313. * });
  31314. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31315. */
  31316. function forOwnRight(object, iteratee) {
  31317. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31318. }
  31319. /**
  31320. * Creates an array of function property names from own enumerable properties
  31321. * of `object`.
  31322. *
  31323. * @static
  31324. * @since 0.1.0
  31325. * @memberOf _
  31326. * @category Object
  31327. * @param {Object} object The object to inspect.
  31328. * @returns {Array} Returns the function names.
  31329. * @see _.functionsIn
  31330. * @example
  31331. *
  31332. * function Foo() {
  31333. * this.a = _.constant('a');
  31334. * this.b = _.constant('b');
  31335. * }
  31336. *
  31337. * Foo.prototype.c = _.constant('c');
  31338. *
  31339. * _.functions(new Foo);
  31340. * // => ['a', 'b']
  31341. */
  31342. function functions(object) {
  31343. return object == null ? [] : baseFunctions(object, keys(object));
  31344. }
  31345. /**
  31346. * Creates an array of function property names from own and inherited
  31347. * enumerable properties of `object`.
  31348. *
  31349. * @static
  31350. * @memberOf _
  31351. * @since 4.0.0
  31352. * @category Object
  31353. * @param {Object} object The object to inspect.
  31354. * @returns {Array} Returns the function names.
  31355. * @see _.functions
  31356. * @example
  31357. *
  31358. * function Foo() {
  31359. * this.a = _.constant('a');
  31360. * this.b = _.constant('b');
  31361. * }
  31362. *
  31363. * Foo.prototype.c = _.constant('c');
  31364. *
  31365. * _.functionsIn(new Foo);
  31366. * // => ['a', 'b', 'c']
  31367. */
  31368. function functionsIn(object) {
  31369. return object == null ? [] : baseFunctions(object, keysIn(object));
  31370. }
  31371. /**
  31372. * Gets the value at `path` of `object`. If the resolved value is
  31373. * `undefined`, the `defaultValue` is returned in its place.
  31374. *
  31375. * @static
  31376. * @memberOf _
  31377. * @since 3.7.0
  31378. * @category Object
  31379. * @param {Object} object The object to query.
  31380. * @param {Array|string} path The path of the property to get.
  31381. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31382. * @returns {*} Returns the resolved value.
  31383. * @example
  31384. *
  31385. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31386. *
  31387. * _.get(object, 'a[0].b.c');
  31388. * // => 3
  31389. *
  31390. * _.get(object, ['a', '0', 'b', 'c']);
  31391. * // => 3
  31392. *
  31393. * _.get(object, 'a.b.c', 'default');
  31394. * // => 'default'
  31395. */
  31396. function get(object, path, defaultValue) {
  31397. var result = object == null ? undefined : baseGet(object, path);
  31398. return result === undefined ? defaultValue : result;
  31399. }
  31400. /**
  31401. * Checks if `path` is a direct property of `object`.
  31402. *
  31403. * @static
  31404. * @since 0.1.0
  31405. * @memberOf _
  31406. * @category Object
  31407. * @param {Object} object The object to query.
  31408. * @param {Array|string} path The path to check.
  31409. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31410. * @example
  31411. *
  31412. * var object = { 'a': { 'b': 2 } };
  31413. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31414. *
  31415. * _.has(object, 'a');
  31416. * // => true
  31417. *
  31418. * _.has(object, 'a.b');
  31419. * // => true
  31420. *
  31421. * _.has(object, ['a', 'b']);
  31422. * // => true
  31423. *
  31424. * _.has(other, 'a');
  31425. * // => false
  31426. */
  31427. function has(object, path) {
  31428. return object != null && hasPath(object, path, baseHas);
  31429. }
  31430. /**
  31431. * Checks if `path` is a direct or inherited property of `object`.
  31432. *
  31433. * @static
  31434. * @memberOf _
  31435. * @since 4.0.0
  31436. * @category Object
  31437. * @param {Object} object The object to query.
  31438. * @param {Array|string} path The path to check.
  31439. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31440. * @example
  31441. *
  31442. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31443. *
  31444. * _.hasIn(object, 'a');
  31445. * // => true
  31446. *
  31447. * _.hasIn(object, 'a.b');
  31448. * // => true
  31449. *
  31450. * _.hasIn(object, ['a', 'b']);
  31451. * // => true
  31452. *
  31453. * _.hasIn(object, 'b');
  31454. * // => false
  31455. */
  31456. function hasIn(object, path) {
  31457. return object != null && hasPath(object, path, baseHasIn);
  31458. }
  31459. /**
  31460. * Creates an object composed of the inverted keys and values of `object`.
  31461. * If `object` contains duplicate values, subsequent values overwrite
  31462. * property assignments of previous values.
  31463. *
  31464. * @static
  31465. * @memberOf _
  31466. * @since 0.7.0
  31467. * @category Object
  31468. * @param {Object} object The object to invert.
  31469. * @returns {Object} Returns the new inverted object.
  31470. * @example
  31471. *
  31472. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31473. *
  31474. * _.invert(object);
  31475. * // => { '1': 'c', '2': 'b' }
  31476. */
  31477. var invert = createInverter(function(result, value, key) {
  31478. if (value != null &&
  31479. typeof value.toString != 'function') {
  31480. value = nativeObjectToString.call(value);
  31481. }
  31482. result[value] = key;
  31483. }, constant(identity));
  31484. /**
  31485. * This method is like `_.invert` except that the inverted object is generated
  31486. * from the results of running each element of `object` thru `iteratee`. The
  31487. * corresponding inverted value of each inverted key is an array of keys
  31488. * responsible for generating the inverted value. The iteratee is invoked
  31489. * with one argument: (value).
  31490. *
  31491. * @static
  31492. * @memberOf _
  31493. * @since 4.1.0
  31494. * @category Object
  31495. * @param {Object} object The object to invert.
  31496. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31497. * @returns {Object} Returns the new inverted object.
  31498. * @example
  31499. *
  31500. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31501. *
  31502. * _.invertBy(object);
  31503. * // => { '1': ['a', 'c'], '2': ['b'] }
  31504. *
  31505. * _.invertBy(object, function(value) {
  31506. * return 'group' + value;
  31507. * });
  31508. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31509. */
  31510. var invertBy = createInverter(function(result, value, key) {
  31511. if (value != null &&
  31512. typeof value.toString != 'function') {
  31513. value = nativeObjectToString.call(value);
  31514. }
  31515. if (hasOwnProperty.call(result, value)) {
  31516. result[value].push(key);
  31517. } else {
  31518. result[value] = [key];
  31519. }
  31520. }, getIteratee);
  31521. /**
  31522. * Invokes the method at `path` of `object`.
  31523. *
  31524. * @static
  31525. * @memberOf _
  31526. * @since 4.0.0
  31527. * @category Object
  31528. * @param {Object} object The object to query.
  31529. * @param {Array|string} path The path of the method to invoke.
  31530. * @param {...*} [args] The arguments to invoke the method with.
  31531. * @returns {*} Returns the result of the invoked method.
  31532. * @example
  31533. *
  31534. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31535. *
  31536. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31537. * // => [2, 3]
  31538. */
  31539. var invoke = baseRest(baseInvoke);
  31540. /**
  31541. * Creates an array of the own enumerable property names of `object`.
  31542. *
  31543. * **Note:** Non-object values are coerced to objects. See the
  31544. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31545. * for more details.
  31546. *
  31547. * @static
  31548. * @since 0.1.0
  31549. * @memberOf _
  31550. * @category Object
  31551. * @param {Object} object The object to query.
  31552. * @returns {Array} Returns the array of property names.
  31553. * @example
  31554. *
  31555. * function Foo() {
  31556. * this.a = 1;
  31557. * this.b = 2;
  31558. * }
  31559. *
  31560. * Foo.prototype.c = 3;
  31561. *
  31562. * _.keys(new Foo);
  31563. * // => ['a', 'b'] (iteration order is not guaranteed)
  31564. *
  31565. * _.keys('hi');
  31566. * // => ['0', '1']
  31567. */
  31568. function keys(object) {
  31569. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31570. }
  31571. /**
  31572. * Creates an array of the own and inherited enumerable property names of `object`.
  31573. *
  31574. * **Note:** Non-object values are coerced to objects.
  31575. *
  31576. * @static
  31577. * @memberOf _
  31578. * @since 3.0.0
  31579. * @category Object
  31580. * @param {Object} object The object to query.
  31581. * @returns {Array} Returns the array of property names.
  31582. * @example
  31583. *
  31584. * function Foo() {
  31585. * this.a = 1;
  31586. * this.b = 2;
  31587. * }
  31588. *
  31589. * Foo.prototype.c = 3;
  31590. *
  31591. * _.keysIn(new Foo);
  31592. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31593. */
  31594. function keysIn(object) {
  31595. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31596. }
  31597. /**
  31598. * The opposite of `_.mapValues`; this method creates an object with the
  31599. * same values as `object` and keys generated by running each own enumerable
  31600. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31601. * with three arguments: (value, key, object).
  31602. *
  31603. * @static
  31604. * @memberOf _
  31605. * @since 3.8.0
  31606. * @category Object
  31607. * @param {Object} object The object to iterate over.
  31608. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31609. * @returns {Object} Returns the new mapped object.
  31610. * @see _.mapValues
  31611. * @example
  31612. *
  31613. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31614. * return key + value;
  31615. * });
  31616. * // => { 'a1': 1, 'b2': 2 }
  31617. */
  31618. function mapKeys(object, iteratee) {
  31619. var result = {};
  31620. iteratee = getIteratee(iteratee, 3);
  31621. baseForOwn(object, function(value, key, object) {
  31622. baseAssignValue(result, iteratee(value, key, object), value);
  31623. });
  31624. return result;
  31625. }
  31626. /**
  31627. * Creates an object with the same keys as `object` and values generated
  31628. * by running each own enumerable string keyed property of `object` thru
  31629. * `iteratee`. The iteratee is invoked with three arguments:
  31630. * (value, key, object).
  31631. *
  31632. * @static
  31633. * @memberOf _
  31634. * @since 2.4.0
  31635. * @category Object
  31636. * @param {Object} object The object to iterate over.
  31637. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31638. * @returns {Object} Returns the new mapped object.
  31639. * @see _.mapKeys
  31640. * @example
  31641. *
  31642. * var users = {
  31643. * 'fred': { 'user': 'fred', 'age': 40 },
  31644. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31645. * };
  31646. *
  31647. * _.mapValues(users, function(o) { return o.age; });
  31648. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31649. *
  31650. * // The `_.property` iteratee shorthand.
  31651. * _.mapValues(users, 'age');
  31652. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31653. */
  31654. function mapValues(object, iteratee) {
  31655. var result = {};
  31656. iteratee = getIteratee(iteratee, 3);
  31657. baseForOwn(object, function(value, key, object) {
  31658. baseAssignValue(result, key, iteratee(value, key, object));
  31659. });
  31660. return result;
  31661. }
  31662. /**
  31663. * This method is like `_.assign` except that it recursively merges own and
  31664. * inherited enumerable string keyed properties of source objects into the
  31665. * destination object. Source properties that resolve to `undefined` are
  31666. * skipped if a destination value exists. Array and plain object properties
  31667. * are merged recursively. Other objects and value types are overridden by
  31668. * assignment. Source objects are applied from left to right. Subsequent
  31669. * sources overwrite property assignments of previous sources.
  31670. *
  31671. * **Note:** This method mutates `object`.
  31672. *
  31673. * @static
  31674. * @memberOf _
  31675. * @since 0.5.0
  31676. * @category Object
  31677. * @param {Object} object The destination object.
  31678. * @param {...Object} [sources] The source objects.
  31679. * @returns {Object} Returns `object`.
  31680. * @example
  31681. *
  31682. * var object = {
  31683. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31684. * };
  31685. *
  31686. * var other = {
  31687. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31688. * };
  31689. *
  31690. * _.merge(object, other);
  31691. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31692. */
  31693. var merge = createAssigner(function(object, source, srcIndex) {
  31694. baseMerge(object, source, srcIndex);
  31695. });
  31696. /**
  31697. * This method is like `_.merge` except that it accepts `customizer` which
  31698. * is invoked to produce the merged values of the destination and source
  31699. * properties. If `customizer` returns `undefined`, merging is handled by the
  31700. * method instead. The `customizer` is invoked with six arguments:
  31701. * (objValue, srcValue, key, object, source, stack).
  31702. *
  31703. * **Note:** This method mutates `object`.
  31704. *
  31705. * @static
  31706. * @memberOf _
  31707. * @since 4.0.0
  31708. * @category Object
  31709. * @param {Object} object The destination object.
  31710. * @param {...Object} sources The source objects.
  31711. * @param {Function} customizer The function to customize assigned values.
  31712. * @returns {Object} Returns `object`.
  31713. * @example
  31714. *
  31715. * function customizer(objValue, srcValue) {
  31716. * if (_.isArray(objValue)) {
  31717. * return objValue.concat(srcValue);
  31718. * }
  31719. * }
  31720. *
  31721. * var object = { 'a': [1], 'b': [2] };
  31722. * var other = { 'a': [3], 'b': [4] };
  31723. *
  31724. * _.mergeWith(object, other, customizer);
  31725. * // => { 'a': [1, 3], 'b': [2, 4] }
  31726. */
  31727. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31728. baseMerge(object, source, srcIndex, customizer);
  31729. });
  31730. /**
  31731. * The opposite of `_.pick`; this method creates an object composed of the
  31732. * own and inherited enumerable property paths of `object` that are not omitted.
  31733. *
  31734. * **Note:** This method is considerably slower than `_.pick`.
  31735. *
  31736. * @static
  31737. * @since 0.1.0
  31738. * @memberOf _
  31739. * @category Object
  31740. * @param {Object} object The source object.
  31741. * @param {...(string|string[])} [paths] The property paths to omit.
  31742. * @returns {Object} Returns the new object.
  31743. * @example
  31744. *
  31745. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31746. *
  31747. * _.omit(object, ['a', 'c']);
  31748. * // => { 'b': '2' }
  31749. */
  31750. var omit = flatRest(function(object, paths) {
  31751. var result = {};
  31752. if (object == null) {
  31753. return result;
  31754. }
  31755. var isDeep = false;
  31756. paths = arrayMap(paths, function(path) {
  31757. path = castPath(path, object);
  31758. isDeep || (isDeep = path.length > 1);
  31759. return path;
  31760. });
  31761. copyObject(object, getAllKeysIn(object), result);
  31762. if (isDeep) {
  31763. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31764. }
  31765. var length = paths.length;
  31766. while (length--) {
  31767. baseUnset(result, paths[length]);
  31768. }
  31769. return result;
  31770. });
  31771. /**
  31772. * The opposite of `_.pickBy`; this method creates an object composed of
  31773. * the own and inherited enumerable string keyed properties of `object` that
  31774. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31775. * arguments: (value, key).
  31776. *
  31777. * @static
  31778. * @memberOf _
  31779. * @since 4.0.0
  31780. * @category Object
  31781. * @param {Object} object The source object.
  31782. * @param {Function} [predicate=_.identity] The function invoked per property.
  31783. * @returns {Object} Returns the new object.
  31784. * @example
  31785. *
  31786. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31787. *
  31788. * _.omitBy(object, _.isNumber);
  31789. * // => { 'b': '2' }
  31790. */
  31791. function omitBy(object, predicate) {
  31792. return pickBy(object, negate(getIteratee(predicate)));
  31793. }
  31794. /**
  31795. * Creates an object composed of the picked `object` properties.
  31796. *
  31797. * @static
  31798. * @since 0.1.0
  31799. * @memberOf _
  31800. * @category Object
  31801. * @param {Object} object The source object.
  31802. * @param {...(string|string[])} [paths] The property paths to pick.
  31803. * @returns {Object} Returns the new object.
  31804. * @example
  31805. *
  31806. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31807. *
  31808. * _.pick(object, ['a', 'c']);
  31809. * // => { 'a': 1, 'c': 3 }
  31810. */
  31811. var pick = flatRest(function(object, paths) {
  31812. return object == null ? {} : basePick(object, paths);
  31813. });
  31814. /**
  31815. * Creates an object composed of the `object` properties `predicate` returns
  31816. * truthy for. The predicate is invoked with two arguments: (value, key).
  31817. *
  31818. * @static
  31819. * @memberOf _
  31820. * @since 4.0.0
  31821. * @category Object
  31822. * @param {Object} object The source object.
  31823. * @param {Function} [predicate=_.identity] The function invoked per property.
  31824. * @returns {Object} Returns the new object.
  31825. * @example
  31826. *
  31827. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31828. *
  31829. * _.pickBy(object, _.isNumber);
  31830. * // => { 'a': 1, 'c': 3 }
  31831. */
  31832. function pickBy(object, predicate) {
  31833. if (object == null) {
  31834. return {};
  31835. }
  31836. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31837. return [prop];
  31838. });
  31839. predicate = getIteratee(predicate);
  31840. return basePickBy(object, props, function(value, path) {
  31841. return predicate(value, path[0]);
  31842. });
  31843. }
  31844. /**
  31845. * This method is like `_.get` except that if the resolved value is a
  31846. * function it's invoked with the `this` binding of its parent object and
  31847. * its result is returned.
  31848. *
  31849. * @static
  31850. * @since 0.1.0
  31851. * @memberOf _
  31852. * @category Object
  31853. * @param {Object} object The object to query.
  31854. * @param {Array|string} path The path of the property to resolve.
  31855. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31856. * @returns {*} Returns the resolved value.
  31857. * @example
  31858. *
  31859. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31860. *
  31861. * _.result(object, 'a[0].b.c1');
  31862. * // => 3
  31863. *
  31864. * _.result(object, 'a[0].b.c2');
  31865. * // => 4
  31866. *
  31867. * _.result(object, 'a[0].b.c3', 'default');
  31868. * // => 'default'
  31869. *
  31870. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31871. * // => 'default'
  31872. */
  31873. function result(object, path, defaultValue) {
  31874. path = castPath(path, object);
  31875. var index = -1,
  31876. length = path.length;
  31877. // Ensure the loop is entered when path is empty.
  31878. if (!length) {
  31879. length = 1;
  31880. object = undefined;
  31881. }
  31882. while (++index < length) {
  31883. var value = object == null ? undefined : object[toKey(path[index])];
  31884. if (value === undefined) {
  31885. index = length;
  31886. value = defaultValue;
  31887. }
  31888. object = isFunction(value) ? value.call(object) : value;
  31889. }
  31890. return object;
  31891. }
  31892. /**
  31893. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31894. * it's created. Arrays are created for missing index properties while objects
  31895. * are created for all other missing properties. Use `_.setWith` to customize
  31896. * `path` creation.
  31897. *
  31898. * **Note:** This method mutates `object`.
  31899. *
  31900. * @static
  31901. * @memberOf _
  31902. * @since 3.7.0
  31903. * @category Object
  31904. * @param {Object} object The object to modify.
  31905. * @param {Array|string} path The path of the property to set.
  31906. * @param {*} value The value to set.
  31907. * @returns {Object} Returns `object`.
  31908. * @example
  31909. *
  31910. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31911. *
  31912. * _.set(object, 'a[0].b.c', 4);
  31913. * console.log(object.a[0].b.c);
  31914. * // => 4
  31915. *
  31916. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31917. * console.log(object.x[0].y.z);
  31918. * // => 5
  31919. */
  31920. function set(object, path, value) {
  31921. return object == null ? object : baseSet(object, path, value);
  31922. }
  31923. /**
  31924. * This method is like `_.set` except that it accepts `customizer` which is
  31925. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31926. * path creation is handled by the method instead. The `customizer` is invoked
  31927. * with three arguments: (nsValue, key, nsObject).
  31928. *
  31929. * **Note:** This method mutates `object`.
  31930. *
  31931. * @static
  31932. * @memberOf _
  31933. * @since 4.0.0
  31934. * @category Object
  31935. * @param {Object} object The object to modify.
  31936. * @param {Array|string} path The path of the property to set.
  31937. * @param {*} value The value to set.
  31938. * @param {Function} [customizer] The function to customize assigned values.
  31939. * @returns {Object} Returns `object`.
  31940. * @example
  31941. *
  31942. * var object = {};
  31943. *
  31944. * _.setWith(object, '[0][1]', 'a', Object);
  31945. * // => { '0': { '1': 'a' } }
  31946. */
  31947. function setWith(object, path, value, customizer) {
  31948. customizer = typeof customizer == 'function' ? customizer : undefined;
  31949. return object == null ? object : baseSet(object, path, value, customizer);
  31950. }
  31951. /**
  31952. * Creates an array of own enumerable string keyed-value pairs for `object`
  31953. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31954. * entries are returned.
  31955. *
  31956. * @static
  31957. * @memberOf _
  31958. * @since 4.0.0
  31959. * @alias entries
  31960. * @category Object
  31961. * @param {Object} object The object to query.
  31962. * @returns {Array} Returns the key-value pairs.
  31963. * @example
  31964. *
  31965. * function Foo() {
  31966. * this.a = 1;
  31967. * this.b = 2;
  31968. * }
  31969. *
  31970. * Foo.prototype.c = 3;
  31971. *
  31972. * _.toPairs(new Foo);
  31973. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31974. */
  31975. var toPairs = createToPairs(keys);
  31976. /**
  31977. * Creates an array of own and inherited enumerable string keyed-value pairs
  31978. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31979. * or set, its entries are returned.
  31980. *
  31981. * @static
  31982. * @memberOf _
  31983. * @since 4.0.0
  31984. * @alias entriesIn
  31985. * @category Object
  31986. * @param {Object} object The object to query.
  31987. * @returns {Array} Returns the key-value pairs.
  31988. * @example
  31989. *
  31990. * function Foo() {
  31991. * this.a = 1;
  31992. * this.b = 2;
  31993. * }
  31994. *
  31995. * Foo.prototype.c = 3;
  31996. *
  31997. * _.toPairsIn(new Foo);
  31998. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31999. */
  32000. var toPairsIn = createToPairs(keysIn);
  32001. /**
  32002. * An alternative to `_.reduce`; this method transforms `object` to a new
  32003. * `accumulator` object which is the result of running each of its own
  32004. * enumerable string keyed properties thru `iteratee`, with each invocation
  32005. * potentially mutating the `accumulator` object. If `accumulator` is not
  32006. * provided, a new object with the same `[[Prototype]]` will be used. The
  32007. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32008. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32009. *
  32010. * @static
  32011. * @memberOf _
  32012. * @since 1.3.0
  32013. * @category Object
  32014. * @param {Object} object The object to iterate over.
  32015. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32016. * @param {*} [accumulator] The custom accumulator value.
  32017. * @returns {*} Returns the accumulated value.
  32018. * @example
  32019. *
  32020. * _.transform([2, 3, 4], function(result, n) {
  32021. * result.push(n *= n);
  32022. * return n % 2 == 0;
  32023. * }, []);
  32024. * // => [4, 9]
  32025. *
  32026. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32027. * (result[value] || (result[value] = [])).push(key);
  32028. * }, {});
  32029. * // => { '1': ['a', 'c'], '2': ['b'] }
  32030. */
  32031. function transform(object, iteratee, accumulator) {
  32032. var isArr = isArray(object),
  32033. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32034. iteratee = getIteratee(iteratee, 4);
  32035. if (accumulator == null) {
  32036. var Ctor = object && object.constructor;
  32037. if (isArrLike) {
  32038. accumulator = isArr ? new Ctor : [];
  32039. }
  32040. else if (isObject(object)) {
  32041. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32042. }
  32043. else {
  32044. accumulator = {};
  32045. }
  32046. }
  32047. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32048. return iteratee(accumulator, value, index, object);
  32049. });
  32050. return accumulator;
  32051. }
  32052. /**
  32053. * Removes the property at `path` of `object`.
  32054. *
  32055. * **Note:** This method mutates `object`.
  32056. *
  32057. * @static
  32058. * @memberOf _
  32059. * @since 4.0.0
  32060. * @category Object
  32061. * @param {Object} object The object to modify.
  32062. * @param {Array|string} path The path of the property to unset.
  32063. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32064. * @example
  32065. *
  32066. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32067. * _.unset(object, 'a[0].b.c');
  32068. * // => true
  32069. *
  32070. * console.log(object);
  32071. * // => { 'a': [{ 'b': {} }] };
  32072. *
  32073. * _.unset(object, ['a', '0', 'b', 'c']);
  32074. * // => true
  32075. *
  32076. * console.log(object);
  32077. * // => { 'a': [{ 'b': {} }] };
  32078. */
  32079. function unset(object, path) {
  32080. return object == null ? true : baseUnset(object, path);
  32081. }
  32082. /**
  32083. * This method is like `_.set` except that accepts `updater` to produce the
  32084. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32085. * is invoked with one argument: (value).
  32086. *
  32087. * **Note:** This method mutates `object`.
  32088. *
  32089. * @static
  32090. * @memberOf _
  32091. * @since 4.6.0
  32092. * @category Object
  32093. * @param {Object} object The object to modify.
  32094. * @param {Array|string} path The path of the property to set.
  32095. * @param {Function} updater The function to produce the updated value.
  32096. * @returns {Object} Returns `object`.
  32097. * @example
  32098. *
  32099. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32100. *
  32101. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32102. * console.log(object.a[0].b.c);
  32103. * // => 9
  32104. *
  32105. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32106. * console.log(object.x[0].y.z);
  32107. * // => 0
  32108. */
  32109. function update(object, path, updater) {
  32110. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32111. }
  32112. /**
  32113. * This method is like `_.update` except that it accepts `customizer` which is
  32114. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32115. * path creation is handled by the method instead. The `customizer` is invoked
  32116. * with three arguments: (nsValue, key, nsObject).
  32117. *
  32118. * **Note:** This method mutates `object`.
  32119. *
  32120. * @static
  32121. * @memberOf _
  32122. * @since 4.6.0
  32123. * @category Object
  32124. * @param {Object} object The object to modify.
  32125. * @param {Array|string} path The path of the property to set.
  32126. * @param {Function} updater The function to produce the updated value.
  32127. * @param {Function} [customizer] The function to customize assigned values.
  32128. * @returns {Object} Returns `object`.
  32129. * @example
  32130. *
  32131. * var object = {};
  32132. *
  32133. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32134. * // => { '0': { '1': 'a' } }
  32135. */
  32136. function updateWith(object, path, updater, customizer) {
  32137. customizer = typeof customizer == 'function' ? customizer : undefined;
  32138. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32139. }
  32140. /**
  32141. * Creates an array of the own enumerable string keyed property values of `object`.
  32142. *
  32143. * **Note:** Non-object values are coerced to objects.
  32144. *
  32145. * @static
  32146. * @since 0.1.0
  32147. * @memberOf _
  32148. * @category Object
  32149. * @param {Object} object The object to query.
  32150. * @returns {Array} Returns the array of property values.
  32151. * @example
  32152. *
  32153. * function Foo() {
  32154. * this.a = 1;
  32155. * this.b = 2;
  32156. * }
  32157. *
  32158. * Foo.prototype.c = 3;
  32159. *
  32160. * _.values(new Foo);
  32161. * // => [1, 2] (iteration order is not guaranteed)
  32162. *
  32163. * _.values('hi');
  32164. * // => ['h', 'i']
  32165. */
  32166. function values(object) {
  32167. return object == null ? [] : baseValues(object, keys(object));
  32168. }
  32169. /**
  32170. * Creates an array of the own and inherited enumerable string keyed property
  32171. * values of `object`.
  32172. *
  32173. * **Note:** Non-object values are coerced to objects.
  32174. *
  32175. * @static
  32176. * @memberOf _
  32177. * @since 3.0.0
  32178. * @category Object
  32179. * @param {Object} object The object to query.
  32180. * @returns {Array} Returns the array of property values.
  32181. * @example
  32182. *
  32183. * function Foo() {
  32184. * this.a = 1;
  32185. * this.b = 2;
  32186. * }
  32187. *
  32188. * Foo.prototype.c = 3;
  32189. *
  32190. * _.valuesIn(new Foo);
  32191. * // => [1, 2, 3] (iteration order is not guaranteed)
  32192. */
  32193. function valuesIn(object) {
  32194. return object == null ? [] : baseValues(object, keysIn(object));
  32195. }
  32196. /*------------------------------------------------------------------------*/
  32197. /**
  32198. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32199. *
  32200. * @static
  32201. * @memberOf _
  32202. * @since 4.0.0
  32203. * @category Number
  32204. * @param {number} number The number to clamp.
  32205. * @param {number} [lower] The lower bound.
  32206. * @param {number} upper The upper bound.
  32207. * @returns {number} Returns the clamped number.
  32208. * @example
  32209. *
  32210. * _.clamp(-10, -5, 5);
  32211. * // => -5
  32212. *
  32213. * _.clamp(10, -5, 5);
  32214. * // => 5
  32215. */
  32216. function clamp(number, lower, upper) {
  32217. if (upper === undefined) {
  32218. upper = lower;
  32219. lower = undefined;
  32220. }
  32221. if (upper !== undefined) {
  32222. upper = toNumber(upper);
  32223. upper = upper === upper ? upper : 0;
  32224. }
  32225. if (lower !== undefined) {
  32226. lower = toNumber(lower);
  32227. lower = lower === lower ? lower : 0;
  32228. }
  32229. return baseClamp(toNumber(number), lower, upper);
  32230. }
  32231. /**
  32232. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32233. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32234. * If `start` is greater than `end` the params are swapped to support
  32235. * negative ranges.
  32236. *
  32237. * @static
  32238. * @memberOf _
  32239. * @since 3.3.0
  32240. * @category Number
  32241. * @param {number} number The number to check.
  32242. * @param {number} [start=0] The start of the range.
  32243. * @param {number} end The end of the range.
  32244. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32245. * @see _.range, _.rangeRight
  32246. * @example
  32247. *
  32248. * _.inRange(3, 2, 4);
  32249. * // => true
  32250. *
  32251. * _.inRange(4, 8);
  32252. * // => true
  32253. *
  32254. * _.inRange(4, 2);
  32255. * // => false
  32256. *
  32257. * _.inRange(2, 2);
  32258. * // => false
  32259. *
  32260. * _.inRange(1.2, 2);
  32261. * // => true
  32262. *
  32263. * _.inRange(5.2, 4);
  32264. * // => false
  32265. *
  32266. * _.inRange(-3, -2, -6);
  32267. * // => true
  32268. */
  32269. function inRange(number, start, end) {
  32270. start = toFinite(start);
  32271. if (end === undefined) {
  32272. end = start;
  32273. start = 0;
  32274. } else {
  32275. end = toFinite(end);
  32276. }
  32277. number = toNumber(number);
  32278. return baseInRange(number, start, end);
  32279. }
  32280. /**
  32281. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32282. * If only one argument is provided a number between `0` and the given number
  32283. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32284. * floats, a floating-point number is returned instead of an integer.
  32285. *
  32286. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32287. * floating-point values which can produce unexpected results.
  32288. *
  32289. * @static
  32290. * @memberOf _
  32291. * @since 0.7.0
  32292. * @category Number
  32293. * @param {number} [lower=0] The lower bound.
  32294. * @param {number} [upper=1] The upper bound.
  32295. * @param {boolean} [floating] Specify returning a floating-point number.
  32296. * @returns {number} Returns the random number.
  32297. * @example
  32298. *
  32299. * _.random(0, 5);
  32300. * // => an integer between 0 and 5
  32301. *
  32302. * _.random(5);
  32303. * // => also an integer between 0 and 5
  32304. *
  32305. * _.random(5, true);
  32306. * // => a floating-point number between 0 and 5
  32307. *
  32308. * _.random(1.2, 5.2);
  32309. * // => a floating-point number between 1.2 and 5.2
  32310. */
  32311. function random(lower, upper, floating) {
  32312. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32313. upper = floating = undefined;
  32314. }
  32315. if (floating === undefined) {
  32316. if (typeof upper == 'boolean') {
  32317. floating = upper;
  32318. upper = undefined;
  32319. }
  32320. else if (typeof lower == 'boolean') {
  32321. floating = lower;
  32322. lower = undefined;
  32323. }
  32324. }
  32325. if (lower === undefined && upper === undefined) {
  32326. lower = 0;
  32327. upper = 1;
  32328. }
  32329. else {
  32330. lower = toFinite(lower);
  32331. if (upper === undefined) {
  32332. upper = lower;
  32333. lower = 0;
  32334. } else {
  32335. upper = toFinite(upper);
  32336. }
  32337. }
  32338. if (lower > upper) {
  32339. var temp = lower;
  32340. lower = upper;
  32341. upper = temp;
  32342. }
  32343. if (floating || lower % 1 || upper % 1) {
  32344. var rand = nativeRandom();
  32345. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32346. }
  32347. return baseRandom(lower, upper);
  32348. }
  32349. /*------------------------------------------------------------------------*/
  32350. /**
  32351. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32352. *
  32353. * @static
  32354. * @memberOf _
  32355. * @since 3.0.0
  32356. * @category String
  32357. * @param {string} [string=''] The string to convert.
  32358. * @returns {string} Returns the camel cased string.
  32359. * @example
  32360. *
  32361. * _.camelCase('Foo Bar');
  32362. * // => 'fooBar'
  32363. *
  32364. * _.camelCase('--foo-bar--');
  32365. * // => 'fooBar'
  32366. *
  32367. * _.camelCase('__FOO_BAR__');
  32368. * // => 'fooBar'
  32369. */
  32370. var camelCase = createCompounder(function(result, word, index) {
  32371. word = word.toLowerCase();
  32372. return result + (index ? capitalize(word) : word);
  32373. });
  32374. /**
  32375. * Converts the first character of `string` to upper case and the remaining
  32376. * to lower case.
  32377. *
  32378. * @static
  32379. * @memberOf _
  32380. * @since 3.0.0
  32381. * @category String
  32382. * @param {string} [string=''] The string to capitalize.
  32383. * @returns {string} Returns the capitalized string.
  32384. * @example
  32385. *
  32386. * _.capitalize('FRED');
  32387. * // => 'Fred'
  32388. */
  32389. function capitalize(string) {
  32390. return upperFirst(toString(string).toLowerCase());
  32391. }
  32392. /**
  32393. * Deburrs `string` by converting
  32394. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32395. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32396. * letters to basic Latin letters and removing
  32397. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32398. *
  32399. * @static
  32400. * @memberOf _
  32401. * @since 3.0.0
  32402. * @category String
  32403. * @param {string} [string=''] The string to deburr.
  32404. * @returns {string} Returns the deburred string.
  32405. * @example
  32406. *
  32407. * _.deburr('déjà vu');
  32408. * // => 'deja vu'
  32409. */
  32410. function deburr(string) {
  32411. string = toString(string);
  32412. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32413. }
  32414. /**
  32415. * Checks if `string` ends with the given target string.
  32416. *
  32417. * @static
  32418. * @memberOf _
  32419. * @since 3.0.0
  32420. * @category String
  32421. * @param {string} [string=''] The string to inspect.
  32422. * @param {string} [target] The string to search for.
  32423. * @param {number} [position=string.length] The position to search up to.
  32424. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32425. * else `false`.
  32426. * @example
  32427. *
  32428. * _.endsWith('abc', 'c');
  32429. * // => true
  32430. *
  32431. * _.endsWith('abc', 'b');
  32432. * // => false
  32433. *
  32434. * _.endsWith('abc', 'b', 2);
  32435. * // => true
  32436. */
  32437. function endsWith(string, target, position) {
  32438. string = toString(string);
  32439. target = baseToString(target);
  32440. var length = string.length;
  32441. position = position === undefined
  32442. ? length
  32443. : baseClamp(toInteger(position), 0, length);
  32444. var end = position;
  32445. position -= target.length;
  32446. return position >= 0 && string.slice(position, end) == target;
  32447. }
  32448. /**
  32449. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32450. * corresponding HTML entities.
  32451. *
  32452. * **Note:** No other characters are escaped. To escape additional
  32453. * characters use a third-party library like [_he_](https://mths.be/he).
  32454. *
  32455. * Though the ">" character is escaped for symmetry, characters like
  32456. * ">" and "/" don't need escaping in HTML and have no special meaning
  32457. * unless they're part of a tag or unquoted attribute value. See
  32458. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32459. * (under "semi-related fun fact") for more details.
  32460. *
  32461. * When working with HTML you should always
  32462. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32463. * XSS vectors.
  32464. *
  32465. * @static
  32466. * @since 0.1.0
  32467. * @memberOf _
  32468. * @category String
  32469. * @param {string} [string=''] The string to escape.
  32470. * @returns {string} Returns the escaped string.
  32471. * @example
  32472. *
  32473. * _.escape('fred, barney, & pebbles');
  32474. * // => 'fred, barney, &amp; pebbles'
  32475. */
  32476. function escape(string) {
  32477. string = toString(string);
  32478. return (string && reHasUnescapedHtml.test(string))
  32479. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32480. : string;
  32481. }
  32482. /**
  32483. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32484. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32485. *
  32486. * @static
  32487. * @memberOf _
  32488. * @since 3.0.0
  32489. * @category String
  32490. * @param {string} [string=''] The string to escape.
  32491. * @returns {string} Returns the escaped string.
  32492. * @example
  32493. *
  32494. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32495. * // => '\[lodash\]\(https://lodash\.com/\)'
  32496. */
  32497. function escapeRegExp(string) {
  32498. string = toString(string);
  32499. return (string && reHasRegExpChar.test(string))
  32500. ? string.replace(reRegExpChar, '\\$&')
  32501. : string;
  32502. }
  32503. /**
  32504. * Converts `string` to
  32505. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32506. *
  32507. * @static
  32508. * @memberOf _
  32509. * @since 3.0.0
  32510. * @category String
  32511. * @param {string} [string=''] The string to convert.
  32512. * @returns {string} Returns the kebab cased string.
  32513. * @example
  32514. *
  32515. * _.kebabCase('Foo Bar');
  32516. * // => 'foo-bar'
  32517. *
  32518. * _.kebabCase('fooBar');
  32519. * // => 'foo-bar'
  32520. *
  32521. * _.kebabCase('__FOO_BAR__');
  32522. * // => 'foo-bar'
  32523. */
  32524. var kebabCase = createCompounder(function(result, word, index) {
  32525. return result + (index ? '-' : '') + word.toLowerCase();
  32526. });
  32527. /**
  32528. * Converts `string`, as space separated words, to lower case.
  32529. *
  32530. * @static
  32531. * @memberOf _
  32532. * @since 4.0.0
  32533. * @category String
  32534. * @param {string} [string=''] The string to convert.
  32535. * @returns {string} Returns the lower cased string.
  32536. * @example
  32537. *
  32538. * _.lowerCase('--Foo-Bar--');
  32539. * // => 'foo bar'
  32540. *
  32541. * _.lowerCase('fooBar');
  32542. * // => 'foo bar'
  32543. *
  32544. * _.lowerCase('__FOO_BAR__');
  32545. * // => 'foo bar'
  32546. */
  32547. var lowerCase = createCompounder(function(result, word, index) {
  32548. return result + (index ? ' ' : '') + word.toLowerCase();
  32549. });
  32550. /**
  32551. * Converts the first character of `string` to lower case.
  32552. *
  32553. * @static
  32554. * @memberOf _
  32555. * @since 4.0.0
  32556. * @category String
  32557. * @param {string} [string=''] The string to convert.
  32558. * @returns {string} Returns the converted string.
  32559. * @example
  32560. *
  32561. * _.lowerFirst('Fred');
  32562. * // => 'fred'
  32563. *
  32564. * _.lowerFirst('FRED');
  32565. * // => 'fRED'
  32566. */
  32567. var lowerFirst = createCaseFirst('toLowerCase');
  32568. /**
  32569. * Pads `string` on the left and right sides if it's shorter than `length`.
  32570. * Padding characters are truncated if they can't be evenly divided by `length`.
  32571. *
  32572. * @static
  32573. * @memberOf _
  32574. * @since 3.0.0
  32575. * @category String
  32576. * @param {string} [string=''] The string to pad.
  32577. * @param {number} [length=0] The padding length.
  32578. * @param {string} [chars=' '] The string used as padding.
  32579. * @returns {string} Returns the padded string.
  32580. * @example
  32581. *
  32582. * _.pad('abc', 8);
  32583. * // => ' abc '
  32584. *
  32585. * _.pad('abc', 8, '_-');
  32586. * // => '_-abc_-_'
  32587. *
  32588. * _.pad('abc', 3);
  32589. * // => 'abc'
  32590. */
  32591. function pad(string, length, chars) {
  32592. string = toString(string);
  32593. length = toInteger(length);
  32594. var strLength = length ? stringSize(string) : 0;
  32595. if (!length || strLength >= length) {
  32596. return string;
  32597. }
  32598. var mid = (length - strLength) / 2;
  32599. return (
  32600. createPadding(nativeFloor(mid), chars) +
  32601. string +
  32602. createPadding(nativeCeil(mid), chars)
  32603. );
  32604. }
  32605. /**
  32606. * Pads `string` on the right side if it's shorter than `length`. Padding
  32607. * characters are truncated if they exceed `length`.
  32608. *
  32609. * @static
  32610. * @memberOf _
  32611. * @since 4.0.0
  32612. * @category String
  32613. * @param {string} [string=''] The string to pad.
  32614. * @param {number} [length=0] The padding length.
  32615. * @param {string} [chars=' '] The string used as padding.
  32616. * @returns {string} Returns the padded string.
  32617. * @example
  32618. *
  32619. * _.padEnd('abc', 6);
  32620. * // => 'abc '
  32621. *
  32622. * _.padEnd('abc', 6, '_-');
  32623. * // => 'abc_-_'
  32624. *
  32625. * _.padEnd('abc', 3);
  32626. * // => 'abc'
  32627. */
  32628. function padEnd(string, length, chars) {
  32629. string = toString(string);
  32630. length = toInteger(length);
  32631. var strLength = length ? stringSize(string) : 0;
  32632. return (length && strLength < length)
  32633. ? (string + createPadding(length - strLength, chars))
  32634. : string;
  32635. }
  32636. /**
  32637. * Pads `string` on the left side if it's shorter than `length`. Padding
  32638. * characters are truncated if they exceed `length`.
  32639. *
  32640. * @static
  32641. * @memberOf _
  32642. * @since 4.0.0
  32643. * @category String
  32644. * @param {string} [string=''] The string to pad.
  32645. * @param {number} [length=0] The padding length.
  32646. * @param {string} [chars=' '] The string used as padding.
  32647. * @returns {string} Returns the padded string.
  32648. * @example
  32649. *
  32650. * _.padStart('abc', 6);
  32651. * // => ' abc'
  32652. *
  32653. * _.padStart('abc', 6, '_-');
  32654. * // => '_-_abc'
  32655. *
  32656. * _.padStart('abc', 3);
  32657. * // => 'abc'
  32658. */
  32659. function padStart(string, length, chars) {
  32660. string = toString(string);
  32661. length = toInteger(length);
  32662. var strLength = length ? stringSize(string) : 0;
  32663. return (length && strLength < length)
  32664. ? (createPadding(length - strLength, chars) + string)
  32665. : string;
  32666. }
  32667. /**
  32668. * Converts `string` to an integer of the specified radix. If `radix` is
  32669. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32670. * hexadecimal, in which case a `radix` of `16` is used.
  32671. *
  32672. * **Note:** This method aligns with the
  32673. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32674. *
  32675. * @static
  32676. * @memberOf _
  32677. * @since 1.1.0
  32678. * @category String
  32679. * @param {string} string The string to convert.
  32680. * @param {number} [radix=10] The radix to interpret `value` by.
  32681. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32682. * @returns {number} Returns the converted integer.
  32683. * @example
  32684. *
  32685. * _.parseInt('08');
  32686. * // => 8
  32687. *
  32688. * _.map(['6', '08', '10'], _.parseInt);
  32689. * // => [6, 8, 10]
  32690. */
  32691. function parseInt(string, radix, guard) {
  32692. if (guard || radix == null) {
  32693. radix = 0;
  32694. } else if (radix) {
  32695. radix = +radix;
  32696. }
  32697. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32698. }
  32699. /**
  32700. * Repeats the given string `n` times.
  32701. *
  32702. * @static
  32703. * @memberOf _
  32704. * @since 3.0.0
  32705. * @category String
  32706. * @param {string} [string=''] The string to repeat.
  32707. * @param {number} [n=1] The number of times to repeat the string.
  32708. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32709. * @returns {string} Returns the repeated string.
  32710. * @example
  32711. *
  32712. * _.repeat('*', 3);
  32713. * // => '***'
  32714. *
  32715. * _.repeat('abc', 2);
  32716. * // => 'abcabc'
  32717. *
  32718. * _.repeat('abc', 0);
  32719. * // => ''
  32720. */
  32721. function repeat(string, n, guard) {
  32722. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32723. n = 1;
  32724. } else {
  32725. n = toInteger(n);
  32726. }
  32727. return baseRepeat(toString(string), n);
  32728. }
  32729. /**
  32730. * Replaces matches for `pattern` in `string` with `replacement`.
  32731. *
  32732. * **Note:** This method is based on
  32733. * [`String#replace`](https://mdn.io/String/replace).
  32734. *
  32735. * @static
  32736. * @memberOf _
  32737. * @since 4.0.0
  32738. * @category String
  32739. * @param {string} [string=''] The string to modify.
  32740. * @param {RegExp|string} pattern The pattern to replace.
  32741. * @param {Function|string} replacement The match replacement.
  32742. * @returns {string} Returns the modified string.
  32743. * @example
  32744. *
  32745. * _.replace('Hi Fred', 'Fred', 'Barney');
  32746. * // => 'Hi Barney'
  32747. */
  32748. function replace() {
  32749. var args = arguments,
  32750. string = toString(args[0]);
  32751. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32752. }
  32753. /**
  32754. * Converts `string` to
  32755. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32756. *
  32757. * @static
  32758. * @memberOf _
  32759. * @since 3.0.0
  32760. * @category String
  32761. * @param {string} [string=''] The string to convert.
  32762. * @returns {string} Returns the snake cased string.
  32763. * @example
  32764. *
  32765. * _.snakeCase('Foo Bar');
  32766. * // => 'foo_bar'
  32767. *
  32768. * _.snakeCase('fooBar');
  32769. * // => 'foo_bar'
  32770. *
  32771. * _.snakeCase('--FOO-BAR--');
  32772. * // => 'foo_bar'
  32773. */
  32774. var snakeCase = createCompounder(function(result, word, index) {
  32775. return result + (index ? '_' : '') + word.toLowerCase();
  32776. });
  32777. /**
  32778. * Splits `string` by `separator`.
  32779. *
  32780. * **Note:** This method is based on
  32781. * [`String#split`](https://mdn.io/String/split).
  32782. *
  32783. * @static
  32784. * @memberOf _
  32785. * @since 4.0.0
  32786. * @category String
  32787. * @param {string} [string=''] The string to split.
  32788. * @param {RegExp|string} separator The separator pattern to split by.
  32789. * @param {number} [limit] The length to truncate results to.
  32790. * @returns {Array} Returns the string segments.
  32791. * @example
  32792. *
  32793. * _.split('a-b-c', '-', 2);
  32794. * // => ['a', 'b']
  32795. */
  32796. function split(string, separator, limit) {
  32797. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32798. separator = limit = undefined;
  32799. }
  32800. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32801. if (!limit) {
  32802. return [];
  32803. }
  32804. string = toString(string);
  32805. if (string && (
  32806. typeof separator == 'string' ||
  32807. (separator != null && !isRegExp(separator))
  32808. )) {
  32809. separator = baseToString(separator);
  32810. if (!separator && hasUnicode(string)) {
  32811. return castSlice(stringToArray(string), 0, limit);
  32812. }
  32813. }
  32814. return string.split(separator, limit);
  32815. }
  32816. /**
  32817. * Converts `string` to
  32818. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32819. *
  32820. * @static
  32821. * @memberOf _
  32822. * @since 3.1.0
  32823. * @category String
  32824. * @param {string} [string=''] The string to convert.
  32825. * @returns {string} Returns the start cased string.
  32826. * @example
  32827. *
  32828. * _.startCase('--foo-bar--');
  32829. * // => 'Foo Bar'
  32830. *
  32831. * _.startCase('fooBar');
  32832. * // => 'Foo Bar'
  32833. *
  32834. * _.startCase('__FOO_BAR__');
  32835. * // => 'FOO BAR'
  32836. */
  32837. var startCase = createCompounder(function(result, word, index) {
  32838. return result + (index ? ' ' : '') + upperFirst(word);
  32839. });
  32840. /**
  32841. * Checks if `string` starts with the given target string.
  32842. *
  32843. * @static
  32844. * @memberOf _
  32845. * @since 3.0.0
  32846. * @category String
  32847. * @param {string} [string=''] The string to inspect.
  32848. * @param {string} [target] The string to search for.
  32849. * @param {number} [position=0] The position to search from.
  32850. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32851. * else `false`.
  32852. * @example
  32853. *
  32854. * _.startsWith('abc', 'a');
  32855. * // => true
  32856. *
  32857. * _.startsWith('abc', 'b');
  32858. * // => false
  32859. *
  32860. * _.startsWith('abc', 'b', 1);
  32861. * // => true
  32862. */
  32863. function startsWith(string, target, position) {
  32864. string = toString(string);
  32865. position = position == null
  32866. ? 0
  32867. : baseClamp(toInteger(position), 0, string.length);
  32868. target = baseToString(target);
  32869. return string.slice(position, position + target.length) == target;
  32870. }
  32871. /**
  32872. * Creates a compiled template function that can interpolate data properties
  32873. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32874. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32875. * properties may be accessed as free variables in the template. If a setting
  32876. * object is given, it takes precedence over `_.templateSettings` values.
  32877. *
  32878. * **Note:** In the development build `_.template` utilizes
  32879. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32880. * for easier debugging.
  32881. *
  32882. * For more information on precompiling templates see
  32883. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32884. *
  32885. * For more information on Chrome extension sandboxes see
  32886. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32887. *
  32888. * @static
  32889. * @since 0.1.0
  32890. * @memberOf _
  32891. * @category String
  32892. * @param {string} [string=''] The template string.
  32893. * @param {Object} [options={}] The options object.
  32894. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32895. * The HTML "escape" delimiter.
  32896. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32897. * The "evaluate" delimiter.
  32898. * @param {Object} [options.imports=_.templateSettings.imports]
  32899. * An object to import into the template as free variables.
  32900. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32901. * The "interpolate" delimiter.
  32902. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32903. * The sourceURL of the compiled template.
  32904. * @param {string} [options.variable='obj']
  32905. * The data object variable name.
  32906. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32907. * @returns {Function} Returns the compiled template function.
  32908. * @example
  32909. *
  32910. * // Use the "interpolate" delimiter to create a compiled template.
  32911. * var compiled = _.template('hello <%= user %>!');
  32912. * compiled({ 'user': 'fred' });
  32913. * // => 'hello fred!'
  32914. *
  32915. * // Use the HTML "escape" delimiter to escape data property values.
  32916. * var compiled = _.template('<b><%- value %></b>');
  32917. * compiled({ 'value': '<script>' });
  32918. * // => '<b>&lt;script&gt;</b>'
  32919. *
  32920. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32921. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32922. * compiled({ 'users': ['fred', 'barney'] });
  32923. * // => '<li>fred</li><li>barney</li>'
  32924. *
  32925. * // Use the internal `print` function in "evaluate" delimiters.
  32926. * var compiled = _.template('<% print("hello " + user); %>!');
  32927. * compiled({ 'user': 'barney' });
  32928. * // => 'hello barney!'
  32929. *
  32930. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32931. * // Disable support by replacing the "interpolate" delimiter.
  32932. * var compiled = _.template('hello ${ user }!');
  32933. * compiled({ 'user': 'pebbles' });
  32934. * // => 'hello pebbles!'
  32935. *
  32936. * // Use backslashes to treat delimiters as plain text.
  32937. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32938. * compiled({ 'value': 'ignored' });
  32939. * // => '<%- value %>'
  32940. *
  32941. * // Use the `imports` option to import `jQuery` as `jq`.
  32942. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32943. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32944. * compiled({ 'users': ['fred', 'barney'] });
  32945. * // => '<li>fred</li><li>barney</li>'
  32946. *
  32947. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32948. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32949. * compiled(data);
  32950. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32951. *
  32952. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32953. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32954. * compiled.source;
  32955. * // => function(data) {
  32956. * // var __t, __p = '';
  32957. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32958. * // return __p;
  32959. * // }
  32960. *
  32961. * // Use custom template delimiters.
  32962. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32963. * var compiled = _.template('hello {{ user }}!');
  32964. * compiled({ 'user': 'mustache' });
  32965. * // => 'hello mustache!'
  32966. *
  32967. * // Use the `source` property to inline compiled templates for meaningful
  32968. * // line numbers in error messages and stack traces.
  32969. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32970. * var JST = {\
  32971. * "main": ' + _.template(mainText).source + '\
  32972. * };\
  32973. * ');
  32974. */
  32975. function template(string, options, guard) {
  32976. // Based on John Resig's `tmpl` implementation
  32977. // (http://ejohn.org/blog/javascript-micro-templating/)
  32978. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32979. var settings = lodash.templateSettings;
  32980. if (guard && isIterateeCall(string, options, guard)) {
  32981. options = undefined;
  32982. }
  32983. string = toString(string);
  32984. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32985. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32986. importsKeys = keys(imports),
  32987. importsValues = baseValues(imports, importsKeys);
  32988. var isEscaping,
  32989. isEvaluating,
  32990. index = 0,
  32991. interpolate = options.interpolate || reNoMatch,
  32992. source = "__p += '";
  32993. // Compile the regexp to match each delimiter.
  32994. var reDelimiters = RegExp(
  32995. (options.escape || reNoMatch).source + '|' +
  32996. interpolate.source + '|' +
  32997. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32998. (options.evaluate || reNoMatch).source + '|$'
  32999. , 'g');
  33000. // Use a sourceURL for easier debugging.
  33001. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33002. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33003. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33004. var sourceURL = '//# sourceURL=' +
  33005. (hasOwnProperty.call(options, 'sourceURL')
  33006. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33007. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33008. ) + '\n';
  33009. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33010. interpolateValue || (interpolateValue = esTemplateValue);
  33011. // Escape characters that can't be included in string literals.
  33012. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33013. // Replace delimiters with snippets.
  33014. if (escapeValue) {
  33015. isEscaping = true;
  33016. source += "' +\n__e(" + escapeValue + ") +\n'";
  33017. }
  33018. if (evaluateValue) {
  33019. isEvaluating = true;
  33020. source += "';\n" + evaluateValue + ";\n__p += '";
  33021. }
  33022. if (interpolateValue) {
  33023. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33024. }
  33025. index = offset + match.length;
  33026. // The JS engine embedded in Adobe products needs `match` returned in
  33027. // order to produce the correct `offset` value.
  33028. return match;
  33029. });
  33030. source += "';\n";
  33031. // If `variable` is not specified wrap a with-statement around the generated
  33032. // code to add the data object to the top of the scope chain.
  33033. // Like with sourceURL, we take care to not check the option's prototype,
  33034. // as this configuration is a code injection vector.
  33035. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33036. if (!variable) {
  33037. source = 'with (obj) {\n' + source + '\n}\n';
  33038. }
  33039. // Cleanup code by stripping empty strings.
  33040. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33041. .replace(reEmptyStringMiddle, '$1')
  33042. .replace(reEmptyStringTrailing, '$1;');
  33043. // Frame code as the function body.
  33044. source = 'function(' + (variable || 'obj') + ') {\n' +
  33045. (variable
  33046. ? ''
  33047. : 'obj || (obj = {});\n'
  33048. ) +
  33049. "var __t, __p = ''" +
  33050. (isEscaping
  33051. ? ', __e = _.escape'
  33052. : ''
  33053. ) +
  33054. (isEvaluating
  33055. ? ', __j = Array.prototype.join;\n' +
  33056. "function print() { __p += __j.call(arguments, '') }\n"
  33057. : ';\n'
  33058. ) +
  33059. source +
  33060. 'return __p\n}';
  33061. var result = attempt(function() {
  33062. return Function(importsKeys, sourceURL + 'return ' + source)
  33063. .apply(undefined, importsValues);
  33064. });
  33065. // Provide the compiled function's source by its `toString` method or
  33066. // the `source` property as a convenience for inlining compiled templates.
  33067. result.source = source;
  33068. if (isError(result)) {
  33069. throw result;
  33070. }
  33071. return result;
  33072. }
  33073. /**
  33074. * Converts `string`, as a whole, to lower case just like
  33075. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33076. *
  33077. * @static
  33078. * @memberOf _
  33079. * @since 4.0.0
  33080. * @category String
  33081. * @param {string} [string=''] The string to convert.
  33082. * @returns {string} Returns the lower cased string.
  33083. * @example
  33084. *
  33085. * _.toLower('--Foo-Bar--');
  33086. * // => '--foo-bar--'
  33087. *
  33088. * _.toLower('fooBar');
  33089. * // => 'foobar'
  33090. *
  33091. * _.toLower('__FOO_BAR__');
  33092. * // => '__foo_bar__'
  33093. */
  33094. function toLower(value) {
  33095. return toString(value).toLowerCase();
  33096. }
  33097. /**
  33098. * Converts `string`, as a whole, to upper case just like
  33099. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33100. *
  33101. * @static
  33102. * @memberOf _
  33103. * @since 4.0.0
  33104. * @category String
  33105. * @param {string} [string=''] The string to convert.
  33106. * @returns {string} Returns the upper cased string.
  33107. * @example
  33108. *
  33109. * _.toUpper('--foo-bar--');
  33110. * // => '--FOO-BAR--'
  33111. *
  33112. * _.toUpper('fooBar');
  33113. * // => 'FOOBAR'
  33114. *
  33115. * _.toUpper('__foo_bar__');
  33116. * // => '__FOO_BAR__'
  33117. */
  33118. function toUpper(value) {
  33119. return toString(value).toUpperCase();
  33120. }
  33121. /**
  33122. * Removes leading and trailing whitespace or specified characters from `string`.
  33123. *
  33124. * @static
  33125. * @memberOf _
  33126. * @since 3.0.0
  33127. * @category String
  33128. * @param {string} [string=''] The string to trim.
  33129. * @param {string} [chars=whitespace] The characters to trim.
  33130. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33131. * @returns {string} Returns the trimmed string.
  33132. * @example
  33133. *
  33134. * _.trim(' abc ');
  33135. * // => 'abc'
  33136. *
  33137. * _.trim('-_-abc-_-', '_-');
  33138. * // => 'abc'
  33139. *
  33140. * _.map([' foo ', ' bar '], _.trim);
  33141. * // => ['foo', 'bar']
  33142. */
  33143. function trim(string, chars, guard) {
  33144. string = toString(string);
  33145. if (string && (guard || chars === undefined)) {
  33146. return string.replace(reTrim, '');
  33147. }
  33148. if (!string || !(chars = baseToString(chars))) {
  33149. return string;
  33150. }
  33151. var strSymbols = stringToArray(string),
  33152. chrSymbols = stringToArray(chars),
  33153. start = charsStartIndex(strSymbols, chrSymbols),
  33154. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33155. return castSlice(strSymbols, start, end).join('');
  33156. }
  33157. /**
  33158. * Removes trailing whitespace or specified characters from `string`.
  33159. *
  33160. * @static
  33161. * @memberOf _
  33162. * @since 4.0.0
  33163. * @category String
  33164. * @param {string} [string=''] The string to trim.
  33165. * @param {string} [chars=whitespace] The characters to trim.
  33166. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33167. * @returns {string} Returns the trimmed string.
  33168. * @example
  33169. *
  33170. * _.trimEnd(' abc ');
  33171. * // => ' abc'
  33172. *
  33173. * _.trimEnd('-_-abc-_-', '_-');
  33174. * // => '-_-abc'
  33175. */
  33176. function trimEnd(string, chars, guard) {
  33177. string = toString(string);
  33178. if (string && (guard || chars === undefined)) {
  33179. return string.replace(reTrimEnd, '');
  33180. }
  33181. if (!string || !(chars = baseToString(chars))) {
  33182. return string;
  33183. }
  33184. var strSymbols = stringToArray(string),
  33185. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33186. return castSlice(strSymbols, 0, end).join('');
  33187. }
  33188. /**
  33189. * Removes leading whitespace or specified characters from `string`.
  33190. *
  33191. * @static
  33192. * @memberOf _
  33193. * @since 4.0.0
  33194. * @category String
  33195. * @param {string} [string=''] The string to trim.
  33196. * @param {string} [chars=whitespace] The characters to trim.
  33197. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33198. * @returns {string} Returns the trimmed string.
  33199. * @example
  33200. *
  33201. * _.trimStart(' abc ');
  33202. * // => 'abc '
  33203. *
  33204. * _.trimStart('-_-abc-_-', '_-');
  33205. * // => 'abc-_-'
  33206. */
  33207. function trimStart(string, chars, guard) {
  33208. string = toString(string);
  33209. if (string && (guard || chars === undefined)) {
  33210. return string.replace(reTrimStart, '');
  33211. }
  33212. if (!string || !(chars = baseToString(chars))) {
  33213. return string;
  33214. }
  33215. var strSymbols = stringToArray(string),
  33216. start = charsStartIndex(strSymbols, stringToArray(chars));
  33217. return castSlice(strSymbols, start).join('');
  33218. }
  33219. /**
  33220. * Truncates `string` if it's longer than the given maximum string length.
  33221. * The last characters of the truncated string are replaced with the omission
  33222. * string which defaults to "...".
  33223. *
  33224. * @static
  33225. * @memberOf _
  33226. * @since 4.0.0
  33227. * @category String
  33228. * @param {string} [string=''] The string to truncate.
  33229. * @param {Object} [options={}] The options object.
  33230. * @param {number} [options.length=30] The maximum string length.
  33231. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33232. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33233. * @returns {string} Returns the truncated string.
  33234. * @example
  33235. *
  33236. * _.truncate('hi-diddly-ho there, neighborino');
  33237. * // => 'hi-diddly-ho there, neighbo...'
  33238. *
  33239. * _.truncate('hi-diddly-ho there, neighborino', {
  33240. * 'length': 24,
  33241. * 'separator': ' '
  33242. * });
  33243. * // => 'hi-diddly-ho there,...'
  33244. *
  33245. * _.truncate('hi-diddly-ho there, neighborino', {
  33246. * 'length': 24,
  33247. * 'separator': /,? +/
  33248. * });
  33249. * // => 'hi-diddly-ho there...'
  33250. *
  33251. * _.truncate('hi-diddly-ho there, neighborino', {
  33252. * 'omission': ' [...]'
  33253. * });
  33254. * // => 'hi-diddly-ho there, neig [...]'
  33255. */
  33256. function truncate(string, options) {
  33257. var length = DEFAULT_TRUNC_LENGTH,
  33258. omission = DEFAULT_TRUNC_OMISSION;
  33259. if (isObject(options)) {
  33260. var separator = 'separator' in options ? options.separator : separator;
  33261. length = 'length' in options ? toInteger(options.length) : length;
  33262. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33263. }
  33264. string = toString(string);
  33265. var strLength = string.length;
  33266. if (hasUnicode(string)) {
  33267. var strSymbols = stringToArray(string);
  33268. strLength = strSymbols.length;
  33269. }
  33270. if (length >= strLength) {
  33271. return string;
  33272. }
  33273. var end = length - stringSize(omission);
  33274. if (end < 1) {
  33275. return omission;
  33276. }
  33277. var result = strSymbols
  33278. ? castSlice(strSymbols, 0, end).join('')
  33279. : string.slice(0, end);
  33280. if (separator === undefined) {
  33281. return result + omission;
  33282. }
  33283. if (strSymbols) {
  33284. end += (result.length - end);
  33285. }
  33286. if (isRegExp(separator)) {
  33287. if (string.slice(end).search(separator)) {
  33288. var match,
  33289. substring = result;
  33290. if (!separator.global) {
  33291. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33292. }
  33293. separator.lastIndex = 0;
  33294. while ((match = separator.exec(substring))) {
  33295. var newEnd = match.index;
  33296. }
  33297. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33298. }
  33299. } else if (string.indexOf(baseToString(separator), end) != end) {
  33300. var index = result.lastIndexOf(separator);
  33301. if (index > -1) {
  33302. result = result.slice(0, index);
  33303. }
  33304. }
  33305. return result + omission;
  33306. }
  33307. /**
  33308. * The inverse of `_.escape`; this method converts the HTML entities
  33309. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33310. * their corresponding characters.
  33311. *
  33312. * **Note:** No other HTML entities are unescaped. To unescape additional
  33313. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33314. *
  33315. * @static
  33316. * @memberOf _
  33317. * @since 0.6.0
  33318. * @category String
  33319. * @param {string} [string=''] The string to unescape.
  33320. * @returns {string} Returns the unescaped string.
  33321. * @example
  33322. *
  33323. * _.unescape('fred, barney, &amp; pebbles');
  33324. * // => 'fred, barney, & pebbles'
  33325. */
  33326. function unescape(string) {
  33327. string = toString(string);
  33328. return (string && reHasEscapedHtml.test(string))
  33329. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33330. : string;
  33331. }
  33332. /**
  33333. * Converts `string`, as space separated words, to upper case.
  33334. *
  33335. * @static
  33336. * @memberOf _
  33337. * @since 4.0.0
  33338. * @category String
  33339. * @param {string} [string=''] The string to convert.
  33340. * @returns {string} Returns the upper cased string.
  33341. * @example
  33342. *
  33343. * _.upperCase('--foo-bar');
  33344. * // => 'FOO BAR'
  33345. *
  33346. * _.upperCase('fooBar');
  33347. * // => 'FOO BAR'
  33348. *
  33349. * _.upperCase('__foo_bar__');
  33350. * // => 'FOO BAR'
  33351. */
  33352. var upperCase = createCompounder(function(result, word, index) {
  33353. return result + (index ? ' ' : '') + word.toUpperCase();
  33354. });
  33355. /**
  33356. * Converts the first character of `string` to upper case.
  33357. *
  33358. * @static
  33359. * @memberOf _
  33360. * @since 4.0.0
  33361. * @category String
  33362. * @param {string} [string=''] The string to convert.
  33363. * @returns {string} Returns the converted string.
  33364. * @example
  33365. *
  33366. * _.upperFirst('fred');
  33367. * // => 'Fred'
  33368. *
  33369. * _.upperFirst('FRED');
  33370. * // => 'FRED'
  33371. */
  33372. var upperFirst = createCaseFirst('toUpperCase');
  33373. /**
  33374. * Splits `string` into an array of its words.
  33375. *
  33376. * @static
  33377. * @memberOf _
  33378. * @since 3.0.0
  33379. * @category String
  33380. * @param {string} [string=''] The string to inspect.
  33381. * @param {RegExp|string} [pattern] The pattern to match words.
  33382. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33383. * @returns {Array} Returns the words of `string`.
  33384. * @example
  33385. *
  33386. * _.words('fred, barney, & pebbles');
  33387. * // => ['fred', 'barney', 'pebbles']
  33388. *
  33389. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33390. * // => ['fred', 'barney', '&', 'pebbles']
  33391. */
  33392. function words(string, pattern, guard) {
  33393. string = toString(string);
  33394. pattern = guard ? undefined : pattern;
  33395. if (pattern === undefined) {
  33396. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33397. }
  33398. return string.match(pattern) || [];
  33399. }
  33400. /*------------------------------------------------------------------------*/
  33401. /**
  33402. * Attempts to invoke `func`, returning either the result or the caught error
  33403. * object. Any additional arguments are provided to `func` when it's invoked.
  33404. *
  33405. * @static
  33406. * @memberOf _
  33407. * @since 3.0.0
  33408. * @category Util
  33409. * @param {Function} func The function to attempt.
  33410. * @param {...*} [args] The arguments to invoke `func` with.
  33411. * @returns {*} Returns the `func` result or error object.
  33412. * @example
  33413. *
  33414. * // Avoid throwing errors for invalid selectors.
  33415. * var elements = _.attempt(function(selector) {
  33416. * return document.querySelectorAll(selector);
  33417. * }, '>_>');
  33418. *
  33419. * if (_.isError(elements)) {
  33420. * elements = [];
  33421. * }
  33422. */
  33423. var attempt = baseRest(function(func, args) {
  33424. try {
  33425. return apply(func, undefined, args);
  33426. } catch (e) {
  33427. return isError(e) ? e : new Error(e);
  33428. }
  33429. });
  33430. /**
  33431. * Binds methods of an object to the object itself, overwriting the existing
  33432. * method.
  33433. *
  33434. * **Note:** This method doesn't set the "length" property of bound functions.
  33435. *
  33436. * @static
  33437. * @since 0.1.0
  33438. * @memberOf _
  33439. * @category Util
  33440. * @param {Object} object The object to bind and assign the bound methods to.
  33441. * @param {...(string|string[])} methodNames The object method names to bind.
  33442. * @returns {Object} Returns `object`.
  33443. * @example
  33444. *
  33445. * var view = {
  33446. * 'label': 'docs',
  33447. * 'click': function() {
  33448. * console.log('clicked ' + this.label);
  33449. * }
  33450. * };
  33451. *
  33452. * _.bindAll(view, ['click']);
  33453. * jQuery(element).on('click', view.click);
  33454. * // => Logs 'clicked docs' when clicked.
  33455. */
  33456. var bindAll = flatRest(function(object, methodNames) {
  33457. arrayEach(methodNames, function(key) {
  33458. key = toKey(key);
  33459. baseAssignValue(object, key, bind(object[key], object));
  33460. });
  33461. return object;
  33462. });
  33463. /**
  33464. * Creates a function that iterates over `pairs` and invokes the corresponding
  33465. * function of the first predicate to return truthy. The predicate-function
  33466. * pairs are invoked with the `this` binding and arguments of the created
  33467. * function.
  33468. *
  33469. * @static
  33470. * @memberOf _
  33471. * @since 4.0.0
  33472. * @category Util
  33473. * @param {Array} pairs The predicate-function pairs.
  33474. * @returns {Function} Returns the new composite function.
  33475. * @example
  33476. *
  33477. * var func = _.cond([
  33478. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33479. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33480. * [_.stubTrue, _.constant('no match')]
  33481. * ]);
  33482. *
  33483. * func({ 'a': 1, 'b': 2 });
  33484. * // => 'matches A'
  33485. *
  33486. * func({ 'a': 0, 'b': 1 });
  33487. * // => 'matches B'
  33488. *
  33489. * func({ 'a': '1', 'b': '2' });
  33490. * // => 'no match'
  33491. */
  33492. function cond(pairs) {
  33493. var length = pairs == null ? 0 : pairs.length,
  33494. toIteratee = getIteratee();
  33495. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33496. if (typeof pair[1] != 'function') {
  33497. throw new TypeError(FUNC_ERROR_TEXT);
  33498. }
  33499. return [toIteratee(pair[0]), pair[1]];
  33500. });
  33501. return baseRest(function(args) {
  33502. var index = -1;
  33503. while (++index < length) {
  33504. var pair = pairs[index];
  33505. if (apply(pair[0], this, args)) {
  33506. return apply(pair[1], this, args);
  33507. }
  33508. }
  33509. });
  33510. }
  33511. /**
  33512. * Creates a function that invokes the predicate properties of `source` with
  33513. * the corresponding property values of a given object, returning `true` if
  33514. * all predicates return truthy, else `false`.
  33515. *
  33516. * **Note:** The created function is equivalent to `_.conformsTo` with
  33517. * `source` partially applied.
  33518. *
  33519. * @static
  33520. * @memberOf _
  33521. * @since 4.0.0
  33522. * @category Util
  33523. * @param {Object} source The object of property predicates to conform to.
  33524. * @returns {Function} Returns the new spec function.
  33525. * @example
  33526. *
  33527. * var objects = [
  33528. * { 'a': 2, 'b': 1 },
  33529. * { 'a': 1, 'b': 2 }
  33530. * ];
  33531. *
  33532. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33533. * // => [{ 'a': 1, 'b': 2 }]
  33534. */
  33535. function conforms(source) {
  33536. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33537. }
  33538. /**
  33539. * Creates a function that returns `value`.
  33540. *
  33541. * @static
  33542. * @memberOf _
  33543. * @since 2.4.0
  33544. * @category Util
  33545. * @param {*} value The value to return from the new function.
  33546. * @returns {Function} Returns the new constant function.
  33547. * @example
  33548. *
  33549. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33550. *
  33551. * console.log(objects);
  33552. * // => [{ 'a': 1 }, { 'a': 1 }]
  33553. *
  33554. * console.log(objects[0] === objects[1]);
  33555. * // => true
  33556. */
  33557. function constant(value) {
  33558. return function() {
  33559. return value;
  33560. };
  33561. }
  33562. /**
  33563. * Checks `value` to determine whether a default value should be returned in
  33564. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33565. * or `undefined`.
  33566. *
  33567. * @static
  33568. * @memberOf _
  33569. * @since 4.14.0
  33570. * @category Util
  33571. * @param {*} value The value to check.
  33572. * @param {*} defaultValue The default value.
  33573. * @returns {*} Returns the resolved value.
  33574. * @example
  33575. *
  33576. * _.defaultTo(1, 10);
  33577. * // => 1
  33578. *
  33579. * _.defaultTo(undefined, 10);
  33580. * // => 10
  33581. */
  33582. function defaultTo(value, defaultValue) {
  33583. return (value == null || value !== value) ? defaultValue : value;
  33584. }
  33585. /**
  33586. * Creates a function that returns the result of invoking the given functions
  33587. * with the `this` binding of the created function, where each successive
  33588. * invocation is supplied the return value of the previous.
  33589. *
  33590. * @static
  33591. * @memberOf _
  33592. * @since 3.0.0
  33593. * @category Util
  33594. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33595. * @returns {Function} Returns the new composite function.
  33596. * @see _.flowRight
  33597. * @example
  33598. *
  33599. * function square(n) {
  33600. * return n * n;
  33601. * }
  33602. *
  33603. * var addSquare = _.flow([_.add, square]);
  33604. * addSquare(1, 2);
  33605. * // => 9
  33606. */
  33607. var flow = createFlow();
  33608. /**
  33609. * This method is like `_.flow` except that it creates a function that
  33610. * invokes the given functions from right to left.
  33611. *
  33612. * @static
  33613. * @since 3.0.0
  33614. * @memberOf _
  33615. * @category Util
  33616. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33617. * @returns {Function} Returns the new composite function.
  33618. * @see _.flow
  33619. * @example
  33620. *
  33621. * function square(n) {
  33622. * return n * n;
  33623. * }
  33624. *
  33625. * var addSquare = _.flowRight([square, _.add]);
  33626. * addSquare(1, 2);
  33627. * // => 9
  33628. */
  33629. var flowRight = createFlow(true);
  33630. /**
  33631. * This method returns the first argument it receives.
  33632. *
  33633. * @static
  33634. * @since 0.1.0
  33635. * @memberOf _
  33636. * @category Util
  33637. * @param {*} value Any value.
  33638. * @returns {*} Returns `value`.
  33639. * @example
  33640. *
  33641. * var object = { 'a': 1 };
  33642. *
  33643. * console.log(_.identity(object) === object);
  33644. * // => true
  33645. */
  33646. function identity(value) {
  33647. return value;
  33648. }
  33649. /**
  33650. * Creates a function that invokes `func` with the arguments of the created
  33651. * function. If `func` is a property name, the created function returns the
  33652. * property value for a given element. If `func` is an array or object, the
  33653. * created function returns `true` for elements that contain the equivalent
  33654. * source properties, otherwise it returns `false`.
  33655. *
  33656. * @static
  33657. * @since 4.0.0
  33658. * @memberOf _
  33659. * @category Util
  33660. * @param {*} [func=_.identity] The value to convert to a callback.
  33661. * @returns {Function} Returns the callback.
  33662. * @example
  33663. *
  33664. * var users = [
  33665. * { 'user': 'barney', 'age': 36, 'active': true },
  33666. * { 'user': 'fred', 'age': 40, 'active': false }
  33667. * ];
  33668. *
  33669. * // The `_.matches` iteratee shorthand.
  33670. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33671. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33672. *
  33673. * // The `_.matchesProperty` iteratee shorthand.
  33674. * _.filter(users, _.iteratee(['user', 'fred']));
  33675. * // => [{ 'user': 'fred', 'age': 40 }]
  33676. *
  33677. * // The `_.property` iteratee shorthand.
  33678. * _.map(users, _.iteratee('user'));
  33679. * // => ['barney', 'fred']
  33680. *
  33681. * // Create custom iteratee shorthands.
  33682. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33683. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33684. * return func.test(string);
  33685. * };
  33686. * });
  33687. *
  33688. * _.filter(['abc', 'def'], /ef/);
  33689. * // => ['def']
  33690. */
  33691. function iteratee(func) {
  33692. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33693. }
  33694. /**
  33695. * Creates a function that performs a partial deep comparison between a given
  33696. * object and `source`, returning `true` if the given object has equivalent
  33697. * property values, else `false`.
  33698. *
  33699. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33700. * partially applied.
  33701. *
  33702. * Partial comparisons will match empty array and empty object `source`
  33703. * values against any array or object value, respectively. See `_.isEqual`
  33704. * for a list of supported value comparisons.
  33705. *
  33706. * @static
  33707. * @memberOf _
  33708. * @since 3.0.0
  33709. * @category Util
  33710. * @param {Object} source The object of property values to match.
  33711. * @returns {Function} Returns the new spec function.
  33712. * @example
  33713. *
  33714. * var objects = [
  33715. * { 'a': 1, 'b': 2, 'c': 3 },
  33716. * { 'a': 4, 'b': 5, 'c': 6 }
  33717. * ];
  33718. *
  33719. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33720. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33721. */
  33722. function matches(source) {
  33723. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33724. }
  33725. /**
  33726. * Creates a function that performs a partial deep comparison between the
  33727. * value at `path` of a given object to `srcValue`, returning `true` if the
  33728. * object value is equivalent, else `false`.
  33729. *
  33730. * **Note:** Partial comparisons will match empty array and empty object
  33731. * `srcValue` values against any array or object value, respectively. See
  33732. * `_.isEqual` for a list of supported value comparisons.
  33733. *
  33734. * @static
  33735. * @memberOf _
  33736. * @since 3.2.0
  33737. * @category Util
  33738. * @param {Array|string} path The path of the property to get.
  33739. * @param {*} srcValue The value to match.
  33740. * @returns {Function} Returns the new spec function.
  33741. * @example
  33742. *
  33743. * var objects = [
  33744. * { 'a': 1, 'b': 2, 'c': 3 },
  33745. * { 'a': 4, 'b': 5, 'c': 6 }
  33746. * ];
  33747. *
  33748. * _.find(objects, _.matchesProperty('a', 4));
  33749. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33750. */
  33751. function matchesProperty(path, srcValue) {
  33752. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33753. }
  33754. /**
  33755. * Creates a function that invokes the method at `path` of a given object.
  33756. * Any additional arguments are provided to the invoked method.
  33757. *
  33758. * @static
  33759. * @memberOf _
  33760. * @since 3.7.0
  33761. * @category Util
  33762. * @param {Array|string} path The path of the method to invoke.
  33763. * @param {...*} [args] The arguments to invoke the method with.
  33764. * @returns {Function} Returns the new invoker function.
  33765. * @example
  33766. *
  33767. * var objects = [
  33768. * { 'a': { 'b': _.constant(2) } },
  33769. * { 'a': { 'b': _.constant(1) } }
  33770. * ];
  33771. *
  33772. * _.map(objects, _.method('a.b'));
  33773. * // => [2, 1]
  33774. *
  33775. * _.map(objects, _.method(['a', 'b']));
  33776. * // => [2, 1]
  33777. */
  33778. var method = baseRest(function(path, args) {
  33779. return function(object) {
  33780. return baseInvoke(object, path, args);
  33781. };
  33782. });
  33783. /**
  33784. * The opposite of `_.method`; this method creates a function that invokes
  33785. * the method at a given path of `object`. Any additional arguments are
  33786. * provided to the invoked method.
  33787. *
  33788. * @static
  33789. * @memberOf _
  33790. * @since 3.7.0
  33791. * @category Util
  33792. * @param {Object} object The object to query.
  33793. * @param {...*} [args] The arguments to invoke the method with.
  33794. * @returns {Function} Returns the new invoker function.
  33795. * @example
  33796. *
  33797. * var array = _.times(3, _.constant),
  33798. * object = { 'a': array, 'b': array, 'c': array };
  33799. *
  33800. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33801. * // => [2, 0]
  33802. *
  33803. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33804. * // => [2, 0]
  33805. */
  33806. var methodOf = baseRest(function(object, args) {
  33807. return function(path) {
  33808. return baseInvoke(object, path, args);
  33809. };
  33810. });
  33811. /**
  33812. * Adds all own enumerable string keyed function properties of a source
  33813. * object to the destination object. If `object` is a function, then methods
  33814. * are added to its prototype as well.
  33815. *
  33816. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33817. * avoid conflicts caused by modifying the original.
  33818. *
  33819. * @static
  33820. * @since 0.1.0
  33821. * @memberOf _
  33822. * @category Util
  33823. * @param {Function|Object} [object=lodash] The destination object.
  33824. * @param {Object} source The object of functions to add.
  33825. * @param {Object} [options={}] The options object.
  33826. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33827. * @returns {Function|Object} Returns `object`.
  33828. * @example
  33829. *
  33830. * function vowels(string) {
  33831. * return _.filter(string, function(v) {
  33832. * return /[aeiou]/i.test(v);
  33833. * });
  33834. * }
  33835. *
  33836. * _.mixin({ 'vowels': vowels });
  33837. * _.vowels('fred');
  33838. * // => ['e']
  33839. *
  33840. * _('fred').vowels().value();
  33841. * // => ['e']
  33842. *
  33843. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33844. * _('fred').vowels();
  33845. * // => ['e']
  33846. */
  33847. function mixin(object, source, options) {
  33848. var props = keys(source),
  33849. methodNames = baseFunctions(source, props);
  33850. if (options == null &&
  33851. !(isObject(source) && (methodNames.length || !props.length))) {
  33852. options = source;
  33853. source = object;
  33854. object = this;
  33855. methodNames = baseFunctions(source, keys(source));
  33856. }
  33857. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33858. isFunc = isFunction(object);
  33859. arrayEach(methodNames, function(methodName) {
  33860. var func = source[methodName];
  33861. object[methodName] = func;
  33862. if (isFunc) {
  33863. object.prototype[methodName] = function() {
  33864. var chainAll = this.__chain__;
  33865. if (chain || chainAll) {
  33866. var result = object(this.__wrapped__),
  33867. actions = result.__actions__ = copyArray(this.__actions__);
  33868. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33869. result.__chain__ = chainAll;
  33870. return result;
  33871. }
  33872. return func.apply(object, arrayPush([this.value()], arguments));
  33873. };
  33874. }
  33875. });
  33876. return object;
  33877. }
  33878. /**
  33879. * Reverts the `_` variable to its previous value and returns a reference to
  33880. * the `lodash` function.
  33881. *
  33882. * @static
  33883. * @since 0.1.0
  33884. * @memberOf _
  33885. * @category Util
  33886. * @returns {Function} Returns the `lodash` function.
  33887. * @example
  33888. *
  33889. * var lodash = _.noConflict();
  33890. */
  33891. function noConflict() {
  33892. if (root._ === this) {
  33893. root._ = oldDash;
  33894. }
  33895. return this;
  33896. }
  33897. /**
  33898. * This method returns `undefined`.
  33899. *
  33900. * @static
  33901. * @memberOf _
  33902. * @since 2.3.0
  33903. * @category Util
  33904. * @example
  33905. *
  33906. * _.times(2, _.noop);
  33907. * // => [undefined, undefined]
  33908. */
  33909. function noop() {
  33910. // No operation performed.
  33911. }
  33912. /**
  33913. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33914. * the nth argument from the end is returned.
  33915. *
  33916. * @static
  33917. * @memberOf _
  33918. * @since 4.0.0
  33919. * @category Util
  33920. * @param {number} [n=0] The index of the argument to return.
  33921. * @returns {Function} Returns the new pass-thru function.
  33922. * @example
  33923. *
  33924. * var func = _.nthArg(1);
  33925. * func('a', 'b', 'c', 'd');
  33926. * // => 'b'
  33927. *
  33928. * var func = _.nthArg(-2);
  33929. * func('a', 'b', 'c', 'd');
  33930. * // => 'c'
  33931. */
  33932. function nthArg(n) {
  33933. n = toInteger(n);
  33934. return baseRest(function(args) {
  33935. return baseNth(args, n);
  33936. });
  33937. }
  33938. /**
  33939. * Creates a function that invokes `iteratees` with the arguments it receives
  33940. * and returns their results.
  33941. *
  33942. * @static
  33943. * @memberOf _
  33944. * @since 4.0.0
  33945. * @category Util
  33946. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33947. * The iteratees to invoke.
  33948. * @returns {Function} Returns the new function.
  33949. * @example
  33950. *
  33951. * var func = _.over([Math.max, Math.min]);
  33952. *
  33953. * func(1, 2, 3, 4);
  33954. * // => [4, 1]
  33955. */
  33956. var over = createOver(arrayMap);
  33957. /**
  33958. * Creates a function that checks if **all** of the `predicates` return
  33959. * truthy when invoked with the arguments it receives.
  33960. *
  33961. * @static
  33962. * @memberOf _
  33963. * @since 4.0.0
  33964. * @category Util
  33965. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33966. * The predicates to check.
  33967. * @returns {Function} Returns the new function.
  33968. * @example
  33969. *
  33970. * var func = _.overEvery([Boolean, isFinite]);
  33971. *
  33972. * func('1');
  33973. * // => true
  33974. *
  33975. * func(null);
  33976. * // => false
  33977. *
  33978. * func(NaN);
  33979. * // => false
  33980. */
  33981. var overEvery = createOver(arrayEvery);
  33982. /**
  33983. * Creates a function that checks if **any** of the `predicates` return
  33984. * truthy when invoked with the arguments it receives.
  33985. *
  33986. * @static
  33987. * @memberOf _
  33988. * @since 4.0.0
  33989. * @category Util
  33990. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33991. * The predicates to check.
  33992. * @returns {Function} Returns the new function.
  33993. * @example
  33994. *
  33995. * var func = _.overSome([Boolean, isFinite]);
  33996. *
  33997. * func('1');
  33998. * // => true
  33999. *
  34000. * func(null);
  34001. * // => true
  34002. *
  34003. * func(NaN);
  34004. * // => false
  34005. */
  34006. var overSome = createOver(arraySome);
  34007. /**
  34008. * Creates a function that returns the value at `path` of a given object.
  34009. *
  34010. * @static
  34011. * @memberOf _
  34012. * @since 2.4.0
  34013. * @category Util
  34014. * @param {Array|string} path The path of the property to get.
  34015. * @returns {Function} Returns the new accessor function.
  34016. * @example
  34017. *
  34018. * var objects = [
  34019. * { 'a': { 'b': 2 } },
  34020. * { 'a': { 'b': 1 } }
  34021. * ];
  34022. *
  34023. * _.map(objects, _.property('a.b'));
  34024. * // => [2, 1]
  34025. *
  34026. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34027. * // => [1, 2]
  34028. */
  34029. function property(path) {
  34030. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34031. }
  34032. /**
  34033. * The opposite of `_.property`; this method creates a function that returns
  34034. * the value at a given path of `object`.
  34035. *
  34036. * @static
  34037. * @memberOf _
  34038. * @since 3.0.0
  34039. * @category Util
  34040. * @param {Object} object The object to query.
  34041. * @returns {Function} Returns the new accessor function.
  34042. * @example
  34043. *
  34044. * var array = [0, 1, 2],
  34045. * object = { 'a': array, 'b': array, 'c': array };
  34046. *
  34047. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34048. * // => [2, 0]
  34049. *
  34050. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34051. * // => [2, 0]
  34052. */
  34053. function propertyOf(object) {
  34054. return function(path) {
  34055. return object == null ? undefined : baseGet(object, path);
  34056. };
  34057. }
  34058. /**
  34059. * Creates an array of numbers (positive and/or negative) progressing from
  34060. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34061. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34062. * it's set to `start` with `start` then set to `0`.
  34063. *
  34064. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34065. * floating-point values which can produce unexpected results.
  34066. *
  34067. * @static
  34068. * @since 0.1.0
  34069. * @memberOf _
  34070. * @category Util
  34071. * @param {number} [start=0] The start of the range.
  34072. * @param {number} end The end of the range.
  34073. * @param {number} [step=1] The value to increment or decrement by.
  34074. * @returns {Array} Returns the range of numbers.
  34075. * @see _.inRange, _.rangeRight
  34076. * @example
  34077. *
  34078. * _.range(4);
  34079. * // => [0, 1, 2, 3]
  34080. *
  34081. * _.range(-4);
  34082. * // => [0, -1, -2, -3]
  34083. *
  34084. * _.range(1, 5);
  34085. * // => [1, 2, 3, 4]
  34086. *
  34087. * _.range(0, 20, 5);
  34088. * // => [0, 5, 10, 15]
  34089. *
  34090. * _.range(0, -4, -1);
  34091. * // => [0, -1, -2, -3]
  34092. *
  34093. * _.range(1, 4, 0);
  34094. * // => [1, 1, 1]
  34095. *
  34096. * _.range(0);
  34097. * // => []
  34098. */
  34099. var range = createRange();
  34100. /**
  34101. * This method is like `_.range` except that it populates values in
  34102. * descending order.
  34103. *
  34104. * @static
  34105. * @memberOf _
  34106. * @since 4.0.0
  34107. * @category Util
  34108. * @param {number} [start=0] The start of the range.
  34109. * @param {number} end The end of the range.
  34110. * @param {number} [step=1] The value to increment or decrement by.
  34111. * @returns {Array} Returns the range of numbers.
  34112. * @see _.inRange, _.range
  34113. * @example
  34114. *
  34115. * _.rangeRight(4);
  34116. * // => [3, 2, 1, 0]
  34117. *
  34118. * _.rangeRight(-4);
  34119. * // => [-3, -2, -1, 0]
  34120. *
  34121. * _.rangeRight(1, 5);
  34122. * // => [4, 3, 2, 1]
  34123. *
  34124. * _.rangeRight(0, 20, 5);
  34125. * // => [15, 10, 5, 0]
  34126. *
  34127. * _.rangeRight(0, -4, -1);
  34128. * // => [-3, -2, -1, 0]
  34129. *
  34130. * _.rangeRight(1, 4, 0);
  34131. * // => [1, 1, 1]
  34132. *
  34133. * _.rangeRight(0);
  34134. * // => []
  34135. */
  34136. var rangeRight = createRange(true);
  34137. /**
  34138. * This method returns a new empty array.
  34139. *
  34140. * @static
  34141. * @memberOf _
  34142. * @since 4.13.0
  34143. * @category Util
  34144. * @returns {Array} Returns the new empty array.
  34145. * @example
  34146. *
  34147. * var arrays = _.times(2, _.stubArray);
  34148. *
  34149. * console.log(arrays);
  34150. * // => [[], []]
  34151. *
  34152. * console.log(arrays[0] === arrays[1]);
  34153. * // => false
  34154. */
  34155. function stubArray() {
  34156. return [];
  34157. }
  34158. /**
  34159. * This method returns `false`.
  34160. *
  34161. * @static
  34162. * @memberOf _
  34163. * @since 4.13.0
  34164. * @category Util
  34165. * @returns {boolean} Returns `false`.
  34166. * @example
  34167. *
  34168. * _.times(2, _.stubFalse);
  34169. * // => [false, false]
  34170. */
  34171. function stubFalse() {
  34172. return false;
  34173. }
  34174. /**
  34175. * This method returns a new empty object.
  34176. *
  34177. * @static
  34178. * @memberOf _
  34179. * @since 4.13.0
  34180. * @category Util
  34181. * @returns {Object} Returns the new empty object.
  34182. * @example
  34183. *
  34184. * var objects = _.times(2, _.stubObject);
  34185. *
  34186. * console.log(objects);
  34187. * // => [{}, {}]
  34188. *
  34189. * console.log(objects[0] === objects[1]);
  34190. * // => false
  34191. */
  34192. function stubObject() {
  34193. return {};
  34194. }
  34195. /**
  34196. * This method returns an empty string.
  34197. *
  34198. * @static
  34199. * @memberOf _
  34200. * @since 4.13.0
  34201. * @category Util
  34202. * @returns {string} Returns the empty string.
  34203. * @example
  34204. *
  34205. * _.times(2, _.stubString);
  34206. * // => ['', '']
  34207. */
  34208. function stubString() {
  34209. return '';
  34210. }
  34211. /**
  34212. * This method returns `true`.
  34213. *
  34214. * @static
  34215. * @memberOf _
  34216. * @since 4.13.0
  34217. * @category Util
  34218. * @returns {boolean} Returns `true`.
  34219. * @example
  34220. *
  34221. * _.times(2, _.stubTrue);
  34222. * // => [true, true]
  34223. */
  34224. function stubTrue() {
  34225. return true;
  34226. }
  34227. /**
  34228. * Invokes the iteratee `n` times, returning an array of the results of
  34229. * each invocation. The iteratee is invoked with one argument; (index).
  34230. *
  34231. * @static
  34232. * @since 0.1.0
  34233. * @memberOf _
  34234. * @category Util
  34235. * @param {number} n The number of times to invoke `iteratee`.
  34236. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34237. * @returns {Array} Returns the array of results.
  34238. * @example
  34239. *
  34240. * _.times(3, String);
  34241. * // => ['0', '1', '2']
  34242. *
  34243. * _.times(4, _.constant(0));
  34244. * // => [0, 0, 0, 0]
  34245. */
  34246. function times(n, iteratee) {
  34247. n = toInteger(n);
  34248. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34249. return [];
  34250. }
  34251. var index = MAX_ARRAY_LENGTH,
  34252. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34253. iteratee = getIteratee(iteratee);
  34254. n -= MAX_ARRAY_LENGTH;
  34255. var result = baseTimes(length, iteratee);
  34256. while (++index < n) {
  34257. iteratee(index);
  34258. }
  34259. return result;
  34260. }
  34261. /**
  34262. * Converts `value` to a property path array.
  34263. *
  34264. * @static
  34265. * @memberOf _
  34266. * @since 4.0.0
  34267. * @category Util
  34268. * @param {*} value The value to convert.
  34269. * @returns {Array} Returns the new property path array.
  34270. * @example
  34271. *
  34272. * _.toPath('a.b.c');
  34273. * // => ['a', 'b', 'c']
  34274. *
  34275. * _.toPath('a[0].b.c');
  34276. * // => ['a', '0', 'b', 'c']
  34277. */
  34278. function toPath(value) {
  34279. if (isArray(value)) {
  34280. return arrayMap(value, toKey);
  34281. }
  34282. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34283. }
  34284. /**
  34285. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34286. *
  34287. * @static
  34288. * @since 0.1.0
  34289. * @memberOf _
  34290. * @category Util
  34291. * @param {string} [prefix=''] The value to prefix the ID with.
  34292. * @returns {string} Returns the unique ID.
  34293. * @example
  34294. *
  34295. * _.uniqueId('contact_');
  34296. * // => 'contact_104'
  34297. *
  34298. * _.uniqueId();
  34299. * // => '105'
  34300. */
  34301. function uniqueId(prefix) {
  34302. var id = ++idCounter;
  34303. return toString(prefix) + id;
  34304. }
  34305. /*------------------------------------------------------------------------*/
  34306. /**
  34307. * Adds two numbers.
  34308. *
  34309. * @static
  34310. * @memberOf _
  34311. * @since 3.4.0
  34312. * @category Math
  34313. * @param {number} augend The first number in an addition.
  34314. * @param {number} addend The second number in an addition.
  34315. * @returns {number} Returns the total.
  34316. * @example
  34317. *
  34318. * _.add(6, 4);
  34319. * // => 10
  34320. */
  34321. var add = createMathOperation(function(augend, addend) {
  34322. return augend + addend;
  34323. }, 0);
  34324. /**
  34325. * Computes `number` rounded up to `precision`.
  34326. *
  34327. * @static
  34328. * @memberOf _
  34329. * @since 3.10.0
  34330. * @category Math
  34331. * @param {number} number The number to round up.
  34332. * @param {number} [precision=0] The precision to round up to.
  34333. * @returns {number} Returns the rounded up number.
  34334. * @example
  34335. *
  34336. * _.ceil(4.006);
  34337. * // => 5
  34338. *
  34339. * _.ceil(6.004, 2);
  34340. * // => 6.01
  34341. *
  34342. * _.ceil(6040, -2);
  34343. * // => 6100
  34344. */
  34345. var ceil = createRound('ceil');
  34346. /**
  34347. * Divide two numbers.
  34348. *
  34349. * @static
  34350. * @memberOf _
  34351. * @since 4.7.0
  34352. * @category Math
  34353. * @param {number} dividend The first number in a division.
  34354. * @param {number} divisor The second number in a division.
  34355. * @returns {number} Returns the quotient.
  34356. * @example
  34357. *
  34358. * _.divide(6, 4);
  34359. * // => 1.5
  34360. */
  34361. var divide = createMathOperation(function(dividend, divisor) {
  34362. return dividend / divisor;
  34363. }, 1);
  34364. /**
  34365. * Computes `number` rounded down to `precision`.
  34366. *
  34367. * @static
  34368. * @memberOf _
  34369. * @since 3.10.0
  34370. * @category Math
  34371. * @param {number} number The number to round down.
  34372. * @param {number} [precision=0] The precision to round down to.
  34373. * @returns {number} Returns the rounded down number.
  34374. * @example
  34375. *
  34376. * _.floor(4.006);
  34377. * // => 4
  34378. *
  34379. * _.floor(0.046, 2);
  34380. * // => 0.04
  34381. *
  34382. * _.floor(4060, -2);
  34383. * // => 4000
  34384. */
  34385. var floor = createRound('floor');
  34386. /**
  34387. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34388. * `undefined` is returned.
  34389. *
  34390. * @static
  34391. * @since 0.1.0
  34392. * @memberOf _
  34393. * @category Math
  34394. * @param {Array} array The array to iterate over.
  34395. * @returns {*} Returns the maximum value.
  34396. * @example
  34397. *
  34398. * _.max([4, 2, 8, 6]);
  34399. * // => 8
  34400. *
  34401. * _.max([]);
  34402. * // => undefined
  34403. */
  34404. function max(array) {
  34405. return (array && array.length)
  34406. ? baseExtremum(array, identity, baseGt)
  34407. : undefined;
  34408. }
  34409. /**
  34410. * This method is like `_.max` except that it accepts `iteratee` which is
  34411. * invoked for each element in `array` to generate the criterion by which
  34412. * the value is ranked. The iteratee is invoked with one argument: (value).
  34413. *
  34414. * @static
  34415. * @memberOf _
  34416. * @since 4.0.0
  34417. * @category Math
  34418. * @param {Array} array The array to iterate over.
  34419. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34420. * @returns {*} Returns the maximum value.
  34421. * @example
  34422. *
  34423. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34424. *
  34425. * _.maxBy(objects, function(o) { return o.n; });
  34426. * // => { 'n': 2 }
  34427. *
  34428. * // The `_.property` iteratee shorthand.
  34429. * _.maxBy(objects, 'n');
  34430. * // => { 'n': 2 }
  34431. */
  34432. function maxBy(array, iteratee) {
  34433. return (array && array.length)
  34434. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34435. : undefined;
  34436. }
  34437. /**
  34438. * Computes the mean of the values in `array`.
  34439. *
  34440. * @static
  34441. * @memberOf _
  34442. * @since 4.0.0
  34443. * @category Math
  34444. * @param {Array} array The array to iterate over.
  34445. * @returns {number} Returns the mean.
  34446. * @example
  34447. *
  34448. * _.mean([4, 2, 8, 6]);
  34449. * // => 5
  34450. */
  34451. function mean(array) {
  34452. return baseMean(array, identity);
  34453. }
  34454. /**
  34455. * This method is like `_.mean` except that it accepts `iteratee` which is
  34456. * invoked for each element in `array` to generate the value to be averaged.
  34457. * The iteratee is invoked with one argument: (value).
  34458. *
  34459. * @static
  34460. * @memberOf _
  34461. * @since 4.7.0
  34462. * @category Math
  34463. * @param {Array} array The array to iterate over.
  34464. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34465. * @returns {number} Returns the mean.
  34466. * @example
  34467. *
  34468. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34469. *
  34470. * _.meanBy(objects, function(o) { return o.n; });
  34471. * // => 5
  34472. *
  34473. * // The `_.property` iteratee shorthand.
  34474. * _.meanBy(objects, 'n');
  34475. * // => 5
  34476. */
  34477. function meanBy(array, iteratee) {
  34478. return baseMean(array, getIteratee(iteratee, 2));
  34479. }
  34480. /**
  34481. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34482. * `undefined` is returned.
  34483. *
  34484. * @static
  34485. * @since 0.1.0
  34486. * @memberOf _
  34487. * @category Math
  34488. * @param {Array} array The array to iterate over.
  34489. * @returns {*} Returns the minimum value.
  34490. * @example
  34491. *
  34492. * _.min([4, 2, 8, 6]);
  34493. * // => 2
  34494. *
  34495. * _.min([]);
  34496. * // => undefined
  34497. */
  34498. function min(array) {
  34499. return (array && array.length)
  34500. ? baseExtremum(array, identity, baseLt)
  34501. : undefined;
  34502. }
  34503. /**
  34504. * This method is like `_.min` except that it accepts `iteratee` which is
  34505. * invoked for each element in `array` to generate the criterion by which
  34506. * the value is ranked. The iteratee is invoked with one argument: (value).
  34507. *
  34508. * @static
  34509. * @memberOf _
  34510. * @since 4.0.0
  34511. * @category Math
  34512. * @param {Array} array The array to iterate over.
  34513. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34514. * @returns {*} Returns the minimum value.
  34515. * @example
  34516. *
  34517. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34518. *
  34519. * _.minBy(objects, function(o) { return o.n; });
  34520. * // => { 'n': 1 }
  34521. *
  34522. * // The `_.property` iteratee shorthand.
  34523. * _.minBy(objects, 'n');
  34524. * // => { 'n': 1 }
  34525. */
  34526. function minBy(array, iteratee) {
  34527. return (array && array.length)
  34528. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34529. : undefined;
  34530. }
  34531. /**
  34532. * Multiply two numbers.
  34533. *
  34534. * @static
  34535. * @memberOf _
  34536. * @since 4.7.0
  34537. * @category Math
  34538. * @param {number} multiplier The first number in a multiplication.
  34539. * @param {number} multiplicand The second number in a multiplication.
  34540. * @returns {number} Returns the product.
  34541. * @example
  34542. *
  34543. * _.multiply(6, 4);
  34544. * // => 24
  34545. */
  34546. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34547. return multiplier * multiplicand;
  34548. }, 1);
  34549. /**
  34550. * Computes `number` rounded to `precision`.
  34551. *
  34552. * @static
  34553. * @memberOf _
  34554. * @since 3.10.0
  34555. * @category Math
  34556. * @param {number} number The number to round.
  34557. * @param {number} [precision=0] The precision to round to.
  34558. * @returns {number} Returns the rounded number.
  34559. * @example
  34560. *
  34561. * _.round(4.006);
  34562. * // => 4
  34563. *
  34564. * _.round(4.006, 2);
  34565. * // => 4.01
  34566. *
  34567. * _.round(4060, -2);
  34568. * // => 4100
  34569. */
  34570. var round = createRound('round');
  34571. /**
  34572. * Subtract two numbers.
  34573. *
  34574. * @static
  34575. * @memberOf _
  34576. * @since 4.0.0
  34577. * @category Math
  34578. * @param {number} minuend The first number in a subtraction.
  34579. * @param {number} subtrahend The second number in a subtraction.
  34580. * @returns {number} Returns the difference.
  34581. * @example
  34582. *
  34583. * _.subtract(6, 4);
  34584. * // => 2
  34585. */
  34586. var subtract = createMathOperation(function(minuend, subtrahend) {
  34587. return minuend - subtrahend;
  34588. }, 0);
  34589. /**
  34590. * Computes the sum of the values in `array`.
  34591. *
  34592. * @static
  34593. * @memberOf _
  34594. * @since 3.4.0
  34595. * @category Math
  34596. * @param {Array} array The array to iterate over.
  34597. * @returns {number} Returns the sum.
  34598. * @example
  34599. *
  34600. * _.sum([4, 2, 8, 6]);
  34601. * // => 20
  34602. */
  34603. function sum(array) {
  34604. return (array && array.length)
  34605. ? baseSum(array, identity)
  34606. : 0;
  34607. }
  34608. /**
  34609. * This method is like `_.sum` except that it accepts `iteratee` which is
  34610. * invoked for each element in `array` to generate the value to be summed.
  34611. * The iteratee is invoked with one argument: (value).
  34612. *
  34613. * @static
  34614. * @memberOf _
  34615. * @since 4.0.0
  34616. * @category Math
  34617. * @param {Array} array The array to iterate over.
  34618. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34619. * @returns {number} Returns the sum.
  34620. * @example
  34621. *
  34622. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34623. *
  34624. * _.sumBy(objects, function(o) { return o.n; });
  34625. * // => 20
  34626. *
  34627. * // The `_.property` iteratee shorthand.
  34628. * _.sumBy(objects, 'n');
  34629. * // => 20
  34630. */
  34631. function sumBy(array, iteratee) {
  34632. return (array && array.length)
  34633. ? baseSum(array, getIteratee(iteratee, 2))
  34634. : 0;
  34635. }
  34636. /*------------------------------------------------------------------------*/
  34637. // Add methods that return wrapped values in chain sequences.
  34638. lodash.after = after;
  34639. lodash.ary = ary;
  34640. lodash.assign = assign;
  34641. lodash.assignIn = assignIn;
  34642. lodash.assignInWith = assignInWith;
  34643. lodash.assignWith = assignWith;
  34644. lodash.at = at;
  34645. lodash.before = before;
  34646. lodash.bind = bind;
  34647. lodash.bindAll = bindAll;
  34648. lodash.bindKey = bindKey;
  34649. lodash.castArray = castArray;
  34650. lodash.chain = chain;
  34651. lodash.chunk = chunk;
  34652. lodash.compact = compact;
  34653. lodash.concat = concat;
  34654. lodash.cond = cond;
  34655. lodash.conforms = conforms;
  34656. lodash.constant = constant;
  34657. lodash.countBy = countBy;
  34658. lodash.create = create;
  34659. lodash.curry = curry;
  34660. lodash.curryRight = curryRight;
  34661. lodash.debounce = debounce;
  34662. lodash.defaults = defaults;
  34663. lodash.defaultsDeep = defaultsDeep;
  34664. lodash.defer = defer;
  34665. lodash.delay = delay;
  34666. lodash.difference = difference;
  34667. lodash.differenceBy = differenceBy;
  34668. lodash.differenceWith = differenceWith;
  34669. lodash.drop = drop;
  34670. lodash.dropRight = dropRight;
  34671. lodash.dropRightWhile = dropRightWhile;
  34672. lodash.dropWhile = dropWhile;
  34673. lodash.fill = fill;
  34674. lodash.filter = filter;
  34675. lodash.flatMap = flatMap;
  34676. lodash.flatMapDeep = flatMapDeep;
  34677. lodash.flatMapDepth = flatMapDepth;
  34678. lodash.flatten = flatten;
  34679. lodash.flattenDeep = flattenDeep;
  34680. lodash.flattenDepth = flattenDepth;
  34681. lodash.flip = flip;
  34682. lodash.flow = flow;
  34683. lodash.flowRight = flowRight;
  34684. lodash.fromPairs = fromPairs;
  34685. lodash.functions = functions;
  34686. lodash.functionsIn = functionsIn;
  34687. lodash.groupBy = groupBy;
  34688. lodash.initial = initial;
  34689. lodash.intersection = intersection;
  34690. lodash.intersectionBy = intersectionBy;
  34691. lodash.intersectionWith = intersectionWith;
  34692. lodash.invert = invert;
  34693. lodash.invertBy = invertBy;
  34694. lodash.invokeMap = invokeMap;
  34695. lodash.iteratee = iteratee;
  34696. lodash.keyBy = keyBy;
  34697. lodash.keys = keys;
  34698. lodash.keysIn = keysIn;
  34699. lodash.map = map;
  34700. lodash.mapKeys = mapKeys;
  34701. lodash.mapValues = mapValues;
  34702. lodash.matches = matches;
  34703. lodash.matchesProperty = matchesProperty;
  34704. lodash.memoize = memoize;
  34705. lodash.merge = merge;
  34706. lodash.mergeWith = mergeWith;
  34707. lodash.method = method;
  34708. lodash.methodOf = methodOf;
  34709. lodash.mixin = mixin;
  34710. lodash.negate = negate;
  34711. lodash.nthArg = nthArg;
  34712. lodash.omit = omit;
  34713. lodash.omitBy = omitBy;
  34714. lodash.once = once;
  34715. lodash.orderBy = orderBy;
  34716. lodash.over = over;
  34717. lodash.overArgs = overArgs;
  34718. lodash.overEvery = overEvery;
  34719. lodash.overSome = overSome;
  34720. lodash.partial = partial;
  34721. lodash.partialRight = partialRight;
  34722. lodash.partition = partition;
  34723. lodash.pick = pick;
  34724. lodash.pickBy = pickBy;
  34725. lodash.property = property;
  34726. lodash.propertyOf = propertyOf;
  34727. lodash.pull = pull;
  34728. lodash.pullAll = pullAll;
  34729. lodash.pullAllBy = pullAllBy;
  34730. lodash.pullAllWith = pullAllWith;
  34731. lodash.pullAt = pullAt;
  34732. lodash.range = range;
  34733. lodash.rangeRight = rangeRight;
  34734. lodash.rearg = rearg;
  34735. lodash.reject = reject;
  34736. lodash.remove = remove;
  34737. lodash.rest = rest;
  34738. lodash.reverse = reverse;
  34739. lodash.sampleSize = sampleSize;
  34740. lodash.set = set;
  34741. lodash.setWith = setWith;
  34742. lodash.shuffle = shuffle;
  34743. lodash.slice = slice;
  34744. lodash.sortBy = sortBy;
  34745. lodash.sortedUniq = sortedUniq;
  34746. lodash.sortedUniqBy = sortedUniqBy;
  34747. lodash.split = split;
  34748. lodash.spread = spread;
  34749. lodash.tail = tail;
  34750. lodash.take = take;
  34751. lodash.takeRight = takeRight;
  34752. lodash.takeRightWhile = takeRightWhile;
  34753. lodash.takeWhile = takeWhile;
  34754. lodash.tap = tap;
  34755. lodash.throttle = throttle;
  34756. lodash.thru = thru;
  34757. lodash.toArray = toArray;
  34758. lodash.toPairs = toPairs;
  34759. lodash.toPairsIn = toPairsIn;
  34760. lodash.toPath = toPath;
  34761. lodash.toPlainObject = toPlainObject;
  34762. lodash.transform = transform;
  34763. lodash.unary = unary;
  34764. lodash.union = union;
  34765. lodash.unionBy = unionBy;
  34766. lodash.unionWith = unionWith;
  34767. lodash.uniq = uniq;
  34768. lodash.uniqBy = uniqBy;
  34769. lodash.uniqWith = uniqWith;
  34770. lodash.unset = unset;
  34771. lodash.unzip = unzip;
  34772. lodash.unzipWith = unzipWith;
  34773. lodash.update = update;
  34774. lodash.updateWith = updateWith;
  34775. lodash.values = values;
  34776. lodash.valuesIn = valuesIn;
  34777. lodash.without = without;
  34778. lodash.words = words;
  34779. lodash.wrap = wrap;
  34780. lodash.xor = xor;
  34781. lodash.xorBy = xorBy;
  34782. lodash.xorWith = xorWith;
  34783. lodash.zip = zip;
  34784. lodash.zipObject = zipObject;
  34785. lodash.zipObjectDeep = zipObjectDeep;
  34786. lodash.zipWith = zipWith;
  34787. // Add aliases.
  34788. lodash.entries = toPairs;
  34789. lodash.entriesIn = toPairsIn;
  34790. lodash.extend = assignIn;
  34791. lodash.extendWith = assignInWith;
  34792. // Add methods to `lodash.prototype`.
  34793. mixin(lodash, lodash);
  34794. /*------------------------------------------------------------------------*/
  34795. // Add methods that return unwrapped values in chain sequences.
  34796. lodash.add = add;
  34797. lodash.attempt = attempt;
  34798. lodash.camelCase = camelCase;
  34799. lodash.capitalize = capitalize;
  34800. lodash.ceil = ceil;
  34801. lodash.clamp = clamp;
  34802. lodash.clone = clone;
  34803. lodash.cloneDeep = cloneDeep;
  34804. lodash.cloneDeepWith = cloneDeepWith;
  34805. lodash.cloneWith = cloneWith;
  34806. lodash.conformsTo = conformsTo;
  34807. lodash.deburr = deburr;
  34808. lodash.defaultTo = defaultTo;
  34809. lodash.divide = divide;
  34810. lodash.endsWith = endsWith;
  34811. lodash.eq = eq;
  34812. lodash.escape = escape;
  34813. lodash.escapeRegExp = escapeRegExp;
  34814. lodash.every = every;
  34815. lodash.find = find;
  34816. lodash.findIndex = findIndex;
  34817. lodash.findKey = findKey;
  34818. lodash.findLast = findLast;
  34819. lodash.findLastIndex = findLastIndex;
  34820. lodash.findLastKey = findLastKey;
  34821. lodash.floor = floor;
  34822. lodash.forEach = forEach;
  34823. lodash.forEachRight = forEachRight;
  34824. lodash.forIn = forIn;
  34825. lodash.forInRight = forInRight;
  34826. lodash.forOwn = forOwn;
  34827. lodash.forOwnRight = forOwnRight;
  34828. lodash.get = get;
  34829. lodash.gt = gt;
  34830. lodash.gte = gte;
  34831. lodash.has = has;
  34832. lodash.hasIn = hasIn;
  34833. lodash.head = head;
  34834. lodash.identity = identity;
  34835. lodash.includes = includes;
  34836. lodash.indexOf = indexOf;
  34837. lodash.inRange = inRange;
  34838. lodash.invoke = invoke;
  34839. lodash.isArguments = isArguments;
  34840. lodash.isArray = isArray;
  34841. lodash.isArrayBuffer = isArrayBuffer;
  34842. lodash.isArrayLike = isArrayLike;
  34843. lodash.isArrayLikeObject = isArrayLikeObject;
  34844. lodash.isBoolean = isBoolean;
  34845. lodash.isBuffer = isBuffer;
  34846. lodash.isDate = isDate;
  34847. lodash.isElement = isElement;
  34848. lodash.isEmpty = isEmpty;
  34849. lodash.isEqual = isEqual;
  34850. lodash.isEqualWith = isEqualWith;
  34851. lodash.isError = isError;
  34852. lodash.isFinite = isFinite;
  34853. lodash.isFunction = isFunction;
  34854. lodash.isInteger = isInteger;
  34855. lodash.isLength = isLength;
  34856. lodash.isMap = isMap;
  34857. lodash.isMatch = isMatch;
  34858. lodash.isMatchWith = isMatchWith;
  34859. lodash.isNaN = isNaN;
  34860. lodash.isNative = isNative;
  34861. lodash.isNil = isNil;
  34862. lodash.isNull = isNull;
  34863. lodash.isNumber = isNumber;
  34864. lodash.isObject = isObject;
  34865. lodash.isObjectLike = isObjectLike;
  34866. lodash.isPlainObject = isPlainObject;
  34867. lodash.isRegExp = isRegExp;
  34868. lodash.isSafeInteger = isSafeInteger;
  34869. lodash.isSet = isSet;
  34870. lodash.isString = isString;
  34871. lodash.isSymbol = isSymbol;
  34872. lodash.isTypedArray = isTypedArray;
  34873. lodash.isUndefined = isUndefined;
  34874. lodash.isWeakMap = isWeakMap;
  34875. lodash.isWeakSet = isWeakSet;
  34876. lodash.join = join;
  34877. lodash.kebabCase = kebabCase;
  34878. lodash.last = last;
  34879. lodash.lastIndexOf = lastIndexOf;
  34880. lodash.lowerCase = lowerCase;
  34881. lodash.lowerFirst = lowerFirst;
  34882. lodash.lt = lt;
  34883. lodash.lte = lte;
  34884. lodash.max = max;
  34885. lodash.maxBy = maxBy;
  34886. lodash.mean = mean;
  34887. lodash.meanBy = meanBy;
  34888. lodash.min = min;
  34889. lodash.minBy = minBy;
  34890. lodash.stubArray = stubArray;
  34891. lodash.stubFalse = stubFalse;
  34892. lodash.stubObject = stubObject;
  34893. lodash.stubString = stubString;
  34894. lodash.stubTrue = stubTrue;
  34895. lodash.multiply = multiply;
  34896. lodash.nth = nth;
  34897. lodash.noConflict = noConflict;
  34898. lodash.noop = noop;
  34899. lodash.now = now;
  34900. lodash.pad = pad;
  34901. lodash.padEnd = padEnd;
  34902. lodash.padStart = padStart;
  34903. lodash.parseInt = parseInt;
  34904. lodash.random = random;
  34905. lodash.reduce = reduce;
  34906. lodash.reduceRight = reduceRight;
  34907. lodash.repeat = repeat;
  34908. lodash.replace = replace;
  34909. lodash.result = result;
  34910. lodash.round = round;
  34911. lodash.runInContext = runInContext;
  34912. lodash.sample = sample;
  34913. lodash.size = size;
  34914. lodash.snakeCase = snakeCase;
  34915. lodash.some = some;
  34916. lodash.sortedIndex = sortedIndex;
  34917. lodash.sortedIndexBy = sortedIndexBy;
  34918. lodash.sortedIndexOf = sortedIndexOf;
  34919. lodash.sortedLastIndex = sortedLastIndex;
  34920. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34921. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34922. lodash.startCase = startCase;
  34923. lodash.startsWith = startsWith;
  34924. lodash.subtract = subtract;
  34925. lodash.sum = sum;
  34926. lodash.sumBy = sumBy;
  34927. lodash.template = template;
  34928. lodash.times = times;
  34929. lodash.toFinite = toFinite;
  34930. lodash.toInteger = toInteger;
  34931. lodash.toLength = toLength;
  34932. lodash.toLower = toLower;
  34933. lodash.toNumber = toNumber;
  34934. lodash.toSafeInteger = toSafeInteger;
  34935. lodash.toString = toString;
  34936. lodash.toUpper = toUpper;
  34937. lodash.trim = trim;
  34938. lodash.trimEnd = trimEnd;
  34939. lodash.trimStart = trimStart;
  34940. lodash.truncate = truncate;
  34941. lodash.unescape = unescape;
  34942. lodash.uniqueId = uniqueId;
  34943. lodash.upperCase = upperCase;
  34944. lodash.upperFirst = upperFirst;
  34945. // Add aliases.
  34946. lodash.each = forEach;
  34947. lodash.eachRight = forEachRight;
  34948. lodash.first = head;
  34949. mixin(lodash, (function() {
  34950. var source = {};
  34951. baseForOwn(lodash, function(func, methodName) {
  34952. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34953. source[methodName] = func;
  34954. }
  34955. });
  34956. return source;
  34957. }()), { 'chain': false });
  34958. /*------------------------------------------------------------------------*/
  34959. /**
  34960. * The semantic version number.
  34961. *
  34962. * @static
  34963. * @memberOf _
  34964. * @type {string}
  34965. */
  34966. lodash.VERSION = VERSION;
  34967. // Assign default placeholders.
  34968. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34969. lodash[methodName].placeholder = lodash;
  34970. });
  34971. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34972. arrayEach(['drop', 'take'], function(methodName, index) {
  34973. LazyWrapper.prototype[methodName] = function(n) {
  34974. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34975. var result = (this.__filtered__ && !index)
  34976. ? new LazyWrapper(this)
  34977. : this.clone();
  34978. if (result.__filtered__) {
  34979. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34980. } else {
  34981. result.__views__.push({
  34982. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34983. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34984. });
  34985. }
  34986. return result;
  34987. };
  34988. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34989. return this.reverse()[methodName](n).reverse();
  34990. };
  34991. });
  34992. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34993. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34994. var type = index + 1,
  34995. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34996. LazyWrapper.prototype[methodName] = function(iteratee) {
  34997. var result = this.clone();
  34998. result.__iteratees__.push({
  34999. 'iteratee': getIteratee(iteratee, 3),
  35000. 'type': type
  35001. });
  35002. result.__filtered__ = result.__filtered__ || isFilter;
  35003. return result;
  35004. };
  35005. });
  35006. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35007. arrayEach(['head', 'last'], function(methodName, index) {
  35008. var takeName = 'take' + (index ? 'Right' : '');
  35009. LazyWrapper.prototype[methodName] = function() {
  35010. return this[takeName](1).value()[0];
  35011. };
  35012. });
  35013. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35014. arrayEach(['initial', 'tail'], function(methodName, index) {
  35015. var dropName = 'drop' + (index ? '' : 'Right');
  35016. LazyWrapper.prototype[methodName] = function() {
  35017. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35018. };
  35019. });
  35020. LazyWrapper.prototype.compact = function() {
  35021. return this.filter(identity);
  35022. };
  35023. LazyWrapper.prototype.find = function(predicate) {
  35024. return this.filter(predicate).head();
  35025. };
  35026. LazyWrapper.prototype.findLast = function(predicate) {
  35027. return this.reverse().find(predicate);
  35028. };
  35029. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35030. if (typeof path == 'function') {
  35031. return new LazyWrapper(this);
  35032. }
  35033. return this.map(function(value) {
  35034. return baseInvoke(value, path, args);
  35035. });
  35036. });
  35037. LazyWrapper.prototype.reject = function(predicate) {
  35038. return this.filter(negate(getIteratee(predicate)));
  35039. };
  35040. LazyWrapper.prototype.slice = function(start, end) {
  35041. start = toInteger(start);
  35042. var result = this;
  35043. if (result.__filtered__ && (start > 0 || end < 0)) {
  35044. return new LazyWrapper(result);
  35045. }
  35046. if (start < 0) {
  35047. result = result.takeRight(-start);
  35048. } else if (start) {
  35049. result = result.drop(start);
  35050. }
  35051. if (end !== undefined) {
  35052. end = toInteger(end);
  35053. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35054. }
  35055. return result;
  35056. };
  35057. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35058. return this.reverse().takeWhile(predicate).reverse();
  35059. };
  35060. LazyWrapper.prototype.toArray = function() {
  35061. return this.take(MAX_ARRAY_LENGTH);
  35062. };
  35063. // Add `LazyWrapper` methods to `lodash.prototype`.
  35064. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35065. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35066. isTaker = /^(?:head|last)$/.test(methodName),
  35067. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35068. retUnwrapped = isTaker || /^find/.test(methodName);
  35069. if (!lodashFunc) {
  35070. return;
  35071. }
  35072. lodash.prototype[methodName] = function() {
  35073. var value = this.__wrapped__,
  35074. args = isTaker ? [1] : arguments,
  35075. isLazy = value instanceof LazyWrapper,
  35076. iteratee = args[0],
  35077. useLazy = isLazy || isArray(value);
  35078. var interceptor = function(value) {
  35079. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35080. return (isTaker && chainAll) ? result[0] : result;
  35081. };
  35082. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35083. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35084. isLazy = useLazy = false;
  35085. }
  35086. var chainAll = this.__chain__,
  35087. isHybrid = !!this.__actions__.length,
  35088. isUnwrapped = retUnwrapped && !chainAll,
  35089. onlyLazy = isLazy && !isHybrid;
  35090. if (!retUnwrapped && useLazy) {
  35091. value = onlyLazy ? value : new LazyWrapper(this);
  35092. var result = func.apply(value, args);
  35093. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35094. return new LodashWrapper(result, chainAll);
  35095. }
  35096. if (isUnwrapped && onlyLazy) {
  35097. return func.apply(this, args);
  35098. }
  35099. result = this.thru(interceptor);
  35100. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35101. };
  35102. });
  35103. // Add `Array` methods to `lodash.prototype`.
  35104. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35105. var func = arrayProto[methodName],
  35106. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35107. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35108. lodash.prototype[methodName] = function() {
  35109. var args = arguments;
  35110. if (retUnwrapped && !this.__chain__) {
  35111. var value = this.value();
  35112. return func.apply(isArray(value) ? value : [], args);
  35113. }
  35114. return this[chainName](function(value) {
  35115. return func.apply(isArray(value) ? value : [], args);
  35116. });
  35117. };
  35118. });
  35119. // Map minified method names to their real names.
  35120. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35121. var lodashFunc = lodash[methodName];
  35122. if (lodashFunc) {
  35123. var key = lodashFunc.name + '';
  35124. if (!hasOwnProperty.call(realNames, key)) {
  35125. realNames[key] = [];
  35126. }
  35127. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35128. }
  35129. });
  35130. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35131. 'name': 'wrapper',
  35132. 'func': undefined
  35133. }];
  35134. // Add methods to `LazyWrapper`.
  35135. LazyWrapper.prototype.clone = lazyClone;
  35136. LazyWrapper.prototype.reverse = lazyReverse;
  35137. LazyWrapper.prototype.value = lazyValue;
  35138. // Add chain sequence methods to the `lodash` wrapper.
  35139. lodash.prototype.at = wrapperAt;
  35140. lodash.prototype.chain = wrapperChain;
  35141. lodash.prototype.commit = wrapperCommit;
  35142. lodash.prototype.next = wrapperNext;
  35143. lodash.prototype.plant = wrapperPlant;
  35144. lodash.prototype.reverse = wrapperReverse;
  35145. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35146. // Add lazy aliases.
  35147. lodash.prototype.first = lodash.prototype.head;
  35148. if (symIterator) {
  35149. lodash.prototype[symIterator] = wrapperToIterator;
  35150. }
  35151. return lodash;
  35152. });
  35153. /*--------------------------------------------------------------------------*/
  35154. // Export lodash.
  35155. var _ = runInContext();
  35156. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35157. if (true) {
  35158. // Expose Lodash on the global object to prevent errors when Lodash is
  35159. // loaded by a script tag in the presence of an AMD loader.
  35160. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35161. // Use `_.noConflict` to remove Lodash from the global object.
  35162. root._ = _;
  35163. // Define as an anonymous module so, through path mapping, it can be
  35164. // referenced as the "underscore" module.
  35165. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35166. return _;
  35167. }).call(exports, __webpack_require__, exports, module),
  35168. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35169. }
  35170. // Check for `exports` after `define` in case a build optimizer adds it.
  35171. else {}
  35172. }.call(this));
  35173. /* 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)))
  35174. /***/ }),
  35175. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35176. /*!***************************************************!*\
  35177. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35178. \***************************************************/
  35179. /*! exports provided: default */
  35180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35181. "use strict";
  35182. __webpack_require__.r(__webpack_exports__);
  35183. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35184. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35185. * @version 1.16.1
  35186. * @license
  35187. * Copyright (c) 2016 Federico Zivolo and contributors
  35188. *
  35189. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35190. * of this software and associated documentation files (the "Software"), to deal
  35191. * in the Software without restriction, including without limitation the rights
  35192. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35193. * copies of the Software, and to permit persons to whom the Software is
  35194. * furnished to do so, subject to the following conditions:
  35195. *
  35196. * The above copyright notice and this permission notice shall be included in all
  35197. * copies or substantial portions of the Software.
  35198. *
  35199. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35200. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35201. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35202. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35203. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35204. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35205. * SOFTWARE.
  35206. */
  35207. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35208. var timeoutDuration = function () {
  35209. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35210. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35211. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35212. return 1;
  35213. }
  35214. }
  35215. return 0;
  35216. }();
  35217. function microtaskDebounce(fn) {
  35218. var called = false;
  35219. return function () {
  35220. if (called) {
  35221. return;
  35222. }
  35223. called = true;
  35224. window.Promise.resolve().then(function () {
  35225. called = false;
  35226. fn();
  35227. });
  35228. };
  35229. }
  35230. function taskDebounce(fn) {
  35231. var scheduled = false;
  35232. return function () {
  35233. if (!scheduled) {
  35234. scheduled = true;
  35235. setTimeout(function () {
  35236. scheduled = false;
  35237. fn();
  35238. }, timeoutDuration);
  35239. }
  35240. };
  35241. }
  35242. var supportsMicroTasks = isBrowser && window.Promise;
  35243. /**
  35244. * Create a debounced version of a method, that's asynchronously deferred
  35245. * but called in the minimum time possible.
  35246. *
  35247. * @method
  35248. * @memberof Popper.Utils
  35249. * @argument {Function} fn
  35250. * @returns {Function}
  35251. */
  35252. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35253. /**
  35254. * Check if the given variable is a function
  35255. * @method
  35256. * @memberof Popper.Utils
  35257. * @argument {Any} functionToCheck - variable to check
  35258. * @returns {Boolean} answer to: is a function?
  35259. */
  35260. function isFunction(functionToCheck) {
  35261. var getType = {};
  35262. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35263. }
  35264. /**
  35265. * Get CSS computed property of the given element
  35266. * @method
  35267. * @memberof Popper.Utils
  35268. * @argument {Eement} element
  35269. * @argument {String} property
  35270. */
  35271. function getStyleComputedProperty(element, property) {
  35272. if (element.nodeType !== 1) {
  35273. return [];
  35274. }
  35275. // NOTE: 1 DOM access here
  35276. var window = element.ownerDocument.defaultView;
  35277. var css = window.getComputedStyle(element, null);
  35278. return property ? css[property] : css;
  35279. }
  35280. /**
  35281. * Returns the parentNode or the host of the element
  35282. * @method
  35283. * @memberof Popper.Utils
  35284. * @argument {Element} element
  35285. * @returns {Element} parent
  35286. */
  35287. function getParentNode(element) {
  35288. if (element.nodeName === 'HTML') {
  35289. return element;
  35290. }
  35291. return element.parentNode || element.host;
  35292. }
  35293. /**
  35294. * Returns the scrolling parent of the given element
  35295. * @method
  35296. * @memberof Popper.Utils
  35297. * @argument {Element} element
  35298. * @returns {Element} scroll parent
  35299. */
  35300. function getScrollParent(element) {
  35301. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35302. if (!element) {
  35303. return document.body;
  35304. }
  35305. switch (element.nodeName) {
  35306. case 'HTML':
  35307. case 'BODY':
  35308. return element.ownerDocument.body;
  35309. case '#document':
  35310. return element.body;
  35311. }
  35312. // Firefox want us to check `-x` and `-y` variations as well
  35313. var _getStyleComputedProp = getStyleComputedProperty(element),
  35314. overflow = _getStyleComputedProp.overflow,
  35315. overflowX = _getStyleComputedProp.overflowX,
  35316. overflowY = _getStyleComputedProp.overflowY;
  35317. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35318. return element;
  35319. }
  35320. return getScrollParent(getParentNode(element));
  35321. }
  35322. /**
  35323. * Returns the reference node of the reference object, or the reference object itself.
  35324. * @method
  35325. * @memberof Popper.Utils
  35326. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35327. * @returns {Element} parent
  35328. */
  35329. function getReferenceNode(reference) {
  35330. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35331. }
  35332. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35333. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35334. /**
  35335. * Determines if the browser is Internet Explorer
  35336. * @method
  35337. * @memberof Popper.Utils
  35338. * @param {Number} version to check
  35339. * @returns {Boolean} isIE
  35340. */
  35341. function isIE(version) {
  35342. if (version === 11) {
  35343. return isIE11;
  35344. }
  35345. if (version === 10) {
  35346. return isIE10;
  35347. }
  35348. return isIE11 || isIE10;
  35349. }
  35350. /**
  35351. * Returns the offset parent of the given element
  35352. * @method
  35353. * @memberof Popper.Utils
  35354. * @argument {Element} element
  35355. * @returns {Element} offset parent
  35356. */
  35357. function getOffsetParent(element) {
  35358. if (!element) {
  35359. return document.documentElement;
  35360. }
  35361. var noOffsetParent = isIE(10) ? document.body : null;
  35362. // NOTE: 1 DOM access here
  35363. var offsetParent = element.offsetParent || null;
  35364. // Skip hidden elements which don't have an offsetParent
  35365. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35366. offsetParent = (element = element.nextElementSibling).offsetParent;
  35367. }
  35368. var nodeName = offsetParent && offsetParent.nodeName;
  35369. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35370. return element ? element.ownerDocument.documentElement : document.documentElement;
  35371. }
  35372. // .offsetParent will return the closest TH, TD or TABLE in case
  35373. // no offsetParent is present, I hate this job...
  35374. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35375. return getOffsetParent(offsetParent);
  35376. }
  35377. return offsetParent;
  35378. }
  35379. function isOffsetContainer(element) {
  35380. var nodeName = element.nodeName;
  35381. if (nodeName === 'BODY') {
  35382. return false;
  35383. }
  35384. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35385. }
  35386. /**
  35387. * Finds the root node (document, shadowDOM root) of the given element
  35388. * @method
  35389. * @memberof Popper.Utils
  35390. * @argument {Element} node
  35391. * @returns {Element} root node
  35392. */
  35393. function getRoot(node) {
  35394. if (node.parentNode !== null) {
  35395. return getRoot(node.parentNode);
  35396. }
  35397. return node;
  35398. }
  35399. /**
  35400. * Finds the offset parent common to the two provided nodes
  35401. * @method
  35402. * @memberof Popper.Utils
  35403. * @argument {Element} element1
  35404. * @argument {Element} element2
  35405. * @returns {Element} common offset parent
  35406. */
  35407. function findCommonOffsetParent(element1, element2) {
  35408. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35409. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35410. return document.documentElement;
  35411. }
  35412. // Here we make sure to give as "start" the element that comes first in the DOM
  35413. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35414. var start = order ? element1 : element2;
  35415. var end = order ? element2 : element1;
  35416. // Get common ancestor container
  35417. var range = document.createRange();
  35418. range.setStart(start, 0);
  35419. range.setEnd(end, 0);
  35420. var commonAncestorContainer = range.commonAncestorContainer;
  35421. // Both nodes are inside #document
  35422. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35423. if (isOffsetContainer(commonAncestorContainer)) {
  35424. return commonAncestorContainer;
  35425. }
  35426. return getOffsetParent(commonAncestorContainer);
  35427. }
  35428. // one of the nodes is inside shadowDOM, find which one
  35429. var element1root = getRoot(element1);
  35430. if (element1root.host) {
  35431. return findCommonOffsetParent(element1root.host, element2);
  35432. } else {
  35433. return findCommonOffsetParent(element1, getRoot(element2).host);
  35434. }
  35435. }
  35436. /**
  35437. * Gets the scroll value of the given element in the given side (top and left)
  35438. * @method
  35439. * @memberof Popper.Utils
  35440. * @argument {Element} element
  35441. * @argument {String} side `top` or `left`
  35442. * @returns {number} amount of scrolled pixels
  35443. */
  35444. function getScroll(element) {
  35445. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35446. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35447. var nodeName = element.nodeName;
  35448. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35449. var html = element.ownerDocument.documentElement;
  35450. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35451. return scrollingElement[upperSide];
  35452. }
  35453. return element[upperSide];
  35454. }
  35455. /*
  35456. * Sum or subtract the element scroll values (left and top) from a given rect object
  35457. * @method
  35458. * @memberof Popper.Utils
  35459. * @param {Object} rect - Rect object you want to change
  35460. * @param {HTMLElement} element - The element from the function reads the scroll values
  35461. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35462. * @return {Object} rect - The modifier rect object
  35463. */
  35464. function includeScroll(rect, element) {
  35465. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35466. var scrollTop = getScroll(element, 'top');
  35467. var scrollLeft = getScroll(element, 'left');
  35468. var modifier = subtract ? -1 : 1;
  35469. rect.top += scrollTop * modifier;
  35470. rect.bottom += scrollTop * modifier;
  35471. rect.left += scrollLeft * modifier;
  35472. rect.right += scrollLeft * modifier;
  35473. return rect;
  35474. }
  35475. /*
  35476. * Helper to detect borders of a given element
  35477. * @method
  35478. * @memberof Popper.Utils
  35479. * @param {CSSStyleDeclaration} styles
  35480. * Result of `getStyleComputedProperty` on the given element
  35481. * @param {String} axis - `x` or `y`
  35482. * @return {number} borders - The borders size of the given axis
  35483. */
  35484. function getBordersSize(styles, axis) {
  35485. var sideA = axis === 'x' ? 'Left' : 'Top';
  35486. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35487. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35488. }
  35489. function getSize(axis, body, html, computedStyle) {
  35490. 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);
  35491. }
  35492. function getWindowSizes(document) {
  35493. var body = document.body;
  35494. var html = document.documentElement;
  35495. var computedStyle = isIE(10) && getComputedStyle(html);
  35496. return {
  35497. height: getSize('Height', body, html, computedStyle),
  35498. width: getSize('Width', body, html, computedStyle)
  35499. };
  35500. }
  35501. var classCallCheck = function (instance, Constructor) {
  35502. if (!(instance instanceof Constructor)) {
  35503. throw new TypeError("Cannot call a class as a function");
  35504. }
  35505. };
  35506. var createClass = function () {
  35507. function defineProperties(target, props) {
  35508. for (var i = 0; i < props.length; i++) {
  35509. var descriptor = props[i];
  35510. descriptor.enumerable = descriptor.enumerable || false;
  35511. descriptor.configurable = true;
  35512. if ("value" in descriptor) descriptor.writable = true;
  35513. Object.defineProperty(target, descriptor.key, descriptor);
  35514. }
  35515. }
  35516. return function (Constructor, protoProps, staticProps) {
  35517. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35518. if (staticProps) defineProperties(Constructor, staticProps);
  35519. return Constructor;
  35520. };
  35521. }();
  35522. var defineProperty = function (obj, key, value) {
  35523. if (key in obj) {
  35524. Object.defineProperty(obj, key, {
  35525. value: value,
  35526. enumerable: true,
  35527. configurable: true,
  35528. writable: true
  35529. });
  35530. } else {
  35531. obj[key] = value;
  35532. }
  35533. return obj;
  35534. };
  35535. var _extends = Object.assign || function (target) {
  35536. for (var i = 1; i < arguments.length; i++) {
  35537. var source = arguments[i];
  35538. for (var key in source) {
  35539. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35540. target[key] = source[key];
  35541. }
  35542. }
  35543. }
  35544. return target;
  35545. };
  35546. /**
  35547. * Given element offsets, generate an output similar to getBoundingClientRect
  35548. * @method
  35549. * @memberof Popper.Utils
  35550. * @argument {Object} offsets
  35551. * @returns {Object} ClientRect like output
  35552. */
  35553. function getClientRect(offsets) {
  35554. return _extends({}, offsets, {
  35555. right: offsets.left + offsets.width,
  35556. bottom: offsets.top + offsets.height
  35557. });
  35558. }
  35559. /**
  35560. * Get bounding client rect of given element
  35561. * @method
  35562. * @memberof Popper.Utils
  35563. * @param {HTMLElement} element
  35564. * @return {Object} client rect
  35565. */
  35566. function getBoundingClientRect(element) {
  35567. var rect = {};
  35568. // IE10 10 FIX: Please, don't ask, the element isn't
  35569. // considered in DOM in some circumstances...
  35570. // This isn't reproducible in IE10 compatibility mode of IE11
  35571. try {
  35572. if (isIE(10)) {
  35573. rect = element.getBoundingClientRect();
  35574. var scrollTop = getScroll(element, 'top');
  35575. var scrollLeft = getScroll(element, 'left');
  35576. rect.top += scrollTop;
  35577. rect.left += scrollLeft;
  35578. rect.bottom += scrollTop;
  35579. rect.right += scrollLeft;
  35580. } else {
  35581. rect = element.getBoundingClientRect();
  35582. }
  35583. } catch (e) {}
  35584. var result = {
  35585. left: rect.left,
  35586. top: rect.top,
  35587. width: rect.right - rect.left,
  35588. height: rect.bottom - rect.top
  35589. };
  35590. // subtract scrollbar size from sizes
  35591. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35592. var width = sizes.width || element.clientWidth || result.width;
  35593. var height = sizes.height || element.clientHeight || result.height;
  35594. var horizScrollbar = element.offsetWidth - width;
  35595. var vertScrollbar = element.offsetHeight - height;
  35596. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35597. // we make this check conditional for performance reasons
  35598. if (horizScrollbar || vertScrollbar) {
  35599. var styles = getStyleComputedProperty(element);
  35600. horizScrollbar -= getBordersSize(styles, 'x');
  35601. vertScrollbar -= getBordersSize(styles, 'y');
  35602. result.width -= horizScrollbar;
  35603. result.height -= vertScrollbar;
  35604. }
  35605. return getClientRect(result);
  35606. }
  35607. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35608. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35609. var isIE10 = isIE(10);
  35610. var isHTML = parent.nodeName === 'HTML';
  35611. var childrenRect = getBoundingClientRect(children);
  35612. var parentRect = getBoundingClientRect(parent);
  35613. var scrollParent = getScrollParent(children);
  35614. var styles = getStyleComputedProperty(parent);
  35615. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35616. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35617. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35618. if (fixedPosition && isHTML) {
  35619. parentRect.top = Math.max(parentRect.top, 0);
  35620. parentRect.left = Math.max(parentRect.left, 0);
  35621. }
  35622. var offsets = getClientRect({
  35623. top: childrenRect.top - parentRect.top - borderTopWidth,
  35624. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35625. width: childrenRect.width,
  35626. height: childrenRect.height
  35627. });
  35628. offsets.marginTop = 0;
  35629. offsets.marginLeft = 0;
  35630. // Subtract margins of documentElement in case it's being used as parent
  35631. // we do this only on HTML because it's the only element that behaves
  35632. // differently when margins are applied to it. The margins are included in
  35633. // the box of the documentElement, in the other cases not.
  35634. if (!isIE10 && isHTML) {
  35635. var marginTop = parseFloat(styles.marginTop);
  35636. var marginLeft = parseFloat(styles.marginLeft);
  35637. offsets.top -= borderTopWidth - marginTop;
  35638. offsets.bottom -= borderTopWidth - marginTop;
  35639. offsets.left -= borderLeftWidth - marginLeft;
  35640. offsets.right -= borderLeftWidth - marginLeft;
  35641. // Attach marginTop and marginLeft because in some circumstances we may need them
  35642. offsets.marginTop = marginTop;
  35643. offsets.marginLeft = marginLeft;
  35644. }
  35645. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35646. offsets = includeScroll(offsets, parent);
  35647. }
  35648. return offsets;
  35649. }
  35650. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35651. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35652. var html = element.ownerDocument.documentElement;
  35653. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35654. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35655. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35656. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35657. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35658. var offset = {
  35659. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35660. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35661. width: width,
  35662. height: height
  35663. };
  35664. return getClientRect(offset);
  35665. }
  35666. /**
  35667. * Check if the given element is fixed or is inside a fixed parent
  35668. * @method
  35669. * @memberof Popper.Utils
  35670. * @argument {Element} element
  35671. * @argument {Element} customContainer
  35672. * @returns {Boolean} answer to "isFixed?"
  35673. */
  35674. function isFixed(element) {
  35675. var nodeName = element.nodeName;
  35676. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35677. return false;
  35678. }
  35679. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35680. return true;
  35681. }
  35682. var parentNode = getParentNode(element);
  35683. if (!parentNode) {
  35684. return false;
  35685. }
  35686. return isFixed(parentNode);
  35687. }
  35688. /**
  35689. * Finds the first parent of an element that has a transformed property defined
  35690. * @method
  35691. * @memberof Popper.Utils
  35692. * @argument {Element} element
  35693. * @returns {Element} first transformed parent or documentElement
  35694. */
  35695. function getFixedPositionOffsetParent(element) {
  35696. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35697. if (!element || !element.parentElement || isIE()) {
  35698. return document.documentElement;
  35699. }
  35700. var el = element.parentElement;
  35701. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35702. el = el.parentElement;
  35703. }
  35704. return el || document.documentElement;
  35705. }
  35706. /**
  35707. * Computed the boundaries limits and return them
  35708. * @method
  35709. * @memberof Popper.Utils
  35710. * @param {HTMLElement} popper
  35711. * @param {HTMLElement} reference
  35712. * @param {number} padding
  35713. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35714. * @param {Boolean} fixedPosition - Is in fixed position mode
  35715. * @returns {Object} Coordinates of the boundaries
  35716. */
  35717. function getBoundaries(popper, reference, padding, boundariesElement) {
  35718. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35719. // NOTE: 1 DOM access here
  35720. var boundaries = { top: 0, left: 0 };
  35721. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35722. // Handle viewport case
  35723. if (boundariesElement === 'viewport') {
  35724. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35725. } else {
  35726. // Handle other cases based on DOM element used as boundaries
  35727. var boundariesNode = void 0;
  35728. if (boundariesElement === 'scrollParent') {
  35729. boundariesNode = getScrollParent(getParentNode(reference));
  35730. if (boundariesNode.nodeName === 'BODY') {
  35731. boundariesNode = popper.ownerDocument.documentElement;
  35732. }
  35733. } else if (boundariesElement === 'window') {
  35734. boundariesNode = popper.ownerDocument.documentElement;
  35735. } else {
  35736. boundariesNode = boundariesElement;
  35737. }
  35738. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35739. // In case of HTML, we need a different computation
  35740. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35741. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35742. height = _getWindowSizes.height,
  35743. width = _getWindowSizes.width;
  35744. boundaries.top += offsets.top - offsets.marginTop;
  35745. boundaries.bottom = height + offsets.top;
  35746. boundaries.left += offsets.left - offsets.marginLeft;
  35747. boundaries.right = width + offsets.left;
  35748. } else {
  35749. // for all the other DOM elements, this one is good
  35750. boundaries = offsets;
  35751. }
  35752. }
  35753. // Add paddings
  35754. padding = padding || 0;
  35755. var isPaddingNumber = typeof padding === 'number';
  35756. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35757. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35758. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35759. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35760. return boundaries;
  35761. }
  35762. function getArea(_ref) {
  35763. var width = _ref.width,
  35764. height = _ref.height;
  35765. return width * height;
  35766. }
  35767. /**
  35768. * Utility used to transform the `auto` placement to the placement with more
  35769. * available space.
  35770. * @method
  35771. * @memberof Popper.Utils
  35772. * @argument {Object} data - The data object generated by update method
  35773. * @argument {Object} options - Modifiers configuration and options
  35774. * @returns {Object} The data object, properly modified
  35775. */
  35776. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35777. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35778. if (placement.indexOf('auto') === -1) {
  35779. return placement;
  35780. }
  35781. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35782. var rects = {
  35783. top: {
  35784. width: boundaries.width,
  35785. height: refRect.top - boundaries.top
  35786. },
  35787. right: {
  35788. width: boundaries.right - refRect.right,
  35789. height: boundaries.height
  35790. },
  35791. bottom: {
  35792. width: boundaries.width,
  35793. height: boundaries.bottom - refRect.bottom
  35794. },
  35795. left: {
  35796. width: refRect.left - boundaries.left,
  35797. height: boundaries.height
  35798. }
  35799. };
  35800. var sortedAreas = Object.keys(rects).map(function (key) {
  35801. return _extends({
  35802. key: key
  35803. }, rects[key], {
  35804. area: getArea(rects[key])
  35805. });
  35806. }).sort(function (a, b) {
  35807. return b.area - a.area;
  35808. });
  35809. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35810. var width = _ref2.width,
  35811. height = _ref2.height;
  35812. return width >= popper.clientWidth && height >= popper.clientHeight;
  35813. });
  35814. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35815. var variation = placement.split('-')[1];
  35816. return computedPlacement + (variation ? '-' + variation : '');
  35817. }
  35818. /**
  35819. * Get offsets to the reference element
  35820. * @method
  35821. * @memberof Popper.Utils
  35822. * @param {Object} state
  35823. * @param {Element} popper - the popper element
  35824. * @param {Element} reference - the reference element (the popper will be relative to this)
  35825. * @param {Element} fixedPosition - is in fixed position mode
  35826. * @returns {Object} An object containing the offsets which will be applied to the popper
  35827. */
  35828. function getReferenceOffsets(state, popper, reference) {
  35829. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35830. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35831. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35832. }
  35833. /**
  35834. * Get the outer sizes of the given element (offset size + margins)
  35835. * @method
  35836. * @memberof Popper.Utils
  35837. * @argument {Element} element
  35838. * @returns {Object} object containing width and height properties
  35839. */
  35840. function getOuterSizes(element) {
  35841. var window = element.ownerDocument.defaultView;
  35842. var styles = window.getComputedStyle(element);
  35843. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35844. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35845. var result = {
  35846. width: element.offsetWidth + y,
  35847. height: element.offsetHeight + x
  35848. };
  35849. return result;
  35850. }
  35851. /**
  35852. * Get the opposite placement of the given one
  35853. * @method
  35854. * @memberof Popper.Utils
  35855. * @argument {String} placement
  35856. * @returns {String} flipped placement
  35857. */
  35858. function getOppositePlacement(placement) {
  35859. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35860. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35861. return hash[matched];
  35862. });
  35863. }
  35864. /**
  35865. * Get offsets to the popper
  35866. * @method
  35867. * @memberof Popper.Utils
  35868. * @param {Object} position - CSS position the Popper will get applied
  35869. * @param {HTMLElement} popper - the popper element
  35870. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35871. * @param {String} placement - one of the valid placement options
  35872. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35873. */
  35874. function getPopperOffsets(popper, referenceOffsets, placement) {
  35875. placement = placement.split('-')[0];
  35876. // Get popper node sizes
  35877. var popperRect = getOuterSizes(popper);
  35878. // Add position, width and height to our offsets object
  35879. var popperOffsets = {
  35880. width: popperRect.width,
  35881. height: popperRect.height
  35882. };
  35883. // depending by the popper placement we have to compute its offsets slightly differently
  35884. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35885. var mainSide = isHoriz ? 'top' : 'left';
  35886. var secondarySide = isHoriz ? 'left' : 'top';
  35887. var measurement = isHoriz ? 'height' : 'width';
  35888. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35889. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35890. if (placement === secondarySide) {
  35891. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35892. } else {
  35893. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35894. }
  35895. return popperOffsets;
  35896. }
  35897. /**
  35898. * Mimics the `find` method of Array
  35899. * @method
  35900. * @memberof Popper.Utils
  35901. * @argument {Array} arr
  35902. * @argument prop
  35903. * @argument value
  35904. * @returns index or -1
  35905. */
  35906. function find(arr, check) {
  35907. // use native find if supported
  35908. if (Array.prototype.find) {
  35909. return arr.find(check);
  35910. }
  35911. // use `filter` to obtain the same behavior of `find`
  35912. return arr.filter(check)[0];
  35913. }
  35914. /**
  35915. * Return the index of the matching object
  35916. * @method
  35917. * @memberof Popper.Utils
  35918. * @argument {Array} arr
  35919. * @argument prop
  35920. * @argument value
  35921. * @returns index or -1
  35922. */
  35923. function findIndex(arr, prop, value) {
  35924. // use native findIndex if supported
  35925. if (Array.prototype.findIndex) {
  35926. return arr.findIndex(function (cur) {
  35927. return cur[prop] === value;
  35928. });
  35929. }
  35930. // use `find` + `indexOf` if `findIndex` isn't supported
  35931. var match = find(arr, function (obj) {
  35932. return obj[prop] === value;
  35933. });
  35934. return arr.indexOf(match);
  35935. }
  35936. /**
  35937. * Loop trough the list of modifiers and run them in order,
  35938. * each of them will then edit the data object.
  35939. * @method
  35940. * @memberof Popper.Utils
  35941. * @param {dataObject} data
  35942. * @param {Array} modifiers
  35943. * @param {String} ends - Optional modifier name used as stopper
  35944. * @returns {dataObject}
  35945. */
  35946. function runModifiers(modifiers, data, ends) {
  35947. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35948. modifiersToRun.forEach(function (modifier) {
  35949. if (modifier['function']) {
  35950. // eslint-disable-line dot-notation
  35951. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35952. }
  35953. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35954. if (modifier.enabled && isFunction(fn)) {
  35955. // Add properties to offsets to make them a complete clientRect object
  35956. // we do this before each modifier to make sure the previous one doesn't
  35957. // mess with these values
  35958. data.offsets.popper = getClientRect(data.offsets.popper);
  35959. data.offsets.reference = getClientRect(data.offsets.reference);
  35960. data = fn(data, modifier);
  35961. }
  35962. });
  35963. return data;
  35964. }
  35965. /**
  35966. * Updates the position of the popper, computing the new offsets and applying
  35967. * the new style.<br />
  35968. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35969. * @method
  35970. * @memberof Popper
  35971. */
  35972. function update() {
  35973. // if popper is destroyed, don't perform any further update
  35974. if (this.state.isDestroyed) {
  35975. return;
  35976. }
  35977. var data = {
  35978. instance: this,
  35979. styles: {},
  35980. arrowStyles: {},
  35981. attributes: {},
  35982. flipped: false,
  35983. offsets: {}
  35984. };
  35985. // compute reference element offsets
  35986. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35987. // compute auto placement, store placement inside the data object,
  35988. // modifiers will be able to edit `placement` if needed
  35989. // and refer to originalPlacement to know the original value
  35990. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35991. // store the computed placement inside `originalPlacement`
  35992. data.originalPlacement = data.placement;
  35993. data.positionFixed = this.options.positionFixed;
  35994. // compute the popper offsets
  35995. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35996. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35997. // run the modifiers
  35998. data = runModifiers(this.modifiers, data);
  35999. // the first `update` will call `onCreate` callback
  36000. // the other ones will call `onUpdate` callback
  36001. if (!this.state.isCreated) {
  36002. this.state.isCreated = true;
  36003. this.options.onCreate(data);
  36004. } else {
  36005. this.options.onUpdate(data);
  36006. }
  36007. }
  36008. /**
  36009. * Helper used to know if the given modifier is enabled.
  36010. * @method
  36011. * @memberof Popper.Utils
  36012. * @returns {Boolean}
  36013. */
  36014. function isModifierEnabled(modifiers, modifierName) {
  36015. return modifiers.some(function (_ref) {
  36016. var name = _ref.name,
  36017. enabled = _ref.enabled;
  36018. return enabled && name === modifierName;
  36019. });
  36020. }
  36021. /**
  36022. * Get the prefixed supported property name
  36023. * @method
  36024. * @memberof Popper.Utils
  36025. * @argument {String} property (camelCase)
  36026. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36027. */
  36028. function getSupportedPropertyName(property) {
  36029. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36030. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36031. for (var i = 0; i < prefixes.length; i++) {
  36032. var prefix = prefixes[i];
  36033. var toCheck = prefix ? '' + prefix + upperProp : property;
  36034. if (typeof document.body.style[toCheck] !== 'undefined') {
  36035. return toCheck;
  36036. }
  36037. }
  36038. return null;
  36039. }
  36040. /**
  36041. * Destroys the popper.
  36042. * @method
  36043. * @memberof Popper
  36044. */
  36045. function destroy() {
  36046. this.state.isDestroyed = true;
  36047. // touch DOM only if `applyStyle` modifier is enabled
  36048. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36049. this.popper.removeAttribute('x-placement');
  36050. this.popper.style.position = '';
  36051. this.popper.style.top = '';
  36052. this.popper.style.left = '';
  36053. this.popper.style.right = '';
  36054. this.popper.style.bottom = '';
  36055. this.popper.style.willChange = '';
  36056. this.popper.style[getSupportedPropertyName('transform')] = '';
  36057. }
  36058. this.disableEventListeners();
  36059. // remove the popper if user explicitly asked for the deletion on destroy
  36060. // do not use `remove` because IE11 doesn't support it
  36061. if (this.options.removeOnDestroy) {
  36062. this.popper.parentNode.removeChild(this.popper);
  36063. }
  36064. return this;
  36065. }
  36066. /**
  36067. * Get the window associated with the element
  36068. * @argument {Element} element
  36069. * @returns {Window}
  36070. */
  36071. function getWindow(element) {
  36072. var ownerDocument = element.ownerDocument;
  36073. return ownerDocument ? ownerDocument.defaultView : window;
  36074. }
  36075. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36076. var isBody = scrollParent.nodeName === 'BODY';
  36077. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36078. target.addEventListener(event, callback, { passive: true });
  36079. if (!isBody) {
  36080. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36081. }
  36082. scrollParents.push(target);
  36083. }
  36084. /**
  36085. * Setup needed event listeners used to update the popper position
  36086. * @method
  36087. * @memberof Popper.Utils
  36088. * @private
  36089. */
  36090. function setupEventListeners(reference, options, state, updateBound) {
  36091. // Resize event listener on window
  36092. state.updateBound = updateBound;
  36093. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36094. // Scroll event listener on scroll parents
  36095. var scrollElement = getScrollParent(reference);
  36096. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36097. state.scrollElement = scrollElement;
  36098. state.eventsEnabled = true;
  36099. return state;
  36100. }
  36101. /**
  36102. * It will add resize/scroll events and start recalculating
  36103. * position of the popper element when they are triggered.
  36104. * @method
  36105. * @memberof Popper
  36106. */
  36107. function enableEventListeners() {
  36108. if (!this.state.eventsEnabled) {
  36109. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36110. }
  36111. }
  36112. /**
  36113. * Remove event listeners used to update the popper position
  36114. * @method
  36115. * @memberof Popper.Utils
  36116. * @private
  36117. */
  36118. function removeEventListeners(reference, state) {
  36119. // Remove resize event listener on window
  36120. getWindow(reference).removeEventListener('resize', state.updateBound);
  36121. // Remove scroll event listener on scroll parents
  36122. state.scrollParents.forEach(function (target) {
  36123. target.removeEventListener('scroll', state.updateBound);
  36124. });
  36125. // Reset state
  36126. state.updateBound = null;
  36127. state.scrollParents = [];
  36128. state.scrollElement = null;
  36129. state.eventsEnabled = false;
  36130. return state;
  36131. }
  36132. /**
  36133. * It will remove resize/scroll events and won't recalculate popper position
  36134. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36135. * unless you call `update` method manually.
  36136. * @method
  36137. * @memberof Popper
  36138. */
  36139. function disableEventListeners() {
  36140. if (this.state.eventsEnabled) {
  36141. cancelAnimationFrame(this.scheduleUpdate);
  36142. this.state = removeEventListeners(this.reference, this.state);
  36143. }
  36144. }
  36145. /**
  36146. * Tells if a given input is a number
  36147. * @method
  36148. * @memberof Popper.Utils
  36149. * @param {*} input to check
  36150. * @return {Boolean}
  36151. */
  36152. function isNumeric(n) {
  36153. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36154. }
  36155. /**
  36156. * Set the style to the given popper
  36157. * @method
  36158. * @memberof Popper.Utils
  36159. * @argument {Element} element - Element to apply the style to
  36160. * @argument {Object} styles
  36161. * Object with a list of properties and values which will be applied to the element
  36162. */
  36163. function setStyles(element, styles) {
  36164. Object.keys(styles).forEach(function (prop) {
  36165. var unit = '';
  36166. // add unit if the value is numeric and is one of the following
  36167. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36168. unit = 'px';
  36169. }
  36170. element.style[prop] = styles[prop] + unit;
  36171. });
  36172. }
  36173. /**
  36174. * Set the attributes to the given popper
  36175. * @method
  36176. * @memberof Popper.Utils
  36177. * @argument {Element} element - Element to apply the attributes to
  36178. * @argument {Object} styles
  36179. * Object with a list of properties and values which will be applied to the element
  36180. */
  36181. function setAttributes(element, attributes) {
  36182. Object.keys(attributes).forEach(function (prop) {
  36183. var value = attributes[prop];
  36184. if (value !== false) {
  36185. element.setAttribute(prop, attributes[prop]);
  36186. } else {
  36187. element.removeAttribute(prop);
  36188. }
  36189. });
  36190. }
  36191. /**
  36192. * @function
  36193. * @memberof Modifiers
  36194. * @argument {Object} data - The data object generated by `update` method
  36195. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36196. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36197. * @argument {Object} options - Modifiers configuration and options
  36198. * @returns {Object} The same data object
  36199. */
  36200. function applyStyle(data) {
  36201. // any property present in `data.styles` will be applied to the popper,
  36202. // in this way we can make the 3rd party modifiers add custom styles to it
  36203. // Be aware, modifiers could override the properties defined in the previous
  36204. // lines of this modifier!
  36205. setStyles(data.instance.popper, data.styles);
  36206. // any property present in `data.attributes` will be applied to the popper,
  36207. // they will be set as HTML attributes of the element
  36208. setAttributes(data.instance.popper, data.attributes);
  36209. // if arrowElement is defined and arrowStyles has some properties
  36210. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36211. setStyles(data.arrowElement, data.arrowStyles);
  36212. }
  36213. return data;
  36214. }
  36215. /**
  36216. * Set the x-placement attribute before everything else because it could be used
  36217. * to add margins to the popper margins needs to be calculated to get the
  36218. * correct popper offsets.
  36219. * @method
  36220. * @memberof Popper.modifiers
  36221. * @param {HTMLElement} reference - The reference element used to position the popper
  36222. * @param {HTMLElement} popper - The HTML element used as popper
  36223. * @param {Object} options - Popper.js options
  36224. */
  36225. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36226. // compute reference element offsets
  36227. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36228. // compute auto placement, store placement inside the data object,
  36229. // modifiers will be able to edit `placement` if needed
  36230. // and refer to originalPlacement to know the original value
  36231. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36232. popper.setAttribute('x-placement', placement);
  36233. // Apply `position` to popper before anything else because
  36234. // without the position applied we can't guarantee correct computations
  36235. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36236. return options;
  36237. }
  36238. /**
  36239. * @function
  36240. * @memberof Popper.Utils
  36241. * @argument {Object} data - The data object generated by `update` method
  36242. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36243. * @returns {Object} The popper's position offsets rounded
  36244. *
  36245. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36246. * good as it can be within reason.
  36247. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36248. *
  36249. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36250. * as well on High DPI screens).
  36251. *
  36252. * Firefox prefers no rounding for positioning and does not have blurriness on
  36253. * high DPI screens.
  36254. *
  36255. * Only horizontal placement and left/right values need to be considered.
  36256. */
  36257. function getRoundedOffsets(data, shouldRound) {
  36258. var _data$offsets = data.offsets,
  36259. popper = _data$offsets.popper,
  36260. reference = _data$offsets.reference;
  36261. var round = Math.round,
  36262. floor = Math.floor;
  36263. var noRound = function noRound(v) {
  36264. return v;
  36265. };
  36266. var referenceWidth = round(reference.width);
  36267. var popperWidth = round(popper.width);
  36268. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36269. var isVariation = data.placement.indexOf('-') !== -1;
  36270. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36271. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36272. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36273. var verticalToInteger = !shouldRound ? noRound : round;
  36274. return {
  36275. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36276. top: verticalToInteger(popper.top),
  36277. bottom: verticalToInteger(popper.bottom),
  36278. right: horizontalToInteger(popper.right)
  36279. };
  36280. }
  36281. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36282. /**
  36283. * @function
  36284. * @memberof Modifiers
  36285. * @argument {Object} data - The data object generated by `update` method
  36286. * @argument {Object} options - Modifiers configuration and options
  36287. * @returns {Object} The data object, properly modified
  36288. */
  36289. function computeStyle(data, options) {
  36290. var x = options.x,
  36291. y = options.y;
  36292. var popper = data.offsets.popper;
  36293. // Remove this legacy support in Popper.js v2
  36294. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36295. return modifier.name === 'applyStyle';
  36296. }).gpuAcceleration;
  36297. if (legacyGpuAccelerationOption !== undefined) {
  36298. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36299. }
  36300. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36301. var offsetParent = getOffsetParent(data.instance.popper);
  36302. var offsetParentRect = getBoundingClientRect(offsetParent);
  36303. // Styles
  36304. var styles = {
  36305. position: popper.position
  36306. };
  36307. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36308. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36309. var sideB = y === 'right' ? 'left' : 'right';
  36310. // if gpuAcceleration is set to `true` and transform is supported,
  36311. // we use `translate3d` to apply the position to the popper we
  36312. // automatically use the supported prefixed version if needed
  36313. var prefixedProperty = getSupportedPropertyName('transform');
  36314. // now, let's make a step back and look at this code closely (wtf?)
  36315. // If the content of the popper grows once it's been positioned, it
  36316. // may happen that the popper gets misplaced because of the new content
  36317. // overflowing its reference element
  36318. // To avoid this problem, we provide two options (x and y), which allow
  36319. // the consumer to define the offset origin.
  36320. // If we position a popper on top of a reference element, we can set
  36321. // `x` to `top` to make the popper grow towards its top instead of
  36322. // its bottom.
  36323. var left = void 0,
  36324. top = void 0;
  36325. if (sideA === 'bottom') {
  36326. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36327. // and not the bottom of the html element
  36328. if (offsetParent.nodeName === 'HTML') {
  36329. top = -offsetParent.clientHeight + offsets.bottom;
  36330. } else {
  36331. top = -offsetParentRect.height + offsets.bottom;
  36332. }
  36333. } else {
  36334. top = offsets.top;
  36335. }
  36336. if (sideB === 'right') {
  36337. if (offsetParent.nodeName === 'HTML') {
  36338. left = -offsetParent.clientWidth + offsets.right;
  36339. } else {
  36340. left = -offsetParentRect.width + offsets.right;
  36341. }
  36342. } else {
  36343. left = offsets.left;
  36344. }
  36345. if (gpuAcceleration && prefixedProperty) {
  36346. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36347. styles[sideA] = 0;
  36348. styles[sideB] = 0;
  36349. styles.willChange = 'transform';
  36350. } else {
  36351. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36352. var invertTop = sideA === 'bottom' ? -1 : 1;
  36353. var invertLeft = sideB === 'right' ? -1 : 1;
  36354. styles[sideA] = top * invertTop;
  36355. styles[sideB] = left * invertLeft;
  36356. styles.willChange = sideA + ', ' + sideB;
  36357. }
  36358. // Attributes
  36359. var attributes = {
  36360. 'x-placement': data.placement
  36361. };
  36362. // Update `data` attributes, styles and arrowStyles
  36363. data.attributes = _extends({}, attributes, data.attributes);
  36364. data.styles = _extends({}, styles, data.styles);
  36365. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36366. return data;
  36367. }
  36368. /**
  36369. * Helper used to know if the given modifier depends from another one.<br />
  36370. * It checks if the needed modifier is listed and enabled.
  36371. * @method
  36372. * @memberof Popper.Utils
  36373. * @param {Array} modifiers - list of modifiers
  36374. * @param {String} requestingName - name of requesting modifier
  36375. * @param {String} requestedName - name of requested modifier
  36376. * @returns {Boolean}
  36377. */
  36378. function isModifierRequired(modifiers, requestingName, requestedName) {
  36379. var requesting = find(modifiers, function (_ref) {
  36380. var name = _ref.name;
  36381. return name === requestingName;
  36382. });
  36383. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36384. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36385. });
  36386. if (!isRequired) {
  36387. var _requesting = '`' + requestingName + '`';
  36388. var requested = '`' + requestedName + '`';
  36389. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36390. }
  36391. return isRequired;
  36392. }
  36393. /**
  36394. * @function
  36395. * @memberof Modifiers
  36396. * @argument {Object} data - The data object generated by update method
  36397. * @argument {Object} options - Modifiers configuration and options
  36398. * @returns {Object} The data object, properly modified
  36399. */
  36400. function arrow(data, options) {
  36401. var _data$offsets$arrow;
  36402. // arrow depends on keepTogether in order to work
  36403. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36404. return data;
  36405. }
  36406. var arrowElement = options.element;
  36407. // if arrowElement is a string, suppose it's a CSS selector
  36408. if (typeof arrowElement === 'string') {
  36409. arrowElement = data.instance.popper.querySelector(arrowElement);
  36410. // if arrowElement is not found, don't run the modifier
  36411. if (!arrowElement) {
  36412. return data;
  36413. }
  36414. } else {
  36415. // if the arrowElement isn't a query selector we must check that the
  36416. // provided DOM node is child of its popper node
  36417. if (!data.instance.popper.contains(arrowElement)) {
  36418. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36419. return data;
  36420. }
  36421. }
  36422. var placement = data.placement.split('-')[0];
  36423. var _data$offsets = data.offsets,
  36424. popper = _data$offsets.popper,
  36425. reference = _data$offsets.reference;
  36426. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36427. var len = isVertical ? 'height' : 'width';
  36428. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36429. var side = sideCapitalized.toLowerCase();
  36430. var altSide = isVertical ? 'left' : 'top';
  36431. var opSide = isVertical ? 'bottom' : 'right';
  36432. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36433. //
  36434. // extends keepTogether behavior making sure the popper and its
  36435. // reference have enough pixels in conjunction
  36436. //
  36437. // top/left side
  36438. if (reference[opSide] - arrowElementSize < popper[side]) {
  36439. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36440. }
  36441. // bottom/right side
  36442. if (reference[side] + arrowElementSize > popper[opSide]) {
  36443. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36444. }
  36445. data.offsets.popper = getClientRect(data.offsets.popper);
  36446. // compute center of the popper
  36447. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36448. // Compute the sideValue using the updated popper offsets
  36449. // take popper margin in account because we don't have this info available
  36450. var css = getStyleComputedProperty(data.instance.popper);
  36451. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36452. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36453. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36454. // prevent arrowElement from being placed not contiguously to its popper
  36455. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36456. data.arrowElement = arrowElement;
  36457. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36458. return data;
  36459. }
  36460. /**
  36461. * Get the opposite placement variation of the given one
  36462. * @method
  36463. * @memberof Popper.Utils
  36464. * @argument {String} placement variation
  36465. * @returns {String} flipped placement variation
  36466. */
  36467. function getOppositeVariation(variation) {
  36468. if (variation === 'end') {
  36469. return 'start';
  36470. } else if (variation === 'start') {
  36471. return 'end';
  36472. }
  36473. return variation;
  36474. }
  36475. /**
  36476. * List of accepted placements to use as values of the `placement` option.<br />
  36477. * Valid placements are:
  36478. * - `auto`
  36479. * - `top`
  36480. * - `right`
  36481. * - `bottom`
  36482. * - `left`
  36483. *
  36484. * Each placement can have a variation from this list:
  36485. * - `-start`
  36486. * - `-end`
  36487. *
  36488. * Variations are interpreted easily if you think of them as the left to right
  36489. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36490. * is right.<br />
  36491. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36492. *
  36493. * Some valid examples are:
  36494. * - `top-end` (on top of reference, right aligned)
  36495. * - `right-start` (on right of reference, top aligned)
  36496. * - `bottom` (on bottom, centered)
  36497. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36498. *
  36499. * @static
  36500. * @type {Array}
  36501. * @enum {String}
  36502. * @readonly
  36503. * @method placements
  36504. * @memberof Popper
  36505. */
  36506. 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'];
  36507. // Get rid of `auto` `auto-start` and `auto-end`
  36508. var validPlacements = placements.slice(3);
  36509. /**
  36510. * Given an initial placement, returns all the subsequent placements
  36511. * clockwise (or counter-clockwise).
  36512. *
  36513. * @method
  36514. * @memberof Popper.Utils
  36515. * @argument {String} placement - A valid placement (it accepts variations)
  36516. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36517. * @returns {Array} placements including their variations
  36518. */
  36519. function clockwise(placement) {
  36520. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36521. var index = validPlacements.indexOf(placement);
  36522. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36523. return counter ? arr.reverse() : arr;
  36524. }
  36525. var BEHAVIORS = {
  36526. FLIP: 'flip',
  36527. CLOCKWISE: 'clockwise',
  36528. COUNTERCLOCKWISE: 'counterclockwise'
  36529. };
  36530. /**
  36531. * @function
  36532. * @memberof Modifiers
  36533. * @argument {Object} data - The data object generated by update method
  36534. * @argument {Object} options - Modifiers configuration and options
  36535. * @returns {Object} The data object, properly modified
  36536. */
  36537. function flip(data, options) {
  36538. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36539. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36540. return data;
  36541. }
  36542. if (data.flipped && data.placement === data.originalPlacement) {
  36543. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36544. return data;
  36545. }
  36546. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36547. var placement = data.placement.split('-')[0];
  36548. var placementOpposite = getOppositePlacement(placement);
  36549. var variation = data.placement.split('-')[1] || '';
  36550. var flipOrder = [];
  36551. switch (options.behavior) {
  36552. case BEHAVIORS.FLIP:
  36553. flipOrder = [placement, placementOpposite];
  36554. break;
  36555. case BEHAVIORS.CLOCKWISE:
  36556. flipOrder = clockwise(placement);
  36557. break;
  36558. case BEHAVIORS.COUNTERCLOCKWISE:
  36559. flipOrder = clockwise(placement, true);
  36560. break;
  36561. default:
  36562. flipOrder = options.behavior;
  36563. }
  36564. flipOrder.forEach(function (step, index) {
  36565. if (placement !== step || flipOrder.length === index + 1) {
  36566. return data;
  36567. }
  36568. placement = data.placement.split('-')[0];
  36569. placementOpposite = getOppositePlacement(placement);
  36570. var popperOffsets = data.offsets.popper;
  36571. var refOffsets = data.offsets.reference;
  36572. // using floor because the reference offsets may contain decimals we are not going to consider here
  36573. var floor = Math.floor;
  36574. 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);
  36575. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36576. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36577. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36578. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36579. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36580. // flip the variation if required
  36581. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36582. // flips variation if reference element overflows boundaries
  36583. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36584. // flips variation if popper content overflows boundaries
  36585. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36586. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36587. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36588. // this boolean to detect any flip loop
  36589. data.flipped = true;
  36590. if (overlapsRef || overflowsBoundaries) {
  36591. placement = flipOrder[index + 1];
  36592. }
  36593. if (flippedVariation) {
  36594. variation = getOppositeVariation(variation);
  36595. }
  36596. data.placement = placement + (variation ? '-' + variation : '');
  36597. // this object contains `position`, we want to preserve it along with
  36598. // any additional property we may add in the future
  36599. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36600. data = runModifiers(data.instance.modifiers, data, 'flip');
  36601. }
  36602. });
  36603. return data;
  36604. }
  36605. /**
  36606. * @function
  36607. * @memberof Modifiers
  36608. * @argument {Object} data - The data object generated by update method
  36609. * @argument {Object} options - Modifiers configuration and options
  36610. * @returns {Object} The data object, properly modified
  36611. */
  36612. function keepTogether(data) {
  36613. var _data$offsets = data.offsets,
  36614. popper = _data$offsets.popper,
  36615. reference = _data$offsets.reference;
  36616. var placement = data.placement.split('-')[0];
  36617. var floor = Math.floor;
  36618. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36619. var side = isVertical ? 'right' : 'bottom';
  36620. var opSide = isVertical ? 'left' : 'top';
  36621. var measurement = isVertical ? 'width' : 'height';
  36622. if (popper[side] < floor(reference[opSide])) {
  36623. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36624. }
  36625. if (popper[opSide] > floor(reference[side])) {
  36626. data.offsets.popper[opSide] = floor(reference[side]);
  36627. }
  36628. return data;
  36629. }
  36630. /**
  36631. * Converts a string containing value + unit into a px value number
  36632. * @function
  36633. * @memberof {modifiers~offset}
  36634. * @private
  36635. * @argument {String} str - Value + unit string
  36636. * @argument {String} measurement - `height` or `width`
  36637. * @argument {Object} popperOffsets
  36638. * @argument {Object} referenceOffsets
  36639. * @returns {Number|String}
  36640. * Value in pixels, or original string if no values were extracted
  36641. */
  36642. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36643. // separate value from unit
  36644. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36645. var value = +split[1];
  36646. var unit = split[2];
  36647. // If it's not a number it's an operator, I guess
  36648. if (!value) {
  36649. return str;
  36650. }
  36651. if (unit.indexOf('%') === 0) {
  36652. var element = void 0;
  36653. switch (unit) {
  36654. case '%p':
  36655. element = popperOffsets;
  36656. break;
  36657. case '%':
  36658. case '%r':
  36659. default:
  36660. element = referenceOffsets;
  36661. }
  36662. var rect = getClientRect(element);
  36663. return rect[measurement] / 100 * value;
  36664. } else if (unit === 'vh' || unit === 'vw') {
  36665. // if is a vh or vw, we calculate the size based on the viewport
  36666. var size = void 0;
  36667. if (unit === 'vh') {
  36668. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36669. } else {
  36670. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36671. }
  36672. return size / 100 * value;
  36673. } else {
  36674. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36675. // if is an implicit unit, it's px, and we return just the value
  36676. return value;
  36677. }
  36678. }
  36679. /**
  36680. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36681. * @function
  36682. * @memberof {modifiers~offset}
  36683. * @private
  36684. * @argument {String} offset
  36685. * @argument {Object} popperOffsets
  36686. * @argument {Object} referenceOffsets
  36687. * @argument {String} basePlacement
  36688. * @returns {Array} a two cells array with x and y offsets in numbers
  36689. */
  36690. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36691. var offsets = [0, 0];
  36692. // Use height if placement is left or right and index is 0 otherwise use width
  36693. // in this way the first offset will use an axis and the second one
  36694. // will use the other one
  36695. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36696. // Split the offset string to obtain a list of values and operands
  36697. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36698. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36699. return frag.trim();
  36700. });
  36701. // Detect if the offset string contains a pair of values or a single one
  36702. // they could be separated by comma or space
  36703. var divider = fragments.indexOf(find(fragments, function (frag) {
  36704. return frag.search(/,|\s/) !== -1;
  36705. }));
  36706. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36707. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36708. }
  36709. // If divider is found, we divide the list of values and operands to divide
  36710. // them by ofset X and Y.
  36711. var splitRegex = /\s*,\s*|\s+/;
  36712. 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];
  36713. // Convert the values with units to absolute pixels to allow our computations
  36714. ops = ops.map(function (op, index) {
  36715. // Most of the units rely on the orientation of the popper
  36716. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36717. var mergeWithPrevious = false;
  36718. return op
  36719. // This aggregates any `+` or `-` sign that aren't considered operators
  36720. // e.g.: 10 + +5 => [10, +, +5]
  36721. .reduce(function (a, b) {
  36722. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36723. a[a.length - 1] = b;
  36724. mergeWithPrevious = true;
  36725. return a;
  36726. } else if (mergeWithPrevious) {
  36727. a[a.length - 1] += b;
  36728. mergeWithPrevious = false;
  36729. return a;
  36730. } else {
  36731. return a.concat(b);
  36732. }
  36733. }, [])
  36734. // Here we convert the string values into number values (in px)
  36735. .map(function (str) {
  36736. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36737. });
  36738. });
  36739. // Loop trough the offsets arrays and execute the operations
  36740. ops.forEach(function (op, index) {
  36741. op.forEach(function (frag, index2) {
  36742. if (isNumeric(frag)) {
  36743. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36744. }
  36745. });
  36746. });
  36747. return offsets;
  36748. }
  36749. /**
  36750. * @function
  36751. * @memberof Modifiers
  36752. * @argument {Object} data - The data object generated by update method
  36753. * @argument {Object} options - Modifiers configuration and options
  36754. * @argument {Number|String} options.offset=0
  36755. * The offset value as described in the modifier description
  36756. * @returns {Object} The data object, properly modified
  36757. */
  36758. function offset(data, _ref) {
  36759. var offset = _ref.offset;
  36760. var placement = data.placement,
  36761. _data$offsets = data.offsets,
  36762. popper = _data$offsets.popper,
  36763. reference = _data$offsets.reference;
  36764. var basePlacement = placement.split('-')[0];
  36765. var offsets = void 0;
  36766. if (isNumeric(+offset)) {
  36767. offsets = [+offset, 0];
  36768. } else {
  36769. offsets = parseOffset(offset, popper, reference, basePlacement);
  36770. }
  36771. if (basePlacement === 'left') {
  36772. popper.top += offsets[0];
  36773. popper.left -= offsets[1];
  36774. } else if (basePlacement === 'right') {
  36775. popper.top += offsets[0];
  36776. popper.left += offsets[1];
  36777. } else if (basePlacement === 'top') {
  36778. popper.left += offsets[0];
  36779. popper.top -= offsets[1];
  36780. } else if (basePlacement === 'bottom') {
  36781. popper.left += offsets[0];
  36782. popper.top += offsets[1];
  36783. }
  36784. data.popper = popper;
  36785. return data;
  36786. }
  36787. /**
  36788. * @function
  36789. * @memberof Modifiers
  36790. * @argument {Object} data - The data object generated by `update` method
  36791. * @argument {Object} options - Modifiers configuration and options
  36792. * @returns {Object} The data object, properly modified
  36793. */
  36794. function preventOverflow(data, options) {
  36795. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36796. // If offsetParent is the reference element, we really want to
  36797. // go one step up and use the next offsetParent as reference to
  36798. // avoid to make this modifier completely useless and look like broken
  36799. if (data.instance.reference === boundariesElement) {
  36800. boundariesElement = getOffsetParent(boundariesElement);
  36801. }
  36802. // NOTE: DOM access here
  36803. // resets the popper's position so that the document size can be calculated excluding
  36804. // the size of the popper element itself
  36805. var transformProp = getSupportedPropertyName('transform');
  36806. var popperStyles = data.instance.popper.style; // assignment to help minification
  36807. var top = popperStyles.top,
  36808. left = popperStyles.left,
  36809. transform = popperStyles[transformProp];
  36810. popperStyles.top = '';
  36811. popperStyles.left = '';
  36812. popperStyles[transformProp] = '';
  36813. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36814. // NOTE: DOM access here
  36815. // restores the original style properties after the offsets have been computed
  36816. popperStyles.top = top;
  36817. popperStyles.left = left;
  36818. popperStyles[transformProp] = transform;
  36819. options.boundaries = boundaries;
  36820. var order = options.priority;
  36821. var popper = data.offsets.popper;
  36822. var check = {
  36823. primary: function primary(placement) {
  36824. var value = popper[placement];
  36825. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36826. value = Math.max(popper[placement], boundaries[placement]);
  36827. }
  36828. return defineProperty({}, placement, value);
  36829. },
  36830. secondary: function secondary(placement) {
  36831. var mainSide = placement === 'right' ? 'left' : 'top';
  36832. var value = popper[mainSide];
  36833. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36834. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36835. }
  36836. return defineProperty({}, mainSide, value);
  36837. }
  36838. };
  36839. order.forEach(function (placement) {
  36840. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36841. popper = _extends({}, popper, check[side](placement));
  36842. });
  36843. data.offsets.popper = popper;
  36844. return data;
  36845. }
  36846. /**
  36847. * @function
  36848. * @memberof Modifiers
  36849. * @argument {Object} data - The data object generated by `update` method
  36850. * @argument {Object} options - Modifiers configuration and options
  36851. * @returns {Object} The data object, properly modified
  36852. */
  36853. function shift(data) {
  36854. var placement = data.placement;
  36855. var basePlacement = placement.split('-')[0];
  36856. var shiftvariation = placement.split('-')[1];
  36857. // if shift shiftvariation is specified, run the modifier
  36858. if (shiftvariation) {
  36859. var _data$offsets = data.offsets,
  36860. reference = _data$offsets.reference,
  36861. popper = _data$offsets.popper;
  36862. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36863. var side = isVertical ? 'left' : 'top';
  36864. var measurement = isVertical ? 'width' : 'height';
  36865. var shiftOffsets = {
  36866. start: defineProperty({}, side, reference[side]),
  36867. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36868. };
  36869. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36870. }
  36871. return data;
  36872. }
  36873. /**
  36874. * @function
  36875. * @memberof Modifiers
  36876. * @argument {Object} data - The data object generated by update method
  36877. * @argument {Object} options - Modifiers configuration and options
  36878. * @returns {Object} The data object, properly modified
  36879. */
  36880. function hide(data) {
  36881. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36882. return data;
  36883. }
  36884. var refRect = data.offsets.reference;
  36885. var bound = find(data.instance.modifiers, function (modifier) {
  36886. return modifier.name === 'preventOverflow';
  36887. }).boundaries;
  36888. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36889. // Avoid unnecessary DOM access if visibility hasn't changed
  36890. if (data.hide === true) {
  36891. return data;
  36892. }
  36893. data.hide = true;
  36894. data.attributes['x-out-of-boundaries'] = '';
  36895. } else {
  36896. // Avoid unnecessary DOM access if visibility hasn't changed
  36897. if (data.hide === false) {
  36898. return data;
  36899. }
  36900. data.hide = false;
  36901. data.attributes['x-out-of-boundaries'] = false;
  36902. }
  36903. return data;
  36904. }
  36905. /**
  36906. * @function
  36907. * @memberof Modifiers
  36908. * @argument {Object} data - The data object generated by `update` method
  36909. * @argument {Object} options - Modifiers configuration and options
  36910. * @returns {Object} The data object, properly modified
  36911. */
  36912. function inner(data) {
  36913. var placement = data.placement;
  36914. var basePlacement = placement.split('-')[0];
  36915. var _data$offsets = data.offsets,
  36916. popper = _data$offsets.popper,
  36917. reference = _data$offsets.reference;
  36918. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36919. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36920. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36921. data.placement = getOppositePlacement(placement);
  36922. data.offsets.popper = getClientRect(popper);
  36923. return data;
  36924. }
  36925. /**
  36926. * Modifier function, each modifier can have a function of this type assigned
  36927. * to its `fn` property.<br />
  36928. * These functions will be called on each update, this means that you must
  36929. * make sure they are performant enough to avoid performance bottlenecks.
  36930. *
  36931. * @function ModifierFn
  36932. * @argument {dataObject} data - The data object generated by `update` method
  36933. * @argument {Object} options - Modifiers configuration and options
  36934. * @returns {dataObject} The data object, properly modified
  36935. */
  36936. /**
  36937. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36938. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36939. * needed by the library.
  36940. *
  36941. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36942. * All the other properties are configurations that could be tweaked.
  36943. * @namespace modifiers
  36944. */
  36945. var modifiers = {
  36946. /**
  36947. * Modifier used to shift the popper on the start or end of its reference
  36948. * element.<br />
  36949. * It will read the variation of the `placement` property.<br />
  36950. * It can be one either `-end` or `-start`.
  36951. * @memberof modifiers
  36952. * @inner
  36953. */
  36954. shift: {
  36955. /** @prop {number} order=100 - Index used to define the order of execution */
  36956. order: 100,
  36957. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36958. enabled: true,
  36959. /** @prop {ModifierFn} */
  36960. fn: shift
  36961. },
  36962. /**
  36963. * The `offset` modifier can shift your popper on both its axis.
  36964. *
  36965. * It accepts the following units:
  36966. * - `px` or unit-less, interpreted as pixels
  36967. * - `%` or `%r`, percentage relative to the length of the reference element
  36968. * - `%p`, percentage relative to the length of the popper element
  36969. * - `vw`, CSS viewport width unit
  36970. * - `vh`, CSS viewport height unit
  36971. *
  36972. * For length is intended the main axis relative to the placement of the popper.<br />
  36973. * This means that if the placement is `top` or `bottom`, the length will be the
  36974. * `width`. In case of `left` or `right`, it will be the `height`.
  36975. *
  36976. * You can provide a single value (as `Number` or `String`), or a pair of values
  36977. * as `String` divided by a comma or one (or more) white spaces.<br />
  36978. * The latter is a deprecated method because it leads to confusion and will be
  36979. * removed in v2.<br />
  36980. * Additionally, it accepts additions and subtractions between different units.
  36981. * Note that multiplications and divisions aren't supported.
  36982. *
  36983. * Valid examples are:
  36984. * ```
  36985. * 10
  36986. * '10%'
  36987. * '10, 10'
  36988. * '10%, 10'
  36989. * '10 + 10%'
  36990. * '10 - 5vh + 3%'
  36991. * '-10px + 5vh, 5px - 6%'
  36992. * ```
  36993. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36994. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36995. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36996. *
  36997. * @memberof modifiers
  36998. * @inner
  36999. */
  37000. offset: {
  37001. /** @prop {number} order=200 - Index used to define the order of execution */
  37002. order: 200,
  37003. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37004. enabled: true,
  37005. /** @prop {ModifierFn} */
  37006. fn: offset,
  37007. /** @prop {Number|String} offset=0
  37008. * The offset value as described in the modifier description
  37009. */
  37010. offset: 0
  37011. },
  37012. /**
  37013. * Modifier used to prevent the popper from being positioned outside the boundary.
  37014. *
  37015. * A scenario exists where the reference itself is not within the boundaries.<br />
  37016. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37017. * In this case we need to decide whether the popper should either:
  37018. *
  37019. * - detach from the reference and remain "trapped" in the boundaries, or
  37020. * - if it should ignore the boundary and "escape with its reference"
  37021. *
  37022. * When `escapeWithReference` is set to`true` and reference is completely
  37023. * outside its boundaries, the popper will overflow (or completely leave)
  37024. * the boundaries in order to remain attached to the edge of the reference.
  37025. *
  37026. * @memberof modifiers
  37027. * @inner
  37028. */
  37029. preventOverflow: {
  37030. /** @prop {number} order=300 - Index used to define the order of execution */
  37031. order: 300,
  37032. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37033. enabled: true,
  37034. /** @prop {ModifierFn} */
  37035. fn: preventOverflow,
  37036. /**
  37037. * @prop {Array} [priority=['left','right','top','bottom']]
  37038. * Popper will try to prevent overflow following these priorities by default,
  37039. * then, it could overflow on the left and on top of the `boundariesElement`
  37040. */
  37041. priority: ['left', 'right', 'top', 'bottom'],
  37042. /**
  37043. * @prop {number} padding=5
  37044. * Amount of pixel used to define a minimum distance between the boundaries
  37045. * and the popper. This makes sure the popper always has a little padding
  37046. * between the edges of its container
  37047. */
  37048. padding: 5,
  37049. /**
  37050. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37051. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37052. * `viewport` or any DOM element.
  37053. */
  37054. boundariesElement: 'scrollParent'
  37055. },
  37056. /**
  37057. * Modifier used to make sure the reference and its popper stay near each other
  37058. * without leaving any gap between the two. Especially useful when the arrow is
  37059. * enabled and you want to ensure that it points to its reference element.
  37060. * It cares only about the first axis. You can still have poppers with margin
  37061. * between the popper and its reference element.
  37062. * @memberof modifiers
  37063. * @inner
  37064. */
  37065. keepTogether: {
  37066. /** @prop {number} order=400 - Index used to define the order of execution */
  37067. order: 400,
  37068. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37069. enabled: true,
  37070. /** @prop {ModifierFn} */
  37071. fn: keepTogether
  37072. },
  37073. /**
  37074. * This modifier is used to move the `arrowElement` of the popper to make
  37075. * sure it is positioned between the reference element and its popper element.
  37076. * It will read the outer size of the `arrowElement` node to detect how many
  37077. * pixels of conjunction are needed.
  37078. *
  37079. * It has no effect if no `arrowElement` is provided.
  37080. * @memberof modifiers
  37081. * @inner
  37082. */
  37083. arrow: {
  37084. /** @prop {number} order=500 - Index used to define the order of execution */
  37085. order: 500,
  37086. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37087. enabled: true,
  37088. /** @prop {ModifierFn} */
  37089. fn: arrow,
  37090. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37091. element: '[x-arrow]'
  37092. },
  37093. /**
  37094. * Modifier used to flip the popper's placement when it starts to overlap its
  37095. * reference element.
  37096. *
  37097. * Requires the `preventOverflow` modifier before it in order to work.
  37098. *
  37099. * **NOTE:** this modifier will interrupt the current update cycle and will
  37100. * restart it if it detects the need to flip the placement.
  37101. * @memberof modifiers
  37102. * @inner
  37103. */
  37104. flip: {
  37105. /** @prop {number} order=600 - Index used to define the order of execution */
  37106. order: 600,
  37107. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37108. enabled: true,
  37109. /** @prop {ModifierFn} */
  37110. fn: flip,
  37111. /**
  37112. * @prop {String|Array} behavior='flip'
  37113. * The behavior used to change the popper's placement. It can be one of
  37114. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37115. * placements (with optional variations)
  37116. */
  37117. behavior: 'flip',
  37118. /**
  37119. * @prop {number} padding=5
  37120. * The popper will flip if it hits the edges of the `boundariesElement`
  37121. */
  37122. padding: 5,
  37123. /**
  37124. * @prop {String|HTMLElement} boundariesElement='viewport'
  37125. * The element which will define the boundaries of the popper position.
  37126. * The popper will never be placed outside of the defined boundaries
  37127. * (except if `keepTogether` is enabled)
  37128. */
  37129. boundariesElement: 'viewport',
  37130. /**
  37131. * @prop {Boolean} flipVariations=false
  37132. * The popper will switch placement variation between `-start` and `-end` when
  37133. * the reference element overlaps its boundaries.
  37134. *
  37135. * The original placement should have a set variation.
  37136. */
  37137. flipVariations: false,
  37138. /**
  37139. * @prop {Boolean} flipVariationsByContent=false
  37140. * The popper will switch placement variation between `-start` and `-end` when
  37141. * the popper element overlaps its reference boundaries.
  37142. *
  37143. * The original placement should have a set variation.
  37144. */
  37145. flipVariationsByContent: false
  37146. },
  37147. /**
  37148. * Modifier used to make the popper flow toward the inner of the reference element.
  37149. * By default, when this modifier is disabled, the popper will be placed outside
  37150. * the reference element.
  37151. * @memberof modifiers
  37152. * @inner
  37153. */
  37154. inner: {
  37155. /** @prop {number} order=700 - Index used to define the order of execution */
  37156. order: 700,
  37157. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37158. enabled: false,
  37159. /** @prop {ModifierFn} */
  37160. fn: inner
  37161. },
  37162. /**
  37163. * Modifier used to hide the popper when its reference element is outside of the
  37164. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37165. * be used to hide with a CSS selector the popper when its reference is
  37166. * out of boundaries.
  37167. *
  37168. * Requires the `preventOverflow` modifier before it in order to work.
  37169. * @memberof modifiers
  37170. * @inner
  37171. */
  37172. hide: {
  37173. /** @prop {number} order=800 - Index used to define the order of execution */
  37174. order: 800,
  37175. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37176. enabled: true,
  37177. /** @prop {ModifierFn} */
  37178. fn: hide
  37179. },
  37180. /**
  37181. * Computes the style that will be applied to the popper element to gets
  37182. * properly positioned.
  37183. *
  37184. * Note that this modifier will not touch the DOM, it just prepares the styles
  37185. * so that `applyStyle` modifier can apply it. This separation is useful
  37186. * in case you need to replace `applyStyle` with a custom implementation.
  37187. *
  37188. * This modifier has `850` as `order` value to maintain backward compatibility
  37189. * with previous versions of Popper.js. Expect the modifiers ordering method
  37190. * to change in future major versions of the library.
  37191. *
  37192. * @memberof modifiers
  37193. * @inner
  37194. */
  37195. computeStyle: {
  37196. /** @prop {number} order=850 - Index used to define the order of execution */
  37197. order: 850,
  37198. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37199. enabled: true,
  37200. /** @prop {ModifierFn} */
  37201. fn: computeStyle,
  37202. /**
  37203. * @prop {Boolean} gpuAcceleration=true
  37204. * If true, it uses the CSS 3D transformation to position the popper.
  37205. * Otherwise, it will use the `top` and `left` properties
  37206. */
  37207. gpuAcceleration: true,
  37208. /**
  37209. * @prop {string} [x='bottom']
  37210. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37211. * Change this if your popper should grow in a direction different from `bottom`
  37212. */
  37213. x: 'bottom',
  37214. /**
  37215. * @prop {string} [x='left']
  37216. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37217. * Change this if your popper should grow in a direction different from `right`
  37218. */
  37219. y: 'right'
  37220. },
  37221. /**
  37222. * Applies the computed styles to the popper element.
  37223. *
  37224. * All the DOM manipulations are limited to this modifier. This is useful in case
  37225. * you want to integrate Popper.js inside a framework or view library and you
  37226. * want to delegate all the DOM manipulations to it.
  37227. *
  37228. * Note that if you disable this modifier, you must make sure the popper element
  37229. * has its position set to `absolute` before Popper.js can do its work!
  37230. *
  37231. * Just disable this modifier and define your own to achieve the desired effect.
  37232. *
  37233. * @memberof modifiers
  37234. * @inner
  37235. */
  37236. applyStyle: {
  37237. /** @prop {number} order=900 - Index used to define the order of execution */
  37238. order: 900,
  37239. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37240. enabled: true,
  37241. /** @prop {ModifierFn} */
  37242. fn: applyStyle,
  37243. /** @prop {Function} */
  37244. onLoad: applyStyleOnLoad,
  37245. /**
  37246. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37247. * @prop {Boolean} gpuAcceleration=true
  37248. * If true, it uses the CSS 3D transformation to position the popper.
  37249. * Otherwise, it will use the `top` and `left` properties
  37250. */
  37251. gpuAcceleration: undefined
  37252. }
  37253. };
  37254. /**
  37255. * The `dataObject` is an object containing all the information used by Popper.js.
  37256. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37257. * @name dataObject
  37258. * @property {Object} data.instance The Popper.js instance
  37259. * @property {String} data.placement Placement applied to popper
  37260. * @property {String} data.originalPlacement Placement originally defined on init
  37261. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37262. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37263. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37264. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37265. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37266. * @property {Object} data.boundaries Offsets of the popper boundaries
  37267. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37268. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37269. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37270. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37271. */
  37272. /**
  37273. * Default options provided to Popper.js constructor.<br />
  37274. * These can be overridden using the `options` argument of Popper.js.<br />
  37275. * To override an option, simply pass an object with the same
  37276. * structure of the `options` object, as the 3rd argument. For example:
  37277. * ```
  37278. * new Popper(ref, pop, {
  37279. * modifiers: {
  37280. * preventOverflow: { enabled: false }
  37281. * }
  37282. * })
  37283. * ```
  37284. * @type {Object}
  37285. * @static
  37286. * @memberof Popper
  37287. */
  37288. var Defaults = {
  37289. /**
  37290. * Popper's placement.
  37291. * @prop {Popper.placements} placement='bottom'
  37292. */
  37293. placement: 'bottom',
  37294. /**
  37295. * Set this to true if you want popper to position it self in 'fixed' mode
  37296. * @prop {Boolean} positionFixed=false
  37297. */
  37298. positionFixed: false,
  37299. /**
  37300. * Whether events (resize, scroll) are initially enabled.
  37301. * @prop {Boolean} eventsEnabled=true
  37302. */
  37303. eventsEnabled: true,
  37304. /**
  37305. * Set to true if you want to automatically remove the popper when
  37306. * you call the `destroy` method.
  37307. * @prop {Boolean} removeOnDestroy=false
  37308. */
  37309. removeOnDestroy: false,
  37310. /**
  37311. * Callback called when the popper is created.<br />
  37312. * By default, it is set to no-op.<br />
  37313. * Access Popper.js instance with `data.instance`.
  37314. * @prop {onCreate}
  37315. */
  37316. onCreate: function onCreate() {},
  37317. /**
  37318. * Callback called when the popper is updated. This callback is not called
  37319. * on the initialization/creation of the popper, but only on subsequent
  37320. * updates.<br />
  37321. * By default, it is set to no-op.<br />
  37322. * Access Popper.js instance with `data.instance`.
  37323. * @prop {onUpdate}
  37324. */
  37325. onUpdate: function onUpdate() {},
  37326. /**
  37327. * List of modifiers used to modify the offsets before they are applied to the popper.
  37328. * They provide most of the functionalities of Popper.js.
  37329. * @prop {modifiers}
  37330. */
  37331. modifiers: modifiers
  37332. };
  37333. /**
  37334. * @callback onCreate
  37335. * @param {dataObject} data
  37336. */
  37337. /**
  37338. * @callback onUpdate
  37339. * @param {dataObject} data
  37340. */
  37341. // Utils
  37342. // Methods
  37343. var Popper = function () {
  37344. /**
  37345. * Creates a new Popper.js instance.
  37346. * @class Popper
  37347. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37348. * @param {Element} popper - The HTML / XML element used as the popper
  37349. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37350. * @return {Object} instance - The generated Popper.js instance
  37351. */
  37352. function Popper(reference, popper) {
  37353. var _this = this;
  37354. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37355. classCallCheck(this, Popper);
  37356. this.scheduleUpdate = function () {
  37357. return requestAnimationFrame(_this.update);
  37358. };
  37359. // make update() debounced, so that it only runs at most once-per-tick
  37360. this.update = debounce(this.update.bind(this));
  37361. // with {} we create a new object with the options inside it
  37362. this.options = _extends({}, Popper.Defaults, options);
  37363. // init state
  37364. this.state = {
  37365. isDestroyed: false,
  37366. isCreated: false,
  37367. scrollParents: []
  37368. };
  37369. // get reference and popper elements (allow jQuery wrappers)
  37370. this.reference = reference && reference.jquery ? reference[0] : reference;
  37371. this.popper = popper && popper.jquery ? popper[0] : popper;
  37372. // Deep merge modifiers options
  37373. this.options.modifiers = {};
  37374. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37375. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37376. });
  37377. // Refactoring modifiers' list (Object => Array)
  37378. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37379. return _extends({
  37380. name: name
  37381. }, _this.options.modifiers[name]);
  37382. })
  37383. // sort the modifiers by order
  37384. .sort(function (a, b) {
  37385. return a.order - b.order;
  37386. });
  37387. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37388. // such code is executed in the same order of its modifier
  37389. // they could add new properties to their options configuration
  37390. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37391. this.modifiers.forEach(function (modifierOptions) {
  37392. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37393. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37394. }
  37395. });
  37396. // fire the first update to position the popper in the right place
  37397. this.update();
  37398. var eventsEnabled = this.options.eventsEnabled;
  37399. if (eventsEnabled) {
  37400. // setup event listeners, they will take care of update the position in specific situations
  37401. this.enableEventListeners();
  37402. }
  37403. this.state.eventsEnabled = eventsEnabled;
  37404. }
  37405. // We can't use class properties because they don't get listed in the
  37406. // class prototype and break stuff like Sinon stubs
  37407. createClass(Popper, [{
  37408. key: 'update',
  37409. value: function update$$1() {
  37410. return update.call(this);
  37411. }
  37412. }, {
  37413. key: 'destroy',
  37414. value: function destroy$$1() {
  37415. return destroy.call(this);
  37416. }
  37417. }, {
  37418. key: 'enableEventListeners',
  37419. value: function enableEventListeners$$1() {
  37420. return enableEventListeners.call(this);
  37421. }
  37422. }, {
  37423. key: 'disableEventListeners',
  37424. value: function disableEventListeners$$1() {
  37425. return disableEventListeners.call(this);
  37426. }
  37427. /**
  37428. * Schedules an update. It will run on the next UI update available.
  37429. * @method scheduleUpdate
  37430. * @memberof Popper
  37431. */
  37432. /**
  37433. * Collection of utilities useful when writing custom modifiers.
  37434. * Starting from version 1.7, this method is available only if you
  37435. * include `popper-utils.js` before `popper.js`.
  37436. *
  37437. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37438. * and will be removed in v2! Use the PopperUtils module directly instead.
  37439. * Due to the high instability of the methods contained in Utils, we can't
  37440. * guarantee them to follow semver. Use them at your own risk!
  37441. * @static
  37442. * @private
  37443. * @type {Object}
  37444. * @deprecated since version 1.8
  37445. * @member Utils
  37446. * @memberof Popper
  37447. */
  37448. }]);
  37449. return Popper;
  37450. }();
  37451. /**
  37452. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37453. * and lets you use it as replacement of a real DOM node.<br />
  37454. * You can use this method to position a popper relatively to a set of coordinates
  37455. * in case you don't have a DOM node to use as reference.
  37456. *
  37457. * ```
  37458. * new Popper(referenceObject, popperNode);
  37459. * ```
  37460. *
  37461. * NB: This feature isn't supported in Internet Explorer 10.
  37462. * @name referenceObject
  37463. * @property {Function} data.getBoundingClientRect
  37464. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37465. * @property {number} data.clientWidth
  37466. * An ES6 getter that will return the width of the virtual reference element.
  37467. * @property {number} data.clientHeight
  37468. * An ES6 getter that will return the height of the virtual reference element.
  37469. */
  37470. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37471. Popper.placements = placements;
  37472. Popper.Defaults = Defaults;
  37473. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37474. //# sourceMappingURL=popper.js.map
  37475. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37476. /***/ }),
  37477. /***/ "./node_modules/process/browser.js":
  37478. /*!*****************************************!*\
  37479. !*** ./node_modules/process/browser.js ***!
  37480. \*****************************************/
  37481. /*! no static exports found */
  37482. /***/ (function(module, exports) {
  37483. // shim for using process in browser
  37484. var process = module.exports = {};
  37485. // cached from whatever global is present so that test runners that stub it
  37486. // don't break things. But we need to wrap it in a try catch in case it is
  37487. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37488. // function because try/catches deoptimize in certain engines.
  37489. var cachedSetTimeout;
  37490. var cachedClearTimeout;
  37491. function defaultSetTimout() {
  37492. throw new Error('setTimeout has not been defined');
  37493. }
  37494. function defaultClearTimeout () {
  37495. throw new Error('clearTimeout has not been defined');
  37496. }
  37497. (function () {
  37498. try {
  37499. if (typeof setTimeout === 'function') {
  37500. cachedSetTimeout = setTimeout;
  37501. } else {
  37502. cachedSetTimeout = defaultSetTimout;
  37503. }
  37504. } catch (e) {
  37505. cachedSetTimeout = defaultSetTimout;
  37506. }
  37507. try {
  37508. if (typeof clearTimeout === 'function') {
  37509. cachedClearTimeout = clearTimeout;
  37510. } else {
  37511. cachedClearTimeout = defaultClearTimeout;
  37512. }
  37513. } catch (e) {
  37514. cachedClearTimeout = defaultClearTimeout;
  37515. }
  37516. } ())
  37517. function runTimeout(fun) {
  37518. if (cachedSetTimeout === setTimeout) {
  37519. //normal enviroments in sane situations
  37520. return setTimeout(fun, 0);
  37521. }
  37522. // if setTimeout wasn't available but was latter defined
  37523. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37524. cachedSetTimeout = setTimeout;
  37525. return setTimeout(fun, 0);
  37526. }
  37527. try {
  37528. // when when somebody has screwed with setTimeout but no I.E. maddness
  37529. return cachedSetTimeout(fun, 0);
  37530. } catch(e){
  37531. try {
  37532. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37533. return cachedSetTimeout.call(null, fun, 0);
  37534. } catch(e){
  37535. // 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
  37536. return cachedSetTimeout.call(this, fun, 0);
  37537. }
  37538. }
  37539. }
  37540. function runClearTimeout(marker) {
  37541. if (cachedClearTimeout === clearTimeout) {
  37542. //normal enviroments in sane situations
  37543. return clearTimeout(marker);
  37544. }
  37545. // if clearTimeout wasn't available but was latter defined
  37546. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37547. cachedClearTimeout = clearTimeout;
  37548. return clearTimeout(marker);
  37549. }
  37550. try {
  37551. // when when somebody has screwed with setTimeout but no I.E. maddness
  37552. return cachedClearTimeout(marker);
  37553. } catch (e){
  37554. try {
  37555. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37556. return cachedClearTimeout.call(null, marker);
  37557. } catch (e){
  37558. // 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.
  37559. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37560. return cachedClearTimeout.call(this, marker);
  37561. }
  37562. }
  37563. }
  37564. var queue = [];
  37565. var draining = false;
  37566. var currentQueue;
  37567. var queueIndex = -1;
  37568. function cleanUpNextTick() {
  37569. if (!draining || !currentQueue) {
  37570. return;
  37571. }
  37572. draining = false;
  37573. if (currentQueue.length) {
  37574. queue = currentQueue.concat(queue);
  37575. } else {
  37576. queueIndex = -1;
  37577. }
  37578. if (queue.length) {
  37579. drainQueue();
  37580. }
  37581. }
  37582. function drainQueue() {
  37583. if (draining) {
  37584. return;
  37585. }
  37586. var timeout = runTimeout(cleanUpNextTick);
  37587. draining = true;
  37588. var len = queue.length;
  37589. while(len) {
  37590. currentQueue = queue;
  37591. queue = [];
  37592. while (++queueIndex < len) {
  37593. if (currentQueue) {
  37594. currentQueue[queueIndex].run();
  37595. }
  37596. }
  37597. queueIndex = -1;
  37598. len = queue.length;
  37599. }
  37600. currentQueue = null;
  37601. draining = false;
  37602. runClearTimeout(timeout);
  37603. }
  37604. process.nextTick = function (fun) {
  37605. var args = new Array(arguments.length - 1);
  37606. if (arguments.length > 1) {
  37607. for (var i = 1; i < arguments.length; i++) {
  37608. args[i - 1] = arguments[i];
  37609. }
  37610. }
  37611. queue.push(new Item(fun, args));
  37612. if (queue.length === 1 && !draining) {
  37613. runTimeout(drainQueue);
  37614. }
  37615. };
  37616. // v8 likes predictible objects
  37617. function Item(fun, array) {
  37618. this.fun = fun;
  37619. this.array = array;
  37620. }
  37621. Item.prototype.run = function () {
  37622. this.fun.apply(null, this.array);
  37623. };
  37624. process.title = 'browser';
  37625. process.browser = true;
  37626. process.env = {};
  37627. process.argv = [];
  37628. process.version = ''; // empty string to avoid regexp issues
  37629. process.versions = {};
  37630. function noop() {}
  37631. process.on = noop;
  37632. process.addListener = noop;
  37633. process.once = noop;
  37634. process.off = noop;
  37635. process.removeListener = noop;
  37636. process.removeAllListeners = noop;
  37637. process.emit = noop;
  37638. process.prependListener = noop;
  37639. process.prependOnceListener = noop;
  37640. process.listeners = function (name) { return [] }
  37641. process.binding = function (name) {
  37642. throw new Error('process.binding is not supported');
  37643. };
  37644. process.cwd = function () { return '/' };
  37645. process.chdir = function (dir) {
  37646. throw new Error('process.chdir is not supported');
  37647. };
  37648. process.umask = function() { return 0; };
  37649. /***/ }),
  37650. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37651. /*!***************************************************!*\
  37652. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37653. \***************************************************/
  37654. /*! no static exports found */
  37655. /***/ (function(module, exports, __webpack_require__) {
  37656. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37657. * Pusher JavaScript Library v5.0.3
  37658. * https://pusher.com/
  37659. *
  37660. * Copyright 2017, Pusher
  37661. * Released under the MIT licence.
  37662. */
  37663. (function webpackUniversalModuleDefinition(root, factory) {
  37664. if(true)
  37665. module.exports = factory();
  37666. else {}
  37667. })(window, function() {
  37668. return /******/ (function(modules) { // webpackBootstrap
  37669. /******/ // The module cache
  37670. /******/ var installedModules = {};
  37671. /******/
  37672. /******/ // The require function
  37673. /******/ function __webpack_require__(moduleId) {
  37674. /******/
  37675. /******/ // Check if module is in cache
  37676. /******/ if(installedModules[moduleId]) {
  37677. /******/ return installedModules[moduleId].exports;
  37678. /******/ }
  37679. /******/ // Create a new module (and put it into the cache)
  37680. /******/ var module = installedModules[moduleId] = {
  37681. /******/ i: moduleId,
  37682. /******/ l: false,
  37683. /******/ exports: {}
  37684. /******/ };
  37685. /******/
  37686. /******/ // Execute the module function
  37687. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37688. /******/
  37689. /******/ // Flag the module as loaded
  37690. /******/ module.l = true;
  37691. /******/
  37692. /******/ // Return the exports of the module
  37693. /******/ return module.exports;
  37694. /******/ }
  37695. /******/
  37696. /******/
  37697. /******/ // expose the modules object (__webpack_modules__)
  37698. /******/ __webpack_require__.m = modules;
  37699. /******/
  37700. /******/ // expose the module cache
  37701. /******/ __webpack_require__.c = installedModules;
  37702. /******/
  37703. /******/ // define getter function for harmony exports
  37704. /******/ __webpack_require__.d = function(exports, name, getter) {
  37705. /******/ if(!__webpack_require__.o(exports, name)) {
  37706. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37707. /******/ }
  37708. /******/ };
  37709. /******/
  37710. /******/ // define __esModule on exports
  37711. /******/ __webpack_require__.r = function(exports) {
  37712. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37713. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37714. /******/ }
  37715. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37716. /******/ };
  37717. /******/
  37718. /******/ // create a fake namespace object
  37719. /******/ // mode & 1: value is a module id, require it
  37720. /******/ // mode & 2: merge all properties of value into the ns
  37721. /******/ // mode & 4: return value when already ns object
  37722. /******/ // mode & 8|1: behave like require
  37723. /******/ __webpack_require__.t = function(value, mode) {
  37724. /******/ if(mode & 1) value = __webpack_require__(value);
  37725. /******/ if(mode & 8) return value;
  37726. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37727. /******/ var ns = Object.create(null);
  37728. /******/ __webpack_require__.r(ns);
  37729. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37730. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37731. /******/ return ns;
  37732. /******/ };
  37733. /******/
  37734. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37735. /******/ __webpack_require__.n = function(module) {
  37736. /******/ var getter = module && module.__esModule ?
  37737. /******/ function getDefault() { return module['default']; } :
  37738. /******/ function getModuleExports() { return module; };
  37739. /******/ __webpack_require__.d(getter, 'a', getter);
  37740. /******/ return getter;
  37741. /******/ };
  37742. /******/
  37743. /******/ // Object.prototype.hasOwnProperty.call
  37744. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37745. /******/
  37746. /******/ // __webpack_public_path__
  37747. /******/ __webpack_require__.p = "";
  37748. /******/
  37749. /******/
  37750. /******/ // Load entry module and return exports
  37751. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37752. /******/ })
  37753. /************************************************************************/
  37754. /******/ ([
  37755. /* 0 */
  37756. /***/ (function(module, exports, __webpack_require__) {
  37757. (function(nacl) {
  37758. 'use strict';
  37759. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37760. // Public domain.
  37761. //
  37762. // Implementation derived from TweetNaCl version 20140427.
  37763. // See for details: http://tweetnacl.cr.yp.to/
  37764. var gf = function(init) {
  37765. var i, r = new Float64Array(16);
  37766. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37767. return r;
  37768. };
  37769. // Pluggable, initialized in high-level API below.
  37770. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37771. var _0 = new Uint8Array(16);
  37772. var _9 = new Uint8Array(32); _9[0] = 9;
  37773. var gf0 = gf(),
  37774. gf1 = gf([1]),
  37775. _121665 = gf([0xdb41, 1]),
  37776. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37777. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37778. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37779. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37780. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37781. function ts64(x, i, h, l) {
  37782. x[i] = (h >> 24) & 0xff;
  37783. x[i+1] = (h >> 16) & 0xff;
  37784. x[i+2] = (h >> 8) & 0xff;
  37785. x[i+3] = h & 0xff;
  37786. x[i+4] = (l >> 24) & 0xff;
  37787. x[i+5] = (l >> 16) & 0xff;
  37788. x[i+6] = (l >> 8) & 0xff;
  37789. x[i+7] = l & 0xff;
  37790. }
  37791. function vn(x, xi, y, yi, n) {
  37792. var i,d = 0;
  37793. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37794. return (1 & ((d - 1) >>> 8)) - 1;
  37795. }
  37796. function crypto_verify_16(x, xi, y, yi) {
  37797. return vn(x,xi,y,yi,16);
  37798. }
  37799. function crypto_verify_32(x, xi, y, yi) {
  37800. return vn(x,xi,y,yi,32);
  37801. }
  37802. function core_salsa20(o, p, k, c) {
  37803. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37804. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37805. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37806. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37807. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37808. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37809. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37810. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37811. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37812. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37813. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37814. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37815. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37816. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37817. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37818. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37819. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37820. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37821. x15 = j15, u;
  37822. for (var i = 0; i < 20; i += 2) {
  37823. u = x0 + x12 | 0;
  37824. x4 ^= u<<7 | u>>>(32-7);
  37825. u = x4 + x0 | 0;
  37826. x8 ^= u<<9 | u>>>(32-9);
  37827. u = x8 + x4 | 0;
  37828. x12 ^= u<<13 | u>>>(32-13);
  37829. u = x12 + x8 | 0;
  37830. x0 ^= u<<18 | u>>>(32-18);
  37831. u = x5 + x1 | 0;
  37832. x9 ^= u<<7 | u>>>(32-7);
  37833. u = x9 + x5 | 0;
  37834. x13 ^= u<<9 | u>>>(32-9);
  37835. u = x13 + x9 | 0;
  37836. x1 ^= u<<13 | u>>>(32-13);
  37837. u = x1 + x13 | 0;
  37838. x5 ^= u<<18 | u>>>(32-18);
  37839. u = x10 + x6 | 0;
  37840. x14 ^= u<<7 | u>>>(32-7);
  37841. u = x14 + x10 | 0;
  37842. x2 ^= u<<9 | u>>>(32-9);
  37843. u = x2 + x14 | 0;
  37844. x6 ^= u<<13 | u>>>(32-13);
  37845. u = x6 + x2 | 0;
  37846. x10 ^= u<<18 | u>>>(32-18);
  37847. u = x15 + x11 | 0;
  37848. x3 ^= u<<7 | u>>>(32-7);
  37849. u = x3 + x15 | 0;
  37850. x7 ^= u<<9 | u>>>(32-9);
  37851. u = x7 + x3 | 0;
  37852. x11 ^= u<<13 | u>>>(32-13);
  37853. u = x11 + x7 | 0;
  37854. x15 ^= u<<18 | u>>>(32-18);
  37855. u = x0 + x3 | 0;
  37856. x1 ^= u<<7 | u>>>(32-7);
  37857. u = x1 + x0 | 0;
  37858. x2 ^= u<<9 | u>>>(32-9);
  37859. u = x2 + x1 | 0;
  37860. x3 ^= u<<13 | u>>>(32-13);
  37861. u = x3 + x2 | 0;
  37862. x0 ^= u<<18 | u>>>(32-18);
  37863. u = x5 + x4 | 0;
  37864. x6 ^= u<<7 | u>>>(32-7);
  37865. u = x6 + x5 | 0;
  37866. x7 ^= u<<9 | u>>>(32-9);
  37867. u = x7 + x6 | 0;
  37868. x4 ^= u<<13 | u>>>(32-13);
  37869. u = x4 + x7 | 0;
  37870. x5 ^= u<<18 | u>>>(32-18);
  37871. u = x10 + x9 | 0;
  37872. x11 ^= u<<7 | u>>>(32-7);
  37873. u = x11 + x10 | 0;
  37874. x8 ^= u<<9 | u>>>(32-9);
  37875. u = x8 + x11 | 0;
  37876. x9 ^= u<<13 | u>>>(32-13);
  37877. u = x9 + x8 | 0;
  37878. x10 ^= u<<18 | u>>>(32-18);
  37879. u = x15 + x14 | 0;
  37880. x12 ^= u<<7 | u>>>(32-7);
  37881. u = x12 + x15 | 0;
  37882. x13 ^= u<<9 | u>>>(32-9);
  37883. u = x13 + x12 | 0;
  37884. x14 ^= u<<13 | u>>>(32-13);
  37885. u = x14 + x13 | 0;
  37886. x15 ^= u<<18 | u>>>(32-18);
  37887. }
  37888. x0 = x0 + j0 | 0;
  37889. x1 = x1 + j1 | 0;
  37890. x2 = x2 + j2 | 0;
  37891. x3 = x3 + j3 | 0;
  37892. x4 = x4 + j4 | 0;
  37893. x5 = x5 + j5 | 0;
  37894. x6 = x6 + j6 | 0;
  37895. x7 = x7 + j7 | 0;
  37896. x8 = x8 + j8 | 0;
  37897. x9 = x9 + j9 | 0;
  37898. x10 = x10 + j10 | 0;
  37899. x11 = x11 + j11 | 0;
  37900. x12 = x12 + j12 | 0;
  37901. x13 = x13 + j13 | 0;
  37902. x14 = x14 + j14 | 0;
  37903. x15 = x15 + j15 | 0;
  37904. o[ 0] = x0 >>> 0 & 0xff;
  37905. o[ 1] = x0 >>> 8 & 0xff;
  37906. o[ 2] = x0 >>> 16 & 0xff;
  37907. o[ 3] = x0 >>> 24 & 0xff;
  37908. o[ 4] = x1 >>> 0 & 0xff;
  37909. o[ 5] = x1 >>> 8 & 0xff;
  37910. o[ 6] = x1 >>> 16 & 0xff;
  37911. o[ 7] = x1 >>> 24 & 0xff;
  37912. o[ 8] = x2 >>> 0 & 0xff;
  37913. o[ 9] = x2 >>> 8 & 0xff;
  37914. o[10] = x2 >>> 16 & 0xff;
  37915. o[11] = x2 >>> 24 & 0xff;
  37916. o[12] = x3 >>> 0 & 0xff;
  37917. o[13] = x3 >>> 8 & 0xff;
  37918. o[14] = x3 >>> 16 & 0xff;
  37919. o[15] = x3 >>> 24 & 0xff;
  37920. o[16] = x4 >>> 0 & 0xff;
  37921. o[17] = x4 >>> 8 & 0xff;
  37922. o[18] = x4 >>> 16 & 0xff;
  37923. o[19] = x4 >>> 24 & 0xff;
  37924. o[20] = x5 >>> 0 & 0xff;
  37925. o[21] = x5 >>> 8 & 0xff;
  37926. o[22] = x5 >>> 16 & 0xff;
  37927. o[23] = x5 >>> 24 & 0xff;
  37928. o[24] = x6 >>> 0 & 0xff;
  37929. o[25] = x6 >>> 8 & 0xff;
  37930. o[26] = x6 >>> 16 & 0xff;
  37931. o[27] = x6 >>> 24 & 0xff;
  37932. o[28] = x7 >>> 0 & 0xff;
  37933. o[29] = x7 >>> 8 & 0xff;
  37934. o[30] = x7 >>> 16 & 0xff;
  37935. o[31] = x7 >>> 24 & 0xff;
  37936. o[32] = x8 >>> 0 & 0xff;
  37937. o[33] = x8 >>> 8 & 0xff;
  37938. o[34] = x8 >>> 16 & 0xff;
  37939. o[35] = x8 >>> 24 & 0xff;
  37940. o[36] = x9 >>> 0 & 0xff;
  37941. o[37] = x9 >>> 8 & 0xff;
  37942. o[38] = x9 >>> 16 & 0xff;
  37943. o[39] = x9 >>> 24 & 0xff;
  37944. o[40] = x10 >>> 0 & 0xff;
  37945. o[41] = x10 >>> 8 & 0xff;
  37946. o[42] = x10 >>> 16 & 0xff;
  37947. o[43] = x10 >>> 24 & 0xff;
  37948. o[44] = x11 >>> 0 & 0xff;
  37949. o[45] = x11 >>> 8 & 0xff;
  37950. o[46] = x11 >>> 16 & 0xff;
  37951. o[47] = x11 >>> 24 & 0xff;
  37952. o[48] = x12 >>> 0 & 0xff;
  37953. o[49] = x12 >>> 8 & 0xff;
  37954. o[50] = x12 >>> 16 & 0xff;
  37955. o[51] = x12 >>> 24 & 0xff;
  37956. o[52] = x13 >>> 0 & 0xff;
  37957. o[53] = x13 >>> 8 & 0xff;
  37958. o[54] = x13 >>> 16 & 0xff;
  37959. o[55] = x13 >>> 24 & 0xff;
  37960. o[56] = x14 >>> 0 & 0xff;
  37961. o[57] = x14 >>> 8 & 0xff;
  37962. o[58] = x14 >>> 16 & 0xff;
  37963. o[59] = x14 >>> 24 & 0xff;
  37964. o[60] = x15 >>> 0 & 0xff;
  37965. o[61] = x15 >>> 8 & 0xff;
  37966. o[62] = x15 >>> 16 & 0xff;
  37967. o[63] = x15 >>> 24 & 0xff;
  37968. }
  37969. function core_hsalsa20(o,p,k,c) {
  37970. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37971. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37972. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37973. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37974. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37975. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37976. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37977. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37978. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37979. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37980. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37981. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37982. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37983. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37984. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37985. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37986. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37987. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37988. x15 = j15, u;
  37989. for (var i = 0; i < 20; i += 2) {
  37990. u = x0 + x12 | 0;
  37991. x4 ^= u<<7 | u>>>(32-7);
  37992. u = x4 + x0 | 0;
  37993. x8 ^= u<<9 | u>>>(32-9);
  37994. u = x8 + x4 | 0;
  37995. x12 ^= u<<13 | u>>>(32-13);
  37996. u = x12 + x8 | 0;
  37997. x0 ^= u<<18 | u>>>(32-18);
  37998. u = x5 + x1 | 0;
  37999. x9 ^= u<<7 | u>>>(32-7);
  38000. u = x9 + x5 | 0;
  38001. x13 ^= u<<9 | u>>>(32-9);
  38002. u = x13 + x9 | 0;
  38003. x1 ^= u<<13 | u>>>(32-13);
  38004. u = x1 + x13 | 0;
  38005. x5 ^= u<<18 | u>>>(32-18);
  38006. u = x10 + x6 | 0;
  38007. x14 ^= u<<7 | u>>>(32-7);
  38008. u = x14 + x10 | 0;
  38009. x2 ^= u<<9 | u>>>(32-9);
  38010. u = x2 + x14 | 0;
  38011. x6 ^= u<<13 | u>>>(32-13);
  38012. u = x6 + x2 | 0;
  38013. x10 ^= u<<18 | u>>>(32-18);
  38014. u = x15 + x11 | 0;
  38015. x3 ^= u<<7 | u>>>(32-7);
  38016. u = x3 + x15 | 0;
  38017. x7 ^= u<<9 | u>>>(32-9);
  38018. u = x7 + x3 | 0;
  38019. x11 ^= u<<13 | u>>>(32-13);
  38020. u = x11 + x7 | 0;
  38021. x15 ^= u<<18 | u>>>(32-18);
  38022. u = x0 + x3 | 0;
  38023. x1 ^= u<<7 | u>>>(32-7);
  38024. u = x1 + x0 | 0;
  38025. x2 ^= u<<9 | u>>>(32-9);
  38026. u = x2 + x1 | 0;
  38027. x3 ^= u<<13 | u>>>(32-13);
  38028. u = x3 + x2 | 0;
  38029. x0 ^= u<<18 | u>>>(32-18);
  38030. u = x5 + x4 | 0;
  38031. x6 ^= u<<7 | u>>>(32-7);
  38032. u = x6 + x5 | 0;
  38033. x7 ^= u<<9 | u>>>(32-9);
  38034. u = x7 + x6 | 0;
  38035. x4 ^= u<<13 | u>>>(32-13);
  38036. u = x4 + x7 | 0;
  38037. x5 ^= u<<18 | u>>>(32-18);
  38038. u = x10 + x9 | 0;
  38039. x11 ^= u<<7 | u>>>(32-7);
  38040. u = x11 + x10 | 0;
  38041. x8 ^= u<<9 | u>>>(32-9);
  38042. u = x8 + x11 | 0;
  38043. x9 ^= u<<13 | u>>>(32-13);
  38044. u = x9 + x8 | 0;
  38045. x10 ^= u<<18 | u>>>(32-18);
  38046. u = x15 + x14 | 0;
  38047. x12 ^= u<<7 | u>>>(32-7);
  38048. u = x12 + x15 | 0;
  38049. x13 ^= u<<9 | u>>>(32-9);
  38050. u = x13 + x12 | 0;
  38051. x14 ^= u<<13 | u>>>(32-13);
  38052. u = x14 + x13 | 0;
  38053. x15 ^= u<<18 | u>>>(32-18);
  38054. }
  38055. o[ 0] = x0 >>> 0 & 0xff;
  38056. o[ 1] = x0 >>> 8 & 0xff;
  38057. o[ 2] = x0 >>> 16 & 0xff;
  38058. o[ 3] = x0 >>> 24 & 0xff;
  38059. o[ 4] = x5 >>> 0 & 0xff;
  38060. o[ 5] = x5 >>> 8 & 0xff;
  38061. o[ 6] = x5 >>> 16 & 0xff;
  38062. o[ 7] = x5 >>> 24 & 0xff;
  38063. o[ 8] = x10 >>> 0 & 0xff;
  38064. o[ 9] = x10 >>> 8 & 0xff;
  38065. o[10] = x10 >>> 16 & 0xff;
  38066. o[11] = x10 >>> 24 & 0xff;
  38067. o[12] = x15 >>> 0 & 0xff;
  38068. o[13] = x15 >>> 8 & 0xff;
  38069. o[14] = x15 >>> 16 & 0xff;
  38070. o[15] = x15 >>> 24 & 0xff;
  38071. o[16] = x6 >>> 0 & 0xff;
  38072. o[17] = x6 >>> 8 & 0xff;
  38073. o[18] = x6 >>> 16 & 0xff;
  38074. o[19] = x6 >>> 24 & 0xff;
  38075. o[20] = x7 >>> 0 & 0xff;
  38076. o[21] = x7 >>> 8 & 0xff;
  38077. o[22] = x7 >>> 16 & 0xff;
  38078. o[23] = x7 >>> 24 & 0xff;
  38079. o[24] = x8 >>> 0 & 0xff;
  38080. o[25] = x8 >>> 8 & 0xff;
  38081. o[26] = x8 >>> 16 & 0xff;
  38082. o[27] = x8 >>> 24 & 0xff;
  38083. o[28] = x9 >>> 0 & 0xff;
  38084. o[29] = x9 >>> 8 & 0xff;
  38085. o[30] = x9 >>> 16 & 0xff;
  38086. o[31] = x9 >>> 24 & 0xff;
  38087. }
  38088. function crypto_core_salsa20(out,inp,k,c) {
  38089. core_salsa20(out,inp,k,c);
  38090. }
  38091. function crypto_core_hsalsa20(out,inp,k,c) {
  38092. core_hsalsa20(out,inp,k,c);
  38093. }
  38094. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38095. // "expand 32-byte k"
  38096. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38097. var z = new Uint8Array(16), x = new Uint8Array(64);
  38098. var u, i;
  38099. for (i = 0; i < 16; i++) z[i] = 0;
  38100. for (i = 0; i < 8; i++) z[i] = n[i];
  38101. while (b >= 64) {
  38102. crypto_core_salsa20(x,z,k,sigma);
  38103. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38104. u = 1;
  38105. for (i = 8; i < 16; i++) {
  38106. u = u + (z[i] & 0xff) | 0;
  38107. z[i] = u & 0xff;
  38108. u >>>= 8;
  38109. }
  38110. b -= 64;
  38111. cpos += 64;
  38112. mpos += 64;
  38113. }
  38114. if (b > 0) {
  38115. crypto_core_salsa20(x,z,k,sigma);
  38116. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38117. }
  38118. return 0;
  38119. }
  38120. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38121. var z = new Uint8Array(16), x = new Uint8Array(64);
  38122. var u, i;
  38123. for (i = 0; i < 16; i++) z[i] = 0;
  38124. for (i = 0; i < 8; i++) z[i] = n[i];
  38125. while (b >= 64) {
  38126. crypto_core_salsa20(x,z,k,sigma);
  38127. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38128. u = 1;
  38129. for (i = 8; i < 16; i++) {
  38130. u = u + (z[i] & 0xff) | 0;
  38131. z[i] = u & 0xff;
  38132. u >>>= 8;
  38133. }
  38134. b -= 64;
  38135. cpos += 64;
  38136. }
  38137. if (b > 0) {
  38138. crypto_core_salsa20(x,z,k,sigma);
  38139. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38140. }
  38141. return 0;
  38142. }
  38143. function crypto_stream(c,cpos,d,n,k) {
  38144. var s = new Uint8Array(32);
  38145. crypto_core_hsalsa20(s,n,k,sigma);
  38146. var sn = new Uint8Array(8);
  38147. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38148. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38149. }
  38150. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38151. var s = new Uint8Array(32);
  38152. crypto_core_hsalsa20(s,n,k,sigma);
  38153. var sn = new Uint8Array(8);
  38154. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38155. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38156. }
  38157. /*
  38158. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38159. * https://github.com/floodyberry/poly1305-donna
  38160. */
  38161. var poly1305 = function(key) {
  38162. this.buffer = new Uint8Array(16);
  38163. this.r = new Uint16Array(10);
  38164. this.h = new Uint16Array(10);
  38165. this.pad = new Uint16Array(8);
  38166. this.leftover = 0;
  38167. this.fin = 0;
  38168. var t0, t1, t2, t3, t4, t5, t6, t7;
  38169. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38170. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38171. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38172. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38173. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38174. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38175. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38176. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38177. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38178. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38179. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38180. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38181. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38182. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38183. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38184. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38185. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38186. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38187. };
  38188. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38189. var hibit = this.fin ? 0 : (1 << 11);
  38190. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38191. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38192. var h0 = this.h[0],
  38193. h1 = this.h[1],
  38194. h2 = this.h[2],
  38195. h3 = this.h[3],
  38196. h4 = this.h[4],
  38197. h5 = this.h[5],
  38198. h6 = this.h[6],
  38199. h7 = this.h[7],
  38200. h8 = this.h[8],
  38201. h9 = this.h[9];
  38202. var r0 = this.r[0],
  38203. r1 = this.r[1],
  38204. r2 = this.r[2],
  38205. r3 = this.r[3],
  38206. r4 = this.r[4],
  38207. r5 = this.r[5],
  38208. r6 = this.r[6],
  38209. r7 = this.r[7],
  38210. r8 = this.r[8],
  38211. r9 = this.r[9];
  38212. while (bytes >= 16) {
  38213. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38214. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38215. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38216. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38217. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38218. h5 += ((t4 >>> 1)) & 0x1fff;
  38219. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38220. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38221. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38222. h9 += ((t7 >>> 5)) | hibit;
  38223. c = 0;
  38224. d0 = c;
  38225. d0 += h0 * r0;
  38226. d0 += h1 * (5 * r9);
  38227. d0 += h2 * (5 * r8);
  38228. d0 += h3 * (5 * r7);
  38229. d0 += h4 * (5 * r6);
  38230. c = (d0 >>> 13); d0 &= 0x1fff;
  38231. d0 += h5 * (5 * r5);
  38232. d0 += h6 * (5 * r4);
  38233. d0 += h7 * (5 * r3);
  38234. d0 += h8 * (5 * r2);
  38235. d0 += h9 * (5 * r1);
  38236. c += (d0 >>> 13); d0 &= 0x1fff;
  38237. d1 = c;
  38238. d1 += h0 * r1;
  38239. d1 += h1 * r0;
  38240. d1 += h2 * (5 * r9);
  38241. d1 += h3 * (5 * r8);
  38242. d1 += h4 * (5 * r7);
  38243. c = (d1 >>> 13); d1 &= 0x1fff;
  38244. d1 += h5 * (5 * r6);
  38245. d1 += h6 * (5 * r5);
  38246. d1 += h7 * (5 * r4);
  38247. d1 += h8 * (5 * r3);
  38248. d1 += h9 * (5 * r2);
  38249. c += (d1 >>> 13); d1 &= 0x1fff;
  38250. d2 = c;
  38251. d2 += h0 * r2;
  38252. d2 += h1 * r1;
  38253. d2 += h2 * r0;
  38254. d2 += h3 * (5 * r9);
  38255. d2 += h4 * (5 * r8);
  38256. c = (d2 >>> 13); d2 &= 0x1fff;
  38257. d2 += h5 * (5 * r7);
  38258. d2 += h6 * (5 * r6);
  38259. d2 += h7 * (5 * r5);
  38260. d2 += h8 * (5 * r4);
  38261. d2 += h9 * (5 * r3);
  38262. c += (d2 >>> 13); d2 &= 0x1fff;
  38263. d3 = c;
  38264. d3 += h0 * r3;
  38265. d3 += h1 * r2;
  38266. d3 += h2 * r1;
  38267. d3 += h3 * r0;
  38268. d3 += h4 * (5 * r9);
  38269. c = (d3 >>> 13); d3 &= 0x1fff;
  38270. d3 += h5 * (5 * r8);
  38271. d3 += h6 * (5 * r7);
  38272. d3 += h7 * (5 * r6);
  38273. d3 += h8 * (5 * r5);
  38274. d3 += h9 * (5 * r4);
  38275. c += (d3 >>> 13); d3 &= 0x1fff;
  38276. d4 = c;
  38277. d4 += h0 * r4;
  38278. d4 += h1 * r3;
  38279. d4 += h2 * r2;
  38280. d4 += h3 * r1;
  38281. d4 += h4 * r0;
  38282. c = (d4 >>> 13); d4 &= 0x1fff;
  38283. d4 += h5 * (5 * r9);
  38284. d4 += h6 * (5 * r8);
  38285. d4 += h7 * (5 * r7);
  38286. d4 += h8 * (5 * r6);
  38287. d4 += h9 * (5 * r5);
  38288. c += (d4 >>> 13); d4 &= 0x1fff;
  38289. d5 = c;
  38290. d5 += h0 * r5;
  38291. d5 += h1 * r4;
  38292. d5 += h2 * r3;
  38293. d5 += h3 * r2;
  38294. d5 += h4 * r1;
  38295. c = (d5 >>> 13); d5 &= 0x1fff;
  38296. d5 += h5 * r0;
  38297. d5 += h6 * (5 * r9);
  38298. d5 += h7 * (5 * r8);
  38299. d5 += h8 * (5 * r7);
  38300. d5 += h9 * (5 * r6);
  38301. c += (d5 >>> 13); d5 &= 0x1fff;
  38302. d6 = c;
  38303. d6 += h0 * r6;
  38304. d6 += h1 * r5;
  38305. d6 += h2 * r4;
  38306. d6 += h3 * r3;
  38307. d6 += h4 * r2;
  38308. c = (d6 >>> 13); d6 &= 0x1fff;
  38309. d6 += h5 * r1;
  38310. d6 += h6 * r0;
  38311. d6 += h7 * (5 * r9);
  38312. d6 += h8 * (5 * r8);
  38313. d6 += h9 * (5 * r7);
  38314. c += (d6 >>> 13); d6 &= 0x1fff;
  38315. d7 = c;
  38316. d7 += h0 * r7;
  38317. d7 += h1 * r6;
  38318. d7 += h2 * r5;
  38319. d7 += h3 * r4;
  38320. d7 += h4 * r3;
  38321. c = (d7 >>> 13); d7 &= 0x1fff;
  38322. d7 += h5 * r2;
  38323. d7 += h6 * r1;
  38324. d7 += h7 * r0;
  38325. d7 += h8 * (5 * r9);
  38326. d7 += h9 * (5 * r8);
  38327. c += (d7 >>> 13); d7 &= 0x1fff;
  38328. d8 = c;
  38329. d8 += h0 * r8;
  38330. d8 += h1 * r7;
  38331. d8 += h2 * r6;
  38332. d8 += h3 * r5;
  38333. d8 += h4 * r4;
  38334. c = (d8 >>> 13); d8 &= 0x1fff;
  38335. d8 += h5 * r3;
  38336. d8 += h6 * r2;
  38337. d8 += h7 * r1;
  38338. d8 += h8 * r0;
  38339. d8 += h9 * (5 * r9);
  38340. c += (d8 >>> 13); d8 &= 0x1fff;
  38341. d9 = c;
  38342. d9 += h0 * r9;
  38343. d9 += h1 * r8;
  38344. d9 += h2 * r7;
  38345. d9 += h3 * r6;
  38346. d9 += h4 * r5;
  38347. c = (d9 >>> 13); d9 &= 0x1fff;
  38348. d9 += h5 * r4;
  38349. d9 += h6 * r3;
  38350. d9 += h7 * r2;
  38351. d9 += h8 * r1;
  38352. d9 += h9 * r0;
  38353. c += (d9 >>> 13); d9 &= 0x1fff;
  38354. c = (((c << 2) + c)) | 0;
  38355. c = (c + d0) | 0;
  38356. d0 = c & 0x1fff;
  38357. c = (c >>> 13);
  38358. d1 += c;
  38359. h0 = d0;
  38360. h1 = d1;
  38361. h2 = d2;
  38362. h3 = d3;
  38363. h4 = d4;
  38364. h5 = d5;
  38365. h6 = d6;
  38366. h7 = d7;
  38367. h8 = d8;
  38368. h9 = d9;
  38369. mpos += 16;
  38370. bytes -= 16;
  38371. }
  38372. this.h[0] = h0;
  38373. this.h[1] = h1;
  38374. this.h[2] = h2;
  38375. this.h[3] = h3;
  38376. this.h[4] = h4;
  38377. this.h[5] = h5;
  38378. this.h[6] = h6;
  38379. this.h[7] = h7;
  38380. this.h[8] = h8;
  38381. this.h[9] = h9;
  38382. };
  38383. poly1305.prototype.finish = function(mac, macpos) {
  38384. var g = new Uint16Array(10);
  38385. var c, mask, f, i;
  38386. if (this.leftover) {
  38387. i = this.leftover;
  38388. this.buffer[i++] = 1;
  38389. for (; i < 16; i++) this.buffer[i] = 0;
  38390. this.fin = 1;
  38391. this.blocks(this.buffer, 0, 16);
  38392. }
  38393. c = this.h[1] >>> 13;
  38394. this.h[1] &= 0x1fff;
  38395. for (i = 2; i < 10; i++) {
  38396. this.h[i] += c;
  38397. c = this.h[i] >>> 13;
  38398. this.h[i] &= 0x1fff;
  38399. }
  38400. this.h[0] += (c * 5);
  38401. c = this.h[0] >>> 13;
  38402. this.h[0] &= 0x1fff;
  38403. this.h[1] += c;
  38404. c = this.h[1] >>> 13;
  38405. this.h[1] &= 0x1fff;
  38406. this.h[2] += c;
  38407. g[0] = this.h[0] + 5;
  38408. c = g[0] >>> 13;
  38409. g[0] &= 0x1fff;
  38410. for (i = 1; i < 10; i++) {
  38411. g[i] = this.h[i] + c;
  38412. c = g[i] >>> 13;
  38413. g[i] &= 0x1fff;
  38414. }
  38415. g[9] -= (1 << 13);
  38416. mask = (c ^ 1) - 1;
  38417. for (i = 0; i < 10; i++) g[i] &= mask;
  38418. mask = ~mask;
  38419. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38420. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38421. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38422. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38423. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38424. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38425. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38426. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38427. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38428. f = this.h[0] + this.pad[0];
  38429. this.h[0] = f & 0xffff;
  38430. for (i = 1; i < 8; i++) {
  38431. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38432. this.h[i] = f & 0xffff;
  38433. }
  38434. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38435. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38436. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38437. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38438. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38439. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38440. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38441. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38442. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38443. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38444. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38445. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38446. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38447. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38448. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38449. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38450. };
  38451. poly1305.prototype.update = function(m, mpos, bytes) {
  38452. var i, want;
  38453. if (this.leftover) {
  38454. want = (16 - this.leftover);
  38455. if (want > bytes)
  38456. want = bytes;
  38457. for (i = 0; i < want; i++)
  38458. this.buffer[this.leftover + i] = m[mpos+i];
  38459. bytes -= want;
  38460. mpos += want;
  38461. this.leftover += want;
  38462. if (this.leftover < 16)
  38463. return;
  38464. this.blocks(this.buffer, 0, 16);
  38465. this.leftover = 0;
  38466. }
  38467. if (bytes >= 16) {
  38468. want = bytes - (bytes % 16);
  38469. this.blocks(m, mpos, want);
  38470. mpos += want;
  38471. bytes -= want;
  38472. }
  38473. if (bytes) {
  38474. for (i = 0; i < bytes; i++)
  38475. this.buffer[this.leftover + i] = m[mpos+i];
  38476. this.leftover += bytes;
  38477. }
  38478. };
  38479. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38480. var s = new poly1305(k);
  38481. s.update(m, mpos, n);
  38482. s.finish(out, outpos);
  38483. return 0;
  38484. }
  38485. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38486. var x = new Uint8Array(16);
  38487. crypto_onetimeauth(x,0,m,mpos,n,k);
  38488. return crypto_verify_16(h,hpos,x,0);
  38489. }
  38490. function crypto_secretbox(c,m,d,n,k) {
  38491. var i;
  38492. if (d < 32) return -1;
  38493. crypto_stream_xor(c,0,m,0,d,n,k);
  38494. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38495. for (i = 0; i < 16; i++) c[i] = 0;
  38496. return 0;
  38497. }
  38498. function crypto_secretbox_open(m,c,d,n,k) {
  38499. var i;
  38500. var x = new Uint8Array(32);
  38501. if (d < 32) return -1;
  38502. crypto_stream(x,0,32,n,k);
  38503. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38504. crypto_stream_xor(m,0,c,0,d,n,k);
  38505. for (i = 0; i < 32; i++) m[i] = 0;
  38506. return 0;
  38507. }
  38508. function set25519(r, a) {
  38509. var i;
  38510. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38511. }
  38512. function car25519(o) {
  38513. var i, v, c = 1;
  38514. for (i = 0; i < 16; i++) {
  38515. v = o[i] + c + 65535;
  38516. c = Math.floor(v / 65536);
  38517. o[i] = v - c * 65536;
  38518. }
  38519. o[0] += c-1 + 37 * (c-1);
  38520. }
  38521. function sel25519(p, q, b) {
  38522. var t, c = ~(b-1);
  38523. for (var i = 0; i < 16; i++) {
  38524. t = c & (p[i] ^ q[i]);
  38525. p[i] ^= t;
  38526. q[i] ^= t;
  38527. }
  38528. }
  38529. function pack25519(o, n) {
  38530. var i, j, b;
  38531. var m = gf(), t = gf();
  38532. for (i = 0; i < 16; i++) t[i] = n[i];
  38533. car25519(t);
  38534. car25519(t);
  38535. car25519(t);
  38536. for (j = 0; j < 2; j++) {
  38537. m[0] = t[0] - 0xffed;
  38538. for (i = 1; i < 15; i++) {
  38539. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38540. m[i-1] &= 0xffff;
  38541. }
  38542. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38543. b = (m[15]>>16) & 1;
  38544. m[14] &= 0xffff;
  38545. sel25519(t, m, 1-b);
  38546. }
  38547. for (i = 0; i < 16; i++) {
  38548. o[2*i] = t[i] & 0xff;
  38549. o[2*i+1] = t[i]>>8;
  38550. }
  38551. }
  38552. function neq25519(a, b) {
  38553. var c = new Uint8Array(32), d = new Uint8Array(32);
  38554. pack25519(c, a);
  38555. pack25519(d, b);
  38556. return crypto_verify_32(c, 0, d, 0);
  38557. }
  38558. function par25519(a) {
  38559. var d = new Uint8Array(32);
  38560. pack25519(d, a);
  38561. return d[0] & 1;
  38562. }
  38563. function unpack25519(o, n) {
  38564. var i;
  38565. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38566. o[15] &= 0x7fff;
  38567. }
  38568. function A(o, a, b) {
  38569. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38570. }
  38571. function Z(o, a, b) {
  38572. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38573. }
  38574. function M(o, a, b) {
  38575. var v, c,
  38576. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38577. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38578. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38579. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38580. b0 = b[0],
  38581. b1 = b[1],
  38582. b2 = b[2],
  38583. b3 = b[3],
  38584. b4 = b[4],
  38585. b5 = b[5],
  38586. b6 = b[6],
  38587. b7 = b[7],
  38588. b8 = b[8],
  38589. b9 = b[9],
  38590. b10 = b[10],
  38591. b11 = b[11],
  38592. b12 = b[12],
  38593. b13 = b[13],
  38594. b14 = b[14],
  38595. b15 = b[15];
  38596. v = a[0];
  38597. t0 += v * b0;
  38598. t1 += v * b1;
  38599. t2 += v * b2;
  38600. t3 += v * b3;
  38601. t4 += v * b4;
  38602. t5 += v * b5;
  38603. t6 += v * b6;
  38604. t7 += v * b7;
  38605. t8 += v * b8;
  38606. t9 += v * b9;
  38607. t10 += v * b10;
  38608. t11 += v * b11;
  38609. t12 += v * b12;
  38610. t13 += v * b13;
  38611. t14 += v * b14;
  38612. t15 += v * b15;
  38613. v = a[1];
  38614. t1 += v * b0;
  38615. t2 += v * b1;
  38616. t3 += v * b2;
  38617. t4 += v * b3;
  38618. t5 += v * b4;
  38619. t6 += v * b5;
  38620. t7 += v * b6;
  38621. t8 += v * b7;
  38622. t9 += v * b8;
  38623. t10 += v * b9;
  38624. t11 += v * b10;
  38625. t12 += v * b11;
  38626. t13 += v * b12;
  38627. t14 += v * b13;
  38628. t15 += v * b14;
  38629. t16 += v * b15;
  38630. v = a[2];
  38631. t2 += v * b0;
  38632. t3 += v * b1;
  38633. t4 += v * b2;
  38634. t5 += v * b3;
  38635. t6 += v * b4;
  38636. t7 += v * b5;
  38637. t8 += v * b6;
  38638. t9 += v * b7;
  38639. t10 += v * b8;
  38640. t11 += v * b9;
  38641. t12 += v * b10;
  38642. t13 += v * b11;
  38643. t14 += v * b12;
  38644. t15 += v * b13;
  38645. t16 += v * b14;
  38646. t17 += v * b15;
  38647. v = a[3];
  38648. t3 += v * b0;
  38649. t4 += v * b1;
  38650. t5 += v * b2;
  38651. t6 += v * b3;
  38652. t7 += v * b4;
  38653. t8 += v * b5;
  38654. t9 += v * b6;
  38655. t10 += v * b7;
  38656. t11 += v * b8;
  38657. t12 += v * b9;
  38658. t13 += v * b10;
  38659. t14 += v * b11;
  38660. t15 += v * b12;
  38661. t16 += v * b13;
  38662. t17 += v * b14;
  38663. t18 += v * b15;
  38664. v = a[4];
  38665. t4 += v * b0;
  38666. t5 += v * b1;
  38667. t6 += v * b2;
  38668. t7 += v * b3;
  38669. t8 += v * b4;
  38670. t9 += v * b5;
  38671. t10 += v * b6;
  38672. t11 += v * b7;
  38673. t12 += v * b8;
  38674. t13 += v * b9;
  38675. t14 += v * b10;
  38676. t15 += v * b11;
  38677. t16 += v * b12;
  38678. t17 += v * b13;
  38679. t18 += v * b14;
  38680. t19 += v * b15;
  38681. v = a[5];
  38682. t5 += v * b0;
  38683. t6 += v * b1;
  38684. t7 += v * b2;
  38685. t8 += v * b3;
  38686. t9 += v * b4;
  38687. t10 += v * b5;
  38688. t11 += v * b6;
  38689. t12 += v * b7;
  38690. t13 += v * b8;
  38691. t14 += v * b9;
  38692. t15 += v * b10;
  38693. t16 += v * b11;
  38694. t17 += v * b12;
  38695. t18 += v * b13;
  38696. t19 += v * b14;
  38697. t20 += v * b15;
  38698. v = a[6];
  38699. t6 += v * b0;
  38700. t7 += v * b1;
  38701. t8 += v * b2;
  38702. t9 += v * b3;
  38703. t10 += v * b4;
  38704. t11 += v * b5;
  38705. t12 += v * b6;
  38706. t13 += v * b7;
  38707. t14 += v * b8;
  38708. t15 += v * b9;
  38709. t16 += v * b10;
  38710. t17 += v * b11;
  38711. t18 += v * b12;
  38712. t19 += v * b13;
  38713. t20 += v * b14;
  38714. t21 += v * b15;
  38715. v = a[7];
  38716. t7 += v * b0;
  38717. t8 += v * b1;
  38718. t9 += v * b2;
  38719. t10 += v * b3;
  38720. t11 += v * b4;
  38721. t12 += v * b5;
  38722. t13 += v * b6;
  38723. t14 += v * b7;
  38724. t15 += v * b8;
  38725. t16 += v * b9;
  38726. t17 += v * b10;
  38727. t18 += v * b11;
  38728. t19 += v * b12;
  38729. t20 += v * b13;
  38730. t21 += v * b14;
  38731. t22 += v * b15;
  38732. v = a[8];
  38733. t8 += v * b0;
  38734. t9 += v * b1;
  38735. t10 += v * b2;
  38736. t11 += v * b3;
  38737. t12 += v * b4;
  38738. t13 += v * b5;
  38739. t14 += v * b6;
  38740. t15 += v * b7;
  38741. t16 += v * b8;
  38742. t17 += v * b9;
  38743. t18 += v * b10;
  38744. t19 += v * b11;
  38745. t20 += v * b12;
  38746. t21 += v * b13;
  38747. t22 += v * b14;
  38748. t23 += v * b15;
  38749. v = a[9];
  38750. t9 += v * b0;
  38751. t10 += v * b1;
  38752. t11 += v * b2;
  38753. t12 += v * b3;
  38754. t13 += v * b4;
  38755. t14 += v * b5;
  38756. t15 += v * b6;
  38757. t16 += v * b7;
  38758. t17 += v * b8;
  38759. t18 += v * b9;
  38760. t19 += v * b10;
  38761. t20 += v * b11;
  38762. t21 += v * b12;
  38763. t22 += v * b13;
  38764. t23 += v * b14;
  38765. t24 += v * b15;
  38766. v = a[10];
  38767. t10 += v * b0;
  38768. t11 += v * b1;
  38769. t12 += v * b2;
  38770. t13 += v * b3;
  38771. t14 += v * b4;
  38772. t15 += v * b5;
  38773. t16 += v * b6;
  38774. t17 += v * b7;
  38775. t18 += v * b8;
  38776. t19 += v * b9;
  38777. t20 += v * b10;
  38778. t21 += v * b11;
  38779. t22 += v * b12;
  38780. t23 += v * b13;
  38781. t24 += v * b14;
  38782. t25 += v * b15;
  38783. v = a[11];
  38784. t11 += v * b0;
  38785. t12 += v * b1;
  38786. t13 += v * b2;
  38787. t14 += v * b3;
  38788. t15 += v * b4;
  38789. t16 += v * b5;
  38790. t17 += v * b6;
  38791. t18 += v * b7;
  38792. t19 += v * b8;
  38793. t20 += v * b9;
  38794. t21 += v * b10;
  38795. t22 += v * b11;
  38796. t23 += v * b12;
  38797. t24 += v * b13;
  38798. t25 += v * b14;
  38799. t26 += v * b15;
  38800. v = a[12];
  38801. t12 += v * b0;
  38802. t13 += v * b1;
  38803. t14 += v * b2;
  38804. t15 += v * b3;
  38805. t16 += v * b4;
  38806. t17 += v * b5;
  38807. t18 += v * b6;
  38808. t19 += v * b7;
  38809. t20 += v * b8;
  38810. t21 += v * b9;
  38811. t22 += v * b10;
  38812. t23 += v * b11;
  38813. t24 += v * b12;
  38814. t25 += v * b13;
  38815. t26 += v * b14;
  38816. t27 += v * b15;
  38817. v = a[13];
  38818. t13 += v * b0;
  38819. t14 += v * b1;
  38820. t15 += v * b2;
  38821. t16 += v * b3;
  38822. t17 += v * b4;
  38823. t18 += v * b5;
  38824. t19 += v * b6;
  38825. t20 += v * b7;
  38826. t21 += v * b8;
  38827. t22 += v * b9;
  38828. t23 += v * b10;
  38829. t24 += v * b11;
  38830. t25 += v * b12;
  38831. t26 += v * b13;
  38832. t27 += v * b14;
  38833. t28 += v * b15;
  38834. v = a[14];
  38835. t14 += v * b0;
  38836. t15 += v * b1;
  38837. t16 += v * b2;
  38838. t17 += v * b3;
  38839. t18 += v * b4;
  38840. t19 += v * b5;
  38841. t20 += v * b6;
  38842. t21 += v * b7;
  38843. t22 += v * b8;
  38844. t23 += v * b9;
  38845. t24 += v * b10;
  38846. t25 += v * b11;
  38847. t26 += v * b12;
  38848. t27 += v * b13;
  38849. t28 += v * b14;
  38850. t29 += v * b15;
  38851. v = a[15];
  38852. t15 += v * b0;
  38853. t16 += v * b1;
  38854. t17 += v * b2;
  38855. t18 += v * b3;
  38856. t19 += v * b4;
  38857. t20 += v * b5;
  38858. t21 += v * b6;
  38859. t22 += v * b7;
  38860. t23 += v * b8;
  38861. t24 += v * b9;
  38862. t25 += v * b10;
  38863. t26 += v * b11;
  38864. t27 += v * b12;
  38865. t28 += v * b13;
  38866. t29 += v * b14;
  38867. t30 += v * b15;
  38868. t0 += 38 * t16;
  38869. t1 += 38 * t17;
  38870. t2 += 38 * t18;
  38871. t3 += 38 * t19;
  38872. t4 += 38 * t20;
  38873. t5 += 38 * t21;
  38874. t6 += 38 * t22;
  38875. t7 += 38 * t23;
  38876. t8 += 38 * t24;
  38877. t9 += 38 * t25;
  38878. t10 += 38 * t26;
  38879. t11 += 38 * t27;
  38880. t12 += 38 * t28;
  38881. t13 += 38 * t29;
  38882. t14 += 38 * t30;
  38883. // t15 left as is
  38884. // first car
  38885. c = 1;
  38886. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38887. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38888. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38889. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38890. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38891. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38892. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38893. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38894. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38895. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38896. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38897. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38898. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38899. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38900. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38901. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38902. t0 += c-1 + 37 * (c-1);
  38903. // second car
  38904. c = 1;
  38905. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38906. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38907. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38908. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38909. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38910. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38911. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38912. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38913. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38914. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38915. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38916. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38917. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38918. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38919. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38920. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38921. t0 += c-1 + 37 * (c-1);
  38922. o[ 0] = t0;
  38923. o[ 1] = t1;
  38924. o[ 2] = t2;
  38925. o[ 3] = t3;
  38926. o[ 4] = t4;
  38927. o[ 5] = t5;
  38928. o[ 6] = t6;
  38929. o[ 7] = t7;
  38930. o[ 8] = t8;
  38931. o[ 9] = t9;
  38932. o[10] = t10;
  38933. o[11] = t11;
  38934. o[12] = t12;
  38935. o[13] = t13;
  38936. o[14] = t14;
  38937. o[15] = t15;
  38938. }
  38939. function S(o, a) {
  38940. M(o, a, a);
  38941. }
  38942. function inv25519(o, i) {
  38943. var c = gf();
  38944. var a;
  38945. for (a = 0; a < 16; a++) c[a] = i[a];
  38946. for (a = 253; a >= 0; a--) {
  38947. S(c, c);
  38948. if(a !== 2 && a !== 4) M(c, c, i);
  38949. }
  38950. for (a = 0; a < 16; a++) o[a] = c[a];
  38951. }
  38952. function pow2523(o, i) {
  38953. var c = gf();
  38954. var a;
  38955. for (a = 0; a < 16; a++) c[a] = i[a];
  38956. for (a = 250; a >= 0; a--) {
  38957. S(c, c);
  38958. if(a !== 1) M(c, c, i);
  38959. }
  38960. for (a = 0; a < 16; a++) o[a] = c[a];
  38961. }
  38962. function crypto_scalarmult(q, n, p) {
  38963. var z = new Uint8Array(32);
  38964. var x = new Float64Array(80), r, i;
  38965. var a = gf(), b = gf(), c = gf(),
  38966. d = gf(), e = gf(), f = gf();
  38967. for (i = 0; i < 31; i++) z[i] = n[i];
  38968. z[31]=(n[31]&127)|64;
  38969. z[0]&=248;
  38970. unpack25519(x,p);
  38971. for (i = 0; i < 16; i++) {
  38972. b[i]=x[i];
  38973. d[i]=a[i]=c[i]=0;
  38974. }
  38975. a[0]=d[0]=1;
  38976. for (i=254; i>=0; --i) {
  38977. r=(z[i>>>3]>>>(i&7))&1;
  38978. sel25519(a,b,r);
  38979. sel25519(c,d,r);
  38980. A(e,a,c);
  38981. Z(a,a,c);
  38982. A(c,b,d);
  38983. Z(b,b,d);
  38984. S(d,e);
  38985. S(f,a);
  38986. M(a,c,a);
  38987. M(c,b,e);
  38988. A(e,a,c);
  38989. Z(a,a,c);
  38990. S(b,a);
  38991. Z(c,d,f);
  38992. M(a,c,_121665);
  38993. A(a,a,d);
  38994. M(c,c,a);
  38995. M(a,d,f);
  38996. M(d,b,x);
  38997. S(b,e);
  38998. sel25519(a,b,r);
  38999. sel25519(c,d,r);
  39000. }
  39001. for (i = 0; i < 16; i++) {
  39002. x[i+16]=a[i];
  39003. x[i+32]=c[i];
  39004. x[i+48]=b[i];
  39005. x[i+64]=d[i];
  39006. }
  39007. var x32 = x.subarray(32);
  39008. var x16 = x.subarray(16);
  39009. inv25519(x32,x32);
  39010. M(x16,x16,x32);
  39011. pack25519(q,x16);
  39012. return 0;
  39013. }
  39014. function crypto_scalarmult_base(q, n) {
  39015. return crypto_scalarmult(q, n, _9);
  39016. }
  39017. function crypto_box_keypair(y, x) {
  39018. randombytes(x, 32);
  39019. return crypto_scalarmult_base(y, x);
  39020. }
  39021. function crypto_box_beforenm(k, y, x) {
  39022. var s = new Uint8Array(32);
  39023. crypto_scalarmult(s, x, y);
  39024. return crypto_core_hsalsa20(k, _0, s, sigma);
  39025. }
  39026. var crypto_box_afternm = crypto_secretbox;
  39027. var crypto_box_open_afternm = crypto_secretbox_open;
  39028. function crypto_box(c, m, d, n, y, x) {
  39029. var k = new Uint8Array(32);
  39030. crypto_box_beforenm(k, y, x);
  39031. return crypto_box_afternm(c, m, d, n, k);
  39032. }
  39033. function crypto_box_open(m, c, d, n, y, x) {
  39034. var k = new Uint8Array(32);
  39035. crypto_box_beforenm(k, y, x);
  39036. return crypto_box_open_afternm(m, c, d, n, k);
  39037. }
  39038. var K = [
  39039. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39040. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39041. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39042. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39043. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39044. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39045. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39046. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39047. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39048. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39049. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39050. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39051. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39052. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39053. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39054. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39055. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39056. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39057. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39058. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39059. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39060. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39061. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39062. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39063. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39064. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39065. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39066. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39067. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39068. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39069. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39070. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39071. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39072. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39073. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39074. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39075. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39076. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39077. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39078. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39079. ];
  39080. function crypto_hashblocks_hl(hh, hl, m, n) {
  39081. var wh = new Int32Array(16), wl = new Int32Array(16),
  39082. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39083. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39084. th, tl, i, j, h, l, a, b, c, d;
  39085. var ah0 = hh[0],
  39086. ah1 = hh[1],
  39087. ah2 = hh[2],
  39088. ah3 = hh[3],
  39089. ah4 = hh[4],
  39090. ah5 = hh[5],
  39091. ah6 = hh[6],
  39092. ah7 = hh[7],
  39093. al0 = hl[0],
  39094. al1 = hl[1],
  39095. al2 = hl[2],
  39096. al3 = hl[3],
  39097. al4 = hl[4],
  39098. al5 = hl[5],
  39099. al6 = hl[6],
  39100. al7 = hl[7];
  39101. var pos = 0;
  39102. while (n >= 128) {
  39103. for (i = 0; i < 16; i++) {
  39104. j = 8 * i + pos;
  39105. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39106. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39107. }
  39108. for (i = 0; i < 80; i++) {
  39109. bh0 = ah0;
  39110. bh1 = ah1;
  39111. bh2 = ah2;
  39112. bh3 = ah3;
  39113. bh4 = ah4;
  39114. bh5 = ah5;
  39115. bh6 = ah6;
  39116. bh7 = ah7;
  39117. bl0 = al0;
  39118. bl1 = al1;
  39119. bl2 = al2;
  39120. bl3 = al3;
  39121. bl4 = al4;
  39122. bl5 = al5;
  39123. bl6 = al6;
  39124. bl7 = al7;
  39125. // add
  39126. h = ah7;
  39127. l = al7;
  39128. a = l & 0xffff; b = l >>> 16;
  39129. c = h & 0xffff; d = h >>> 16;
  39130. // Sigma1
  39131. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39132. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39133. a += l & 0xffff; b += l >>> 16;
  39134. c += h & 0xffff; d += h >>> 16;
  39135. // Ch
  39136. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39137. l = (al4 & al5) ^ (~al4 & al6);
  39138. a += l & 0xffff; b += l >>> 16;
  39139. c += h & 0xffff; d += h >>> 16;
  39140. // K
  39141. h = K[i*2];
  39142. l = K[i*2+1];
  39143. a += l & 0xffff; b += l >>> 16;
  39144. c += h & 0xffff; d += h >>> 16;
  39145. // w
  39146. h = wh[i%16];
  39147. l = wl[i%16];
  39148. a += l & 0xffff; b += l >>> 16;
  39149. c += h & 0xffff; d += h >>> 16;
  39150. b += a >>> 16;
  39151. c += b >>> 16;
  39152. d += c >>> 16;
  39153. th = c & 0xffff | d << 16;
  39154. tl = a & 0xffff | b << 16;
  39155. // add
  39156. h = th;
  39157. l = tl;
  39158. a = l & 0xffff; b = l >>> 16;
  39159. c = h & 0xffff; d = h >>> 16;
  39160. // Sigma0
  39161. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39162. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39163. a += l & 0xffff; b += l >>> 16;
  39164. c += h & 0xffff; d += h >>> 16;
  39165. // Maj
  39166. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39167. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39168. a += l & 0xffff; b += l >>> 16;
  39169. c += h & 0xffff; d += h >>> 16;
  39170. b += a >>> 16;
  39171. c += b >>> 16;
  39172. d += c >>> 16;
  39173. bh7 = (c & 0xffff) | (d << 16);
  39174. bl7 = (a & 0xffff) | (b << 16);
  39175. // add
  39176. h = bh3;
  39177. l = bl3;
  39178. a = l & 0xffff; b = l >>> 16;
  39179. c = h & 0xffff; d = h >>> 16;
  39180. h = th;
  39181. l = tl;
  39182. a += l & 0xffff; b += l >>> 16;
  39183. c += h & 0xffff; d += h >>> 16;
  39184. b += a >>> 16;
  39185. c += b >>> 16;
  39186. d += c >>> 16;
  39187. bh3 = (c & 0xffff) | (d << 16);
  39188. bl3 = (a & 0xffff) | (b << 16);
  39189. ah1 = bh0;
  39190. ah2 = bh1;
  39191. ah3 = bh2;
  39192. ah4 = bh3;
  39193. ah5 = bh4;
  39194. ah6 = bh5;
  39195. ah7 = bh6;
  39196. ah0 = bh7;
  39197. al1 = bl0;
  39198. al2 = bl1;
  39199. al3 = bl2;
  39200. al4 = bl3;
  39201. al5 = bl4;
  39202. al6 = bl5;
  39203. al7 = bl6;
  39204. al0 = bl7;
  39205. if (i%16 === 15) {
  39206. for (j = 0; j < 16; j++) {
  39207. // add
  39208. h = wh[j];
  39209. l = wl[j];
  39210. a = l & 0xffff; b = l >>> 16;
  39211. c = h & 0xffff; d = h >>> 16;
  39212. h = wh[(j+9)%16];
  39213. l = wl[(j+9)%16];
  39214. a += l & 0xffff; b += l >>> 16;
  39215. c += h & 0xffff; d += h >>> 16;
  39216. // sigma0
  39217. th = wh[(j+1)%16];
  39218. tl = wl[(j+1)%16];
  39219. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39220. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39221. a += l & 0xffff; b += l >>> 16;
  39222. c += h & 0xffff; d += h >>> 16;
  39223. // sigma1
  39224. th = wh[(j+14)%16];
  39225. tl = wl[(j+14)%16];
  39226. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39227. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39228. a += l & 0xffff; b += l >>> 16;
  39229. c += h & 0xffff; d += h >>> 16;
  39230. b += a >>> 16;
  39231. c += b >>> 16;
  39232. d += c >>> 16;
  39233. wh[j] = (c & 0xffff) | (d << 16);
  39234. wl[j] = (a & 0xffff) | (b << 16);
  39235. }
  39236. }
  39237. }
  39238. // add
  39239. h = ah0;
  39240. l = al0;
  39241. a = l & 0xffff; b = l >>> 16;
  39242. c = h & 0xffff; d = h >>> 16;
  39243. h = hh[0];
  39244. l = hl[0];
  39245. a += l & 0xffff; b += l >>> 16;
  39246. c += h & 0xffff; d += h >>> 16;
  39247. b += a >>> 16;
  39248. c += b >>> 16;
  39249. d += c >>> 16;
  39250. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39251. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39252. h = ah1;
  39253. l = al1;
  39254. a = l & 0xffff; b = l >>> 16;
  39255. c = h & 0xffff; d = h >>> 16;
  39256. h = hh[1];
  39257. l = hl[1];
  39258. a += l & 0xffff; b += l >>> 16;
  39259. c += h & 0xffff; d += h >>> 16;
  39260. b += a >>> 16;
  39261. c += b >>> 16;
  39262. d += c >>> 16;
  39263. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39264. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39265. h = ah2;
  39266. l = al2;
  39267. a = l & 0xffff; b = l >>> 16;
  39268. c = h & 0xffff; d = h >>> 16;
  39269. h = hh[2];
  39270. l = hl[2];
  39271. a += l & 0xffff; b += l >>> 16;
  39272. c += h & 0xffff; d += h >>> 16;
  39273. b += a >>> 16;
  39274. c += b >>> 16;
  39275. d += c >>> 16;
  39276. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39277. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39278. h = ah3;
  39279. l = al3;
  39280. a = l & 0xffff; b = l >>> 16;
  39281. c = h & 0xffff; d = h >>> 16;
  39282. h = hh[3];
  39283. l = hl[3];
  39284. a += l & 0xffff; b += l >>> 16;
  39285. c += h & 0xffff; d += h >>> 16;
  39286. b += a >>> 16;
  39287. c += b >>> 16;
  39288. d += c >>> 16;
  39289. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39290. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39291. h = ah4;
  39292. l = al4;
  39293. a = l & 0xffff; b = l >>> 16;
  39294. c = h & 0xffff; d = h >>> 16;
  39295. h = hh[4];
  39296. l = hl[4];
  39297. a += l & 0xffff; b += l >>> 16;
  39298. c += h & 0xffff; d += h >>> 16;
  39299. b += a >>> 16;
  39300. c += b >>> 16;
  39301. d += c >>> 16;
  39302. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39303. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39304. h = ah5;
  39305. l = al5;
  39306. a = l & 0xffff; b = l >>> 16;
  39307. c = h & 0xffff; d = h >>> 16;
  39308. h = hh[5];
  39309. l = hl[5];
  39310. a += l & 0xffff; b += l >>> 16;
  39311. c += h & 0xffff; d += h >>> 16;
  39312. b += a >>> 16;
  39313. c += b >>> 16;
  39314. d += c >>> 16;
  39315. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39316. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39317. h = ah6;
  39318. l = al6;
  39319. a = l & 0xffff; b = l >>> 16;
  39320. c = h & 0xffff; d = h >>> 16;
  39321. h = hh[6];
  39322. l = hl[6];
  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[6] = ah6 = (c & 0xffff) | (d << 16);
  39329. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39330. h = ah7;
  39331. l = al7;
  39332. a = l & 0xffff; b = l >>> 16;
  39333. c = h & 0xffff; d = h >>> 16;
  39334. h = hh[7];
  39335. l = hl[7];
  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[7] = ah7 = (c & 0xffff) | (d << 16);
  39342. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39343. pos += 128;
  39344. n -= 128;
  39345. }
  39346. return n;
  39347. }
  39348. function crypto_hash(out, m, n) {
  39349. var hh = new Int32Array(8),
  39350. hl = new Int32Array(8),
  39351. x = new Uint8Array(256),
  39352. i, b = n;
  39353. hh[0] = 0x6a09e667;
  39354. hh[1] = 0xbb67ae85;
  39355. hh[2] = 0x3c6ef372;
  39356. hh[3] = 0xa54ff53a;
  39357. hh[4] = 0x510e527f;
  39358. hh[5] = 0x9b05688c;
  39359. hh[6] = 0x1f83d9ab;
  39360. hh[7] = 0x5be0cd19;
  39361. hl[0] = 0xf3bcc908;
  39362. hl[1] = 0x84caa73b;
  39363. hl[2] = 0xfe94f82b;
  39364. hl[3] = 0x5f1d36f1;
  39365. hl[4] = 0xade682d1;
  39366. hl[5] = 0x2b3e6c1f;
  39367. hl[6] = 0xfb41bd6b;
  39368. hl[7] = 0x137e2179;
  39369. crypto_hashblocks_hl(hh, hl, m, n);
  39370. n %= 128;
  39371. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39372. x[n] = 128;
  39373. n = 256-128*(n<112?1:0);
  39374. x[n-9] = 0;
  39375. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39376. crypto_hashblocks_hl(hh, hl, x, n);
  39377. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39378. return 0;
  39379. }
  39380. function add(p, q) {
  39381. var a = gf(), b = gf(), c = gf(),
  39382. d = gf(), e = gf(), f = gf(),
  39383. g = gf(), h = gf(), t = gf();
  39384. Z(a, p[1], p[0]);
  39385. Z(t, q[1], q[0]);
  39386. M(a, a, t);
  39387. A(b, p[0], p[1]);
  39388. A(t, q[0], q[1]);
  39389. M(b, b, t);
  39390. M(c, p[3], q[3]);
  39391. M(c, c, D2);
  39392. M(d, p[2], q[2]);
  39393. A(d, d, d);
  39394. Z(e, b, a);
  39395. Z(f, d, c);
  39396. A(g, d, c);
  39397. A(h, b, a);
  39398. M(p[0], e, f);
  39399. M(p[1], h, g);
  39400. M(p[2], g, f);
  39401. M(p[3], e, h);
  39402. }
  39403. function cswap(p, q, b) {
  39404. var i;
  39405. for (i = 0; i < 4; i++) {
  39406. sel25519(p[i], q[i], b);
  39407. }
  39408. }
  39409. function pack(r, p) {
  39410. var tx = gf(), ty = gf(), zi = gf();
  39411. inv25519(zi, p[2]);
  39412. M(tx, p[0], zi);
  39413. M(ty, p[1], zi);
  39414. pack25519(r, ty);
  39415. r[31] ^= par25519(tx) << 7;
  39416. }
  39417. function scalarmult(p, q, s) {
  39418. var b, i;
  39419. set25519(p[0], gf0);
  39420. set25519(p[1], gf1);
  39421. set25519(p[2], gf1);
  39422. set25519(p[3], gf0);
  39423. for (i = 255; i >= 0; --i) {
  39424. b = (s[(i/8)|0] >> (i&7)) & 1;
  39425. cswap(p, q, b);
  39426. add(q, p);
  39427. add(p, p);
  39428. cswap(p, q, b);
  39429. }
  39430. }
  39431. function scalarbase(p, s) {
  39432. var q = [gf(), gf(), gf(), gf()];
  39433. set25519(q[0], X);
  39434. set25519(q[1], Y);
  39435. set25519(q[2], gf1);
  39436. M(q[3], X, Y);
  39437. scalarmult(p, q, s);
  39438. }
  39439. function crypto_sign_keypair(pk, sk, seeded) {
  39440. var d = new Uint8Array(64);
  39441. var p = [gf(), gf(), gf(), gf()];
  39442. var i;
  39443. if (!seeded) randombytes(sk, 32);
  39444. crypto_hash(d, sk, 32);
  39445. d[0] &= 248;
  39446. d[31] &= 127;
  39447. d[31] |= 64;
  39448. scalarbase(p, d);
  39449. pack(pk, p);
  39450. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39451. return 0;
  39452. }
  39453. 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]);
  39454. function modL(r, x) {
  39455. var carry, i, j, k;
  39456. for (i = 63; i >= 32; --i) {
  39457. carry = 0;
  39458. for (j = i - 32, k = i - 12; j < k; ++j) {
  39459. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39460. carry = (x[j] + 128) >> 8;
  39461. x[j] -= carry * 256;
  39462. }
  39463. x[j] += carry;
  39464. x[i] = 0;
  39465. }
  39466. carry = 0;
  39467. for (j = 0; j < 32; j++) {
  39468. x[j] += carry - (x[31] >> 4) * L[j];
  39469. carry = x[j] >> 8;
  39470. x[j] &= 255;
  39471. }
  39472. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39473. for (i = 0; i < 32; i++) {
  39474. x[i+1] += x[i] >> 8;
  39475. r[i] = x[i] & 255;
  39476. }
  39477. }
  39478. function reduce(r) {
  39479. var x = new Float64Array(64), i;
  39480. for (i = 0; i < 64; i++) x[i] = r[i];
  39481. for (i = 0; i < 64; i++) r[i] = 0;
  39482. modL(r, x);
  39483. }
  39484. // Note: difference from C - smlen returned, not passed as argument.
  39485. function crypto_sign(sm, m, n, sk) {
  39486. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39487. var i, j, x = new Float64Array(64);
  39488. var p = [gf(), gf(), gf(), gf()];
  39489. crypto_hash(d, sk, 32);
  39490. d[0] &= 248;
  39491. d[31] &= 127;
  39492. d[31] |= 64;
  39493. var smlen = n + 64;
  39494. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39495. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39496. crypto_hash(r, sm.subarray(32), n+32);
  39497. reduce(r);
  39498. scalarbase(p, r);
  39499. pack(sm, p);
  39500. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39501. crypto_hash(h, sm, n + 64);
  39502. reduce(h);
  39503. for (i = 0; i < 64; i++) x[i] = 0;
  39504. for (i = 0; i < 32; i++) x[i] = r[i];
  39505. for (i = 0; i < 32; i++) {
  39506. for (j = 0; j < 32; j++) {
  39507. x[i+j] += h[i] * d[j];
  39508. }
  39509. }
  39510. modL(sm.subarray(32), x);
  39511. return smlen;
  39512. }
  39513. function unpackneg(r, p) {
  39514. var t = gf(), chk = gf(), num = gf(),
  39515. den = gf(), den2 = gf(), den4 = gf(),
  39516. den6 = gf();
  39517. set25519(r[2], gf1);
  39518. unpack25519(r[1], p);
  39519. S(num, r[1]);
  39520. M(den, num, D);
  39521. Z(num, num, r[2]);
  39522. A(den, r[2], den);
  39523. S(den2, den);
  39524. S(den4, den2);
  39525. M(den6, den4, den2);
  39526. M(t, den6, num);
  39527. M(t, t, den);
  39528. pow2523(t, t);
  39529. M(t, t, num);
  39530. M(t, t, den);
  39531. M(t, t, den);
  39532. M(r[0], t, den);
  39533. S(chk, r[0]);
  39534. M(chk, chk, den);
  39535. if (neq25519(chk, num)) M(r[0], r[0], I);
  39536. S(chk, r[0]);
  39537. M(chk, chk, den);
  39538. if (neq25519(chk, num)) return -1;
  39539. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39540. M(r[3], r[0], r[1]);
  39541. return 0;
  39542. }
  39543. function crypto_sign_open(m, sm, n, pk) {
  39544. var i, mlen;
  39545. var t = new Uint8Array(32), h = new Uint8Array(64);
  39546. var p = [gf(), gf(), gf(), gf()],
  39547. q = [gf(), gf(), gf(), gf()];
  39548. mlen = -1;
  39549. if (n < 64) return -1;
  39550. if (unpackneg(q, pk)) return -1;
  39551. for (i = 0; i < n; i++) m[i] = sm[i];
  39552. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39553. crypto_hash(h, m, n);
  39554. reduce(h);
  39555. scalarmult(p, q, h);
  39556. scalarbase(q, sm.subarray(32));
  39557. add(p, q);
  39558. pack(t, p);
  39559. n -= 64;
  39560. if (crypto_verify_32(sm, 0, t, 0)) {
  39561. for (i = 0; i < n; i++) m[i] = 0;
  39562. return -1;
  39563. }
  39564. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39565. mlen = n;
  39566. return mlen;
  39567. }
  39568. var crypto_secretbox_KEYBYTES = 32,
  39569. crypto_secretbox_NONCEBYTES = 24,
  39570. crypto_secretbox_ZEROBYTES = 32,
  39571. crypto_secretbox_BOXZEROBYTES = 16,
  39572. crypto_scalarmult_BYTES = 32,
  39573. crypto_scalarmult_SCALARBYTES = 32,
  39574. crypto_box_PUBLICKEYBYTES = 32,
  39575. crypto_box_SECRETKEYBYTES = 32,
  39576. crypto_box_BEFORENMBYTES = 32,
  39577. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39578. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39579. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39580. crypto_sign_BYTES = 64,
  39581. crypto_sign_PUBLICKEYBYTES = 32,
  39582. crypto_sign_SECRETKEYBYTES = 64,
  39583. crypto_sign_SEEDBYTES = 32,
  39584. crypto_hash_BYTES = 64;
  39585. nacl.lowlevel = {
  39586. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39587. crypto_stream_xor: crypto_stream_xor,
  39588. crypto_stream: crypto_stream,
  39589. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39590. crypto_stream_salsa20: crypto_stream_salsa20,
  39591. crypto_onetimeauth: crypto_onetimeauth,
  39592. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39593. crypto_verify_16: crypto_verify_16,
  39594. crypto_verify_32: crypto_verify_32,
  39595. crypto_secretbox: crypto_secretbox,
  39596. crypto_secretbox_open: crypto_secretbox_open,
  39597. crypto_scalarmult: crypto_scalarmult,
  39598. crypto_scalarmult_base: crypto_scalarmult_base,
  39599. crypto_box_beforenm: crypto_box_beforenm,
  39600. crypto_box_afternm: crypto_box_afternm,
  39601. crypto_box: crypto_box,
  39602. crypto_box_open: crypto_box_open,
  39603. crypto_box_keypair: crypto_box_keypair,
  39604. crypto_hash: crypto_hash,
  39605. crypto_sign: crypto_sign,
  39606. crypto_sign_keypair: crypto_sign_keypair,
  39607. crypto_sign_open: crypto_sign_open,
  39608. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39609. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39610. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39611. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39612. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39613. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39614. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39615. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39616. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39617. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39618. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39619. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39620. crypto_sign_BYTES: crypto_sign_BYTES,
  39621. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39622. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39623. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39624. crypto_hash_BYTES: crypto_hash_BYTES
  39625. };
  39626. /* High-level API */
  39627. function checkLengths(k, n) {
  39628. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39629. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39630. }
  39631. function checkBoxLengths(pk, sk) {
  39632. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39633. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39634. }
  39635. function checkArrayTypes() {
  39636. for (var i = 0; i < arguments.length; i++) {
  39637. if (!(arguments[i] instanceof Uint8Array))
  39638. throw new TypeError('unexpected type, use Uint8Array');
  39639. }
  39640. }
  39641. function cleanup(arr) {
  39642. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39643. }
  39644. nacl.randomBytes = function(n) {
  39645. var b = new Uint8Array(n);
  39646. randombytes(b, n);
  39647. return b;
  39648. };
  39649. nacl.secretbox = function(msg, nonce, key) {
  39650. checkArrayTypes(msg, nonce, key);
  39651. checkLengths(key, nonce);
  39652. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39653. var c = new Uint8Array(m.length);
  39654. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39655. crypto_secretbox(c, m, m.length, nonce, key);
  39656. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39657. };
  39658. nacl.secretbox.open = function(box, nonce, key) {
  39659. checkArrayTypes(box, nonce, key);
  39660. checkLengths(key, nonce);
  39661. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39662. var m = new Uint8Array(c.length);
  39663. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39664. if (c.length < 32) return null;
  39665. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39666. return m.subarray(crypto_secretbox_ZEROBYTES);
  39667. };
  39668. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39669. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39670. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39671. nacl.scalarMult = function(n, p) {
  39672. checkArrayTypes(n, p);
  39673. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39674. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39675. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39676. crypto_scalarmult(q, n, p);
  39677. return q;
  39678. };
  39679. nacl.scalarMult.base = function(n) {
  39680. checkArrayTypes(n);
  39681. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39682. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39683. crypto_scalarmult_base(q, n);
  39684. return q;
  39685. };
  39686. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39687. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39688. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39689. var k = nacl.box.before(publicKey, secretKey);
  39690. return nacl.secretbox(msg, nonce, k);
  39691. };
  39692. nacl.box.before = function(publicKey, secretKey) {
  39693. checkArrayTypes(publicKey, secretKey);
  39694. checkBoxLengths(publicKey, secretKey);
  39695. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39696. crypto_box_beforenm(k, publicKey, secretKey);
  39697. return k;
  39698. };
  39699. nacl.box.after = nacl.secretbox;
  39700. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39701. var k = nacl.box.before(publicKey, secretKey);
  39702. return nacl.secretbox.open(msg, nonce, k);
  39703. };
  39704. nacl.box.open.after = nacl.secretbox.open;
  39705. nacl.box.keyPair = function() {
  39706. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39707. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39708. crypto_box_keypair(pk, sk);
  39709. return {publicKey: pk, secretKey: sk};
  39710. };
  39711. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39712. checkArrayTypes(secretKey);
  39713. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39714. throw new Error('bad secret key size');
  39715. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39716. crypto_scalarmult_base(pk, secretKey);
  39717. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39718. };
  39719. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39720. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39721. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39722. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39723. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39724. nacl.sign = function(msg, secretKey) {
  39725. checkArrayTypes(msg, secretKey);
  39726. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39727. throw new Error('bad secret key size');
  39728. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39729. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39730. return signedMsg;
  39731. };
  39732. nacl.sign.open = function(signedMsg, publicKey) {
  39733. checkArrayTypes(signedMsg, publicKey);
  39734. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39735. throw new Error('bad public key size');
  39736. var tmp = new Uint8Array(signedMsg.length);
  39737. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39738. if (mlen < 0) return null;
  39739. var m = new Uint8Array(mlen);
  39740. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39741. return m;
  39742. };
  39743. nacl.sign.detached = function(msg, secretKey) {
  39744. var signedMsg = nacl.sign(msg, secretKey);
  39745. var sig = new Uint8Array(crypto_sign_BYTES);
  39746. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39747. return sig;
  39748. };
  39749. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39750. checkArrayTypes(msg, sig, publicKey);
  39751. if (sig.length !== crypto_sign_BYTES)
  39752. throw new Error('bad signature size');
  39753. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39754. throw new Error('bad public key size');
  39755. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39756. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39757. var i;
  39758. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39759. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39760. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39761. };
  39762. nacl.sign.keyPair = function() {
  39763. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39764. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39765. crypto_sign_keypair(pk, sk);
  39766. return {publicKey: pk, secretKey: sk};
  39767. };
  39768. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39769. checkArrayTypes(secretKey);
  39770. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39771. throw new Error('bad secret key size');
  39772. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39773. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39774. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39775. };
  39776. nacl.sign.keyPair.fromSeed = function(seed) {
  39777. checkArrayTypes(seed);
  39778. if (seed.length !== crypto_sign_SEEDBYTES)
  39779. throw new Error('bad seed size');
  39780. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39781. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39782. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39783. crypto_sign_keypair(pk, sk, true);
  39784. return {publicKey: pk, secretKey: sk};
  39785. };
  39786. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39787. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39788. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39789. nacl.sign.signatureLength = crypto_sign_BYTES;
  39790. nacl.hash = function(msg) {
  39791. checkArrayTypes(msg);
  39792. var h = new Uint8Array(crypto_hash_BYTES);
  39793. crypto_hash(h, msg, msg.length);
  39794. return h;
  39795. };
  39796. nacl.hash.hashLength = crypto_hash_BYTES;
  39797. nacl.verify = function(x, y) {
  39798. checkArrayTypes(x, y);
  39799. // Zero length arguments are considered not equal.
  39800. if (x.length === 0 || y.length === 0) return false;
  39801. if (x.length !== y.length) return false;
  39802. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39803. };
  39804. nacl.setPRNG = function(fn) {
  39805. randombytes = fn;
  39806. };
  39807. (function() {
  39808. // Initialize PRNG if environment provides CSPRNG.
  39809. // If not, methods calling randombytes will throw.
  39810. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39811. if (crypto && crypto.getRandomValues) {
  39812. // Browsers.
  39813. var QUOTA = 65536;
  39814. nacl.setPRNG(function(x, n) {
  39815. var i, v = new Uint8Array(n);
  39816. for (i = 0; i < n; i += QUOTA) {
  39817. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39818. }
  39819. for (i = 0; i < n; i++) x[i] = v[i];
  39820. cleanup(v);
  39821. });
  39822. } else if (true) {
  39823. // Node.js.
  39824. crypto = __webpack_require__(3);
  39825. if (crypto && crypto.randomBytes) {
  39826. nacl.setPRNG(function(x, n) {
  39827. var i, v = crypto.randomBytes(n);
  39828. for (i = 0; i < n; i++) x[i] = v[i];
  39829. cleanup(v);
  39830. });
  39831. }
  39832. }
  39833. })();
  39834. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39835. /***/ }),
  39836. /* 1 */
  39837. /***/ (function(module, exports, __webpack_require__) {
  39838. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39839. // Public domain.
  39840. (function(root, f) {
  39841. 'use strict';
  39842. if ( true && module.exports) module.exports = f();
  39843. else if (root.nacl) root.nacl.util = f();
  39844. else {
  39845. root.nacl = {};
  39846. root.nacl.util = f();
  39847. }
  39848. }(this, function() {
  39849. 'use strict';
  39850. var util = {};
  39851. function validateBase64(s) {
  39852. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39853. throw new TypeError('invalid encoding');
  39854. }
  39855. }
  39856. util.decodeUTF8 = function(s) {
  39857. if (typeof s !== 'string') throw new TypeError('expected string');
  39858. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39859. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39860. return b;
  39861. };
  39862. util.encodeUTF8 = function(arr) {
  39863. var i, s = [];
  39864. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39865. return decodeURIComponent(escape(s.join('')));
  39866. };
  39867. if (typeof atob === 'undefined') {
  39868. // Node.js
  39869. if (typeof Buffer.from !== 'undefined') {
  39870. // Node v6 and later
  39871. util.encodeBase64 = function (arr) { // v6 and later
  39872. return Buffer.from(arr).toString('base64');
  39873. };
  39874. util.decodeBase64 = function (s) {
  39875. validateBase64(s);
  39876. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39877. };
  39878. } else {
  39879. // Node earlier than v6
  39880. util.encodeBase64 = function (arr) { // v6 and later
  39881. return (new Buffer(arr)).toString('base64');
  39882. };
  39883. util.decodeBase64 = function(s) {
  39884. validateBase64(s);
  39885. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39886. };
  39887. }
  39888. } else {
  39889. // Browsers
  39890. util.encodeBase64 = function(arr) {
  39891. var i, s = [], len = arr.length;
  39892. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39893. return btoa(s.join(''));
  39894. };
  39895. util.decodeBase64 = function(s) {
  39896. validateBase64(s);
  39897. var i, d = atob(s), b = new Uint8Array(d.length);
  39898. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39899. return b;
  39900. };
  39901. }
  39902. return util;
  39903. }));
  39904. /***/ }),
  39905. /* 2 */
  39906. /***/ (function(module, exports, __webpack_require__) {
  39907. // required so we don't have to do require('pusher').default etc.
  39908. module.exports = __webpack_require__(4).default;
  39909. /***/ }),
  39910. /* 3 */
  39911. /***/ (function(module, exports) {
  39912. /* (ignored) */
  39913. /***/ }),
  39914. /* 4 */
  39915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39916. "use strict";
  39917. __webpack_require__.r(__webpack_exports__);
  39918. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39919. var ScriptReceiverFactory = (function () {
  39920. function ScriptReceiverFactory(prefix, name) {
  39921. this.lastId = 0;
  39922. this.prefix = prefix;
  39923. this.name = name;
  39924. }
  39925. ScriptReceiverFactory.prototype.create = function (callback) {
  39926. this.lastId++;
  39927. var number = this.lastId;
  39928. var id = this.prefix + number;
  39929. var name = this.name + "[" + number + "]";
  39930. var called = false;
  39931. var callbackWrapper = function () {
  39932. if (!called) {
  39933. callback.apply(null, arguments);
  39934. called = true;
  39935. }
  39936. };
  39937. this[number] = callbackWrapper;
  39938. return { number: number, id: id, name: name, callback: callbackWrapper };
  39939. };
  39940. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39941. delete this[receiver.number];
  39942. };
  39943. return ScriptReceiverFactory;
  39944. }());
  39945. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39946. // CONCATENATED MODULE: ./src/core/defaults.ts
  39947. var Defaults = {
  39948. VERSION: "5.0.3",
  39949. PROTOCOL: 7,
  39950. host: 'ws.pusherapp.com',
  39951. ws_port: 80,
  39952. wss_port: 443,
  39953. ws_path: '',
  39954. sockjs_host: 'sockjs.pusher.com',
  39955. sockjs_http_port: 80,
  39956. sockjs_https_port: 443,
  39957. sockjs_path: '/pusher',
  39958. stats_host: 'stats.pusher.com',
  39959. channel_auth_endpoint: '/pusher/auth',
  39960. channel_auth_transport: 'ajax',
  39961. activity_timeout: 120000,
  39962. pong_timeout: 30000,
  39963. unavailable_timeout: 10000,
  39964. cdn_http: "http://js.pusher.com",
  39965. cdn_https: "https://js.pusher.com",
  39966. dependency_suffix: ""
  39967. };
  39968. /* harmony default export */ var defaults = (Defaults);
  39969. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39970. var dependency_loader_DependencyLoader = (function () {
  39971. function DependencyLoader(options) {
  39972. this.options = options;
  39973. this.receivers = options.receivers || ScriptReceivers;
  39974. this.loading = {};
  39975. }
  39976. DependencyLoader.prototype.load = function (name, options, callback) {
  39977. var self = this;
  39978. if (self.loading[name] && self.loading[name].length > 0) {
  39979. self.loading[name].push(callback);
  39980. }
  39981. else {
  39982. self.loading[name] = [callback];
  39983. var request = runtime.createScriptRequest(self.getPath(name, options));
  39984. var receiver = self.receivers.create(function (error) {
  39985. self.receivers.remove(receiver);
  39986. if (self.loading[name]) {
  39987. var callbacks = self.loading[name];
  39988. delete self.loading[name];
  39989. var successCallback = function (wasSuccessful) {
  39990. if (!wasSuccessful) {
  39991. request.cleanup();
  39992. }
  39993. };
  39994. for (var i = 0; i < callbacks.length; i++) {
  39995. callbacks[i](error, successCallback);
  39996. }
  39997. }
  39998. });
  39999. request.send(receiver);
  40000. }
  40001. };
  40002. DependencyLoader.prototype.getRoot = function (options) {
  40003. var cdn;
  40004. var protocol = runtime.getDocument().location.protocol;
  40005. if ((options && options.useTLS) || protocol === "https:") {
  40006. cdn = this.options.cdn_https;
  40007. }
  40008. else {
  40009. cdn = this.options.cdn_http;
  40010. }
  40011. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40012. };
  40013. DependencyLoader.prototype.getPath = function (name, options) {
  40014. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40015. };
  40016. ;
  40017. return DependencyLoader;
  40018. }());
  40019. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40020. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40021. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40022. var Dependencies = new dependency_loader({
  40023. cdn_http: defaults.cdn_http,
  40024. cdn_https: defaults.cdn_https,
  40025. version: defaults.VERSION,
  40026. suffix: defaults.dependency_suffix,
  40027. receivers: DependenciesReceivers
  40028. });
  40029. // CONCATENATED MODULE: ./src/core/base64.ts
  40030. function encode(s) {
  40031. return btoa(utob(s));
  40032. }
  40033. var fromCharCode = String.fromCharCode;
  40034. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40035. var b64tab = {};
  40036. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40037. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40038. }
  40039. var cb_utob = function (c) {
  40040. var cc = c.charCodeAt(0);
  40041. return cc < 0x80
  40042. ? c
  40043. : cc < 0x800
  40044. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40045. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40046. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40047. fromCharCode(0x80 | (cc & 0x3f));
  40048. };
  40049. var utob = function (u) {
  40050. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40051. };
  40052. var cb_encode = function (ccc) {
  40053. var padlen = [0, 2, 1][ccc.length % 3];
  40054. var ord = (ccc.charCodeAt(0) << 16) |
  40055. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40056. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40057. var chars = [
  40058. b64chars.charAt(ord >>> 18),
  40059. b64chars.charAt((ord >>> 12) & 63),
  40060. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40061. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40062. ];
  40063. return chars.join('');
  40064. };
  40065. var btoa = window.btoa ||
  40066. function (b) {
  40067. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40068. };
  40069. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40070. var Timer = (function () {
  40071. function Timer(set, clear, delay, callback) {
  40072. var _this = this;
  40073. this.clear = clear;
  40074. this.timer = set(function () {
  40075. if (_this.timer) {
  40076. _this.timer = callback(_this.timer);
  40077. }
  40078. }, delay);
  40079. }
  40080. Timer.prototype.isRunning = function () {
  40081. return this.timer !== null;
  40082. };
  40083. Timer.prototype.ensureAborted = function () {
  40084. if (this.timer) {
  40085. this.clear(this.timer);
  40086. this.timer = null;
  40087. }
  40088. };
  40089. return Timer;
  40090. }());
  40091. /* harmony default export */ var abstract_timer = (Timer);
  40092. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40093. var __extends = (undefined && undefined.__extends) || (function () {
  40094. var extendStatics = function (d, b) {
  40095. extendStatics = Object.setPrototypeOf ||
  40096. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40097. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40098. return extendStatics(d, b);
  40099. };
  40100. return function (d, b) {
  40101. extendStatics(d, b);
  40102. function __() { this.constructor = d; }
  40103. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40104. };
  40105. })();
  40106. function timers_clearTimeout(timer) {
  40107. window.clearTimeout(timer);
  40108. }
  40109. function timers_clearInterval(timer) {
  40110. window.clearInterval(timer);
  40111. }
  40112. var OneOffTimer = (function (_super) {
  40113. __extends(OneOffTimer, _super);
  40114. function OneOffTimer(delay, callback) {
  40115. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40116. callback();
  40117. return null;
  40118. }) || this;
  40119. }
  40120. return OneOffTimer;
  40121. }(abstract_timer));
  40122. var PeriodicTimer = (function (_super) {
  40123. __extends(PeriodicTimer, _super);
  40124. function PeriodicTimer(delay, callback) {
  40125. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40126. callback();
  40127. return timer;
  40128. }) || this;
  40129. }
  40130. return PeriodicTimer;
  40131. }(abstract_timer));
  40132. // CONCATENATED MODULE: ./src/core/util.ts
  40133. var Util = {
  40134. now: function () {
  40135. if (Date.now) {
  40136. return Date.now();
  40137. }
  40138. else {
  40139. return new Date().valueOf();
  40140. }
  40141. },
  40142. defer: function (callback) {
  40143. return new OneOffTimer(0, callback);
  40144. },
  40145. method: function (name) {
  40146. var args = [];
  40147. for (var _i = 1; _i < arguments.length; _i++) {
  40148. args[_i - 1] = arguments[_i];
  40149. }
  40150. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40151. return function (object) {
  40152. return object[name].apply(object, boundArguments.concat(arguments));
  40153. };
  40154. }
  40155. };
  40156. /* harmony default export */ var util = (Util);
  40157. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40158. function extend(target) {
  40159. var sources = [];
  40160. for (var _i = 1; _i < arguments.length; _i++) {
  40161. sources[_i - 1] = arguments[_i];
  40162. }
  40163. for (var i = 0; i < sources.length; i++) {
  40164. var extensions = sources[i];
  40165. for (var property in extensions) {
  40166. if (extensions[property] && extensions[property].constructor &&
  40167. extensions[property].constructor === Object) {
  40168. target[property] = extend(target[property] || {}, extensions[property]);
  40169. }
  40170. else {
  40171. target[property] = extensions[property];
  40172. }
  40173. }
  40174. }
  40175. return target;
  40176. }
  40177. function stringify() {
  40178. var m = ["Pusher"];
  40179. for (var i = 0; i < arguments.length; i++) {
  40180. if (typeof arguments[i] === "string") {
  40181. m.push(arguments[i]);
  40182. }
  40183. else {
  40184. m.push(safeJSONStringify(arguments[i]));
  40185. }
  40186. }
  40187. return m.join(" : ");
  40188. }
  40189. function arrayIndexOf(array, item) {
  40190. var nativeIndexOf = Array.prototype.indexOf;
  40191. if (array === null) {
  40192. return -1;
  40193. }
  40194. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40195. return array.indexOf(item);
  40196. }
  40197. for (var i = 0, l = array.length; i < l; i++) {
  40198. if (array[i] === item) {
  40199. return i;
  40200. }
  40201. }
  40202. return -1;
  40203. }
  40204. function objectApply(object, f) {
  40205. for (var key in object) {
  40206. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40207. f(object[key], key, object);
  40208. }
  40209. }
  40210. }
  40211. function keys(object) {
  40212. var keys = [];
  40213. objectApply(object, function (_, key) {
  40214. keys.push(key);
  40215. });
  40216. return keys;
  40217. }
  40218. function values(object) {
  40219. var values = [];
  40220. objectApply(object, function (value) {
  40221. values.push(value);
  40222. });
  40223. return values;
  40224. }
  40225. function apply(array, f, context) {
  40226. for (var i = 0; i < array.length; i++) {
  40227. f.call(context || window, array[i], i, array);
  40228. }
  40229. }
  40230. function map(array, f) {
  40231. var result = [];
  40232. for (var i = 0; i < array.length; i++) {
  40233. result.push(f(array[i], i, array, result));
  40234. }
  40235. return result;
  40236. }
  40237. function mapObject(object, f) {
  40238. var result = {};
  40239. objectApply(object, function (value, key) {
  40240. result[key] = f(value);
  40241. });
  40242. return result;
  40243. }
  40244. function filter(array, test) {
  40245. test = test || function (value) { return !!value; };
  40246. var result = [];
  40247. for (var i = 0; i < array.length; i++) {
  40248. if (test(array[i], i, array, result)) {
  40249. result.push(array[i]);
  40250. }
  40251. }
  40252. return result;
  40253. }
  40254. function filterObject(object, test) {
  40255. var result = {};
  40256. objectApply(object, function (value, key) {
  40257. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40258. result[key] = value;
  40259. }
  40260. });
  40261. return result;
  40262. }
  40263. function flatten(object) {
  40264. var result = [];
  40265. objectApply(object, function (value, key) {
  40266. result.push([key, value]);
  40267. });
  40268. return result;
  40269. }
  40270. function any(array, test) {
  40271. for (var i = 0; i < array.length; i++) {
  40272. if (test(array[i], i, array)) {
  40273. return true;
  40274. }
  40275. }
  40276. return false;
  40277. }
  40278. function collections_all(array, test) {
  40279. for (var i = 0; i < array.length; i++) {
  40280. if (!test(array[i], i, array)) {
  40281. return false;
  40282. }
  40283. }
  40284. return true;
  40285. }
  40286. function encodeParamsObject(data) {
  40287. return mapObject(data, function (value) {
  40288. if (typeof value === "object") {
  40289. value = safeJSONStringify(value);
  40290. }
  40291. return encodeURIComponent(encode(value.toString()));
  40292. });
  40293. }
  40294. function buildQueryString(data) {
  40295. var params = filterObject(data, function (value) {
  40296. return value !== undefined;
  40297. });
  40298. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40299. return query;
  40300. }
  40301. function decycleObject(object) {
  40302. var objects = [], paths = [];
  40303. return (function derez(value, path) {
  40304. var i, name, nu;
  40305. switch (typeof value) {
  40306. case 'object':
  40307. if (!value) {
  40308. return null;
  40309. }
  40310. for (i = 0; i < objects.length; i += 1) {
  40311. if (objects[i] === value) {
  40312. return { $ref: paths[i] };
  40313. }
  40314. }
  40315. objects.push(value);
  40316. paths.push(path);
  40317. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40318. nu = [];
  40319. for (i = 0; i < value.length; i += 1) {
  40320. nu[i] = derez(value[i], path + '[' + i + ']');
  40321. }
  40322. }
  40323. else {
  40324. nu = {};
  40325. for (name in value) {
  40326. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40327. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40328. }
  40329. }
  40330. }
  40331. return nu;
  40332. case 'number':
  40333. case 'string':
  40334. case 'boolean':
  40335. return value;
  40336. }
  40337. }(object, '$'));
  40338. }
  40339. function safeJSONStringify(source) {
  40340. try {
  40341. return JSON.stringify(source);
  40342. }
  40343. catch (e) {
  40344. return JSON.stringify(decycleObject(source));
  40345. }
  40346. }
  40347. // CONCATENATED MODULE: ./src/core/logger.ts
  40348. var logger_Logger = (function () {
  40349. function Logger() {
  40350. this.globalLog = function (message) {
  40351. if (window.console && window.console.log) {
  40352. window.console.log(message);
  40353. }
  40354. };
  40355. }
  40356. Logger.prototype.debug = function () {
  40357. var args = [];
  40358. for (var _i = 0; _i < arguments.length; _i++) {
  40359. args[_i] = arguments[_i];
  40360. }
  40361. this.log(this.globalLog, args);
  40362. };
  40363. Logger.prototype.warn = function () {
  40364. var args = [];
  40365. for (var _i = 0; _i < arguments.length; _i++) {
  40366. args[_i] = arguments[_i];
  40367. }
  40368. this.log(this.globalLogWarn, args);
  40369. };
  40370. Logger.prototype.error = function () {
  40371. var args = [];
  40372. for (var _i = 0; _i < arguments.length; _i++) {
  40373. args[_i] = arguments[_i];
  40374. }
  40375. this.log(this.globalLogError, args);
  40376. };
  40377. Logger.prototype.globalLogWarn = function (message) {
  40378. if (window.console && window.console.warn) {
  40379. window.console.warn(message);
  40380. }
  40381. else {
  40382. this.globalLog(message);
  40383. }
  40384. };
  40385. Logger.prototype.globalLogError = function (message) {
  40386. if (window.console && window.console.error) {
  40387. window.console.error(message);
  40388. }
  40389. else {
  40390. this.globalLogWarn(message);
  40391. }
  40392. };
  40393. Logger.prototype.log = function (defaultLoggingFunction) {
  40394. var args = [];
  40395. for (var _i = 1; _i < arguments.length; _i++) {
  40396. args[_i - 1] = arguments[_i];
  40397. }
  40398. var message = stringify.apply(this, arguments);
  40399. if (core_pusher.log) {
  40400. core_pusher.log(message);
  40401. }
  40402. else if (core_pusher.logToConsole) {
  40403. var log = defaultLoggingFunction.bind(this);
  40404. log(message);
  40405. }
  40406. };
  40407. return Logger;
  40408. }());
  40409. /* harmony default export */ var logger = (new logger_Logger());
  40410. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40411. var urlStore = {
  40412. baseUrl: "https://pusher.com",
  40413. urls: {
  40414. authenticationEndpoint: {
  40415. path: "/docs/authenticating_users",
  40416. },
  40417. javascriptQuickStart: {
  40418. path: "/docs/javascript_quick_start"
  40419. },
  40420. triggeringClientEvents: {
  40421. path: "/docs/client_api_guide/client_events#trigger-events"
  40422. }
  40423. }
  40424. };
  40425. var buildLogSuffix = function (key) {
  40426. var urlPrefix = "See:";
  40427. var urlObj = urlStore.urls[key];
  40428. if (!urlObj)
  40429. return "";
  40430. var url;
  40431. if (urlObj.fullUrl) {
  40432. url = urlObj.fullUrl;
  40433. }
  40434. else if (urlObj.path) {
  40435. url = urlStore.baseUrl + urlObj.path;
  40436. }
  40437. if (!url)
  40438. return "";
  40439. return urlPrefix + " " + url;
  40440. };
  40441. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40442. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40443. var ajax = function (context, socketId, callback) {
  40444. var self = this, xhr;
  40445. xhr = runtime.createXHR();
  40446. xhr.open("POST", self.options.authEndpoint, true);
  40447. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40448. for (var headerName in this.authOptions.headers) {
  40449. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40450. }
  40451. xhr.onreadystatechange = function () {
  40452. if (xhr.readyState === 4) {
  40453. if (xhr.status === 200) {
  40454. var data, parsed = false;
  40455. try {
  40456. data = JSON.parse(xhr.responseText);
  40457. parsed = true;
  40458. }
  40459. catch (e) {
  40460. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40461. }
  40462. if (parsed) {
  40463. callback(false, data);
  40464. }
  40465. }
  40466. else {
  40467. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40468. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40469. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40470. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40471. callback(true, xhr.status);
  40472. }
  40473. }
  40474. };
  40475. xhr.send(this.composeQuery(socketId));
  40476. return xhr;
  40477. };
  40478. /* harmony default export */ var xhr_auth = (ajax);
  40479. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40480. var jsonp = function (context, socketId, callback) {
  40481. if (this.authOptions.headers !== undefined) {
  40482. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40483. }
  40484. var callbackName = context.nextAuthCallbackID.toString();
  40485. context.nextAuthCallbackID++;
  40486. var document = context.getDocument();
  40487. var script = document.createElement("script");
  40488. context.auth_callbacks[callbackName] = function (data) {
  40489. callback(false, data);
  40490. };
  40491. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40492. script.src = this.options.authEndpoint +
  40493. '?callback=' +
  40494. encodeURIComponent(callback_name) +
  40495. '&' +
  40496. this.composeQuery(socketId);
  40497. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40498. head.insertBefore(script, head.firstChild);
  40499. };
  40500. /* harmony default export */ var jsonp_auth = (jsonp);
  40501. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40502. var ScriptRequest = (function () {
  40503. function ScriptRequest(src) {
  40504. this.src = src;
  40505. }
  40506. ScriptRequest.prototype.send = function (receiver) {
  40507. var self = this;
  40508. var errorString = "Error loading " + self.src;
  40509. self.script = document.createElement("script");
  40510. self.script.id = receiver.id;
  40511. self.script.src = self.src;
  40512. self.script.type = "text/javascript";
  40513. self.script.charset = "UTF-8";
  40514. if (self.script.addEventListener) {
  40515. self.script.onerror = function () {
  40516. receiver.callback(errorString);
  40517. };
  40518. self.script.onload = function () {
  40519. receiver.callback(null);
  40520. };
  40521. }
  40522. else {
  40523. self.script.onreadystatechange = function () {
  40524. if (self.script.readyState === 'loaded' ||
  40525. self.script.readyState === 'complete') {
  40526. receiver.callback(null);
  40527. }
  40528. };
  40529. }
  40530. if (self.script.async === undefined && document.attachEvent &&
  40531. /opera/i.test(navigator.userAgent)) {
  40532. self.errorScript = document.createElement("script");
  40533. self.errorScript.id = receiver.id + "_error";
  40534. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40535. self.script.async = self.errorScript.async = false;
  40536. }
  40537. else {
  40538. self.script.async = true;
  40539. }
  40540. var head = document.getElementsByTagName('head')[0];
  40541. head.insertBefore(self.script, head.firstChild);
  40542. if (self.errorScript) {
  40543. head.insertBefore(self.errorScript, self.script.nextSibling);
  40544. }
  40545. };
  40546. ScriptRequest.prototype.cleanup = function () {
  40547. if (this.script) {
  40548. this.script.onload = this.script.onerror = null;
  40549. this.script.onreadystatechange = null;
  40550. }
  40551. if (this.script && this.script.parentNode) {
  40552. this.script.parentNode.removeChild(this.script);
  40553. }
  40554. if (this.errorScript && this.errorScript.parentNode) {
  40555. this.errorScript.parentNode.removeChild(this.errorScript);
  40556. }
  40557. this.script = null;
  40558. this.errorScript = null;
  40559. };
  40560. return ScriptRequest;
  40561. }());
  40562. /* harmony default export */ var script_request = (ScriptRequest);
  40563. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40564. var jsonp_request_JSONPRequest = (function () {
  40565. function JSONPRequest(url, data) {
  40566. this.url = url;
  40567. this.data = data;
  40568. }
  40569. JSONPRequest.prototype.send = function (receiver) {
  40570. if (this.request) {
  40571. return;
  40572. }
  40573. var query = buildQueryString(this.data);
  40574. var url = this.url + "/" + receiver.number + "?" + query;
  40575. this.request = runtime.createScriptRequest(url);
  40576. this.request.send(receiver);
  40577. };
  40578. JSONPRequest.prototype.cleanup = function () {
  40579. if (this.request) {
  40580. this.request.cleanup();
  40581. }
  40582. };
  40583. return JSONPRequest;
  40584. }());
  40585. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40586. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40587. var getAgent = function (sender, useTLS) {
  40588. return function (data, callback) {
  40589. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40590. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40591. var request = runtime.createJSONPRequest(url, data);
  40592. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40593. ScriptReceivers.remove(receiver);
  40594. request.cleanup();
  40595. if (result && result.host) {
  40596. sender.host = result.host;
  40597. }
  40598. if (callback) {
  40599. callback(error, result);
  40600. }
  40601. });
  40602. request.send(receiver);
  40603. };
  40604. };
  40605. var jsonp_timeline_jsonp = {
  40606. name: 'jsonp',
  40607. getAgent: getAgent
  40608. };
  40609. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40610. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40611. function getGenericURL(baseScheme, params, path) {
  40612. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40613. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40614. return scheme + "://" + host + path;
  40615. }
  40616. function getGenericPath(key, queryString) {
  40617. var path = "/app/" + key;
  40618. var query = "?protocol=" + defaults.PROTOCOL +
  40619. "&client=js" +
  40620. "&version=" + defaults.VERSION +
  40621. (queryString ? ("&" + queryString) : "");
  40622. return path + query;
  40623. }
  40624. var ws = {
  40625. getInitial: function (key, params) {
  40626. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40627. return getGenericURL("ws", params, path);
  40628. }
  40629. };
  40630. var http = {
  40631. getInitial: function (key, params) {
  40632. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40633. return getGenericURL("http", params, path);
  40634. }
  40635. };
  40636. var sockjs = {
  40637. getInitial: function (key, params) {
  40638. return getGenericURL("http", params, params.httpPath || "/pusher");
  40639. },
  40640. getPath: function (key, params) {
  40641. return getGenericPath(key);
  40642. }
  40643. };
  40644. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40645. var callback_registry_CallbackRegistry = (function () {
  40646. function CallbackRegistry() {
  40647. this._callbacks = {};
  40648. }
  40649. CallbackRegistry.prototype.get = function (name) {
  40650. return this._callbacks[prefix(name)];
  40651. };
  40652. CallbackRegistry.prototype.add = function (name, callback, context) {
  40653. var prefixedEventName = prefix(name);
  40654. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40655. this._callbacks[prefixedEventName].push({
  40656. fn: callback,
  40657. context: context
  40658. });
  40659. };
  40660. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40661. if (!name && !callback && !context) {
  40662. this._callbacks = {};
  40663. return;
  40664. }
  40665. var names = name ? [prefix(name)] : keys(this._callbacks);
  40666. if (callback || context) {
  40667. this.removeCallback(names, callback, context);
  40668. }
  40669. else {
  40670. this.removeAllCallbacks(names);
  40671. }
  40672. };
  40673. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40674. apply(names, function (name) {
  40675. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40676. return (callback && callback !== binding.fn) ||
  40677. (context && context !== binding.context);
  40678. });
  40679. if (this._callbacks[name].length === 0) {
  40680. delete this._callbacks[name];
  40681. }
  40682. }, this);
  40683. };
  40684. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40685. apply(names, function (name) {
  40686. delete this._callbacks[name];
  40687. }, this);
  40688. };
  40689. return CallbackRegistry;
  40690. }());
  40691. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40692. function prefix(name) {
  40693. return "_" + name;
  40694. }
  40695. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40696. var dispatcher_Dispatcher = (function () {
  40697. function Dispatcher(failThrough) {
  40698. this.callbacks = new callback_registry();
  40699. this.global_callbacks = [];
  40700. this.failThrough = failThrough;
  40701. }
  40702. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40703. this.callbacks.add(eventName, callback, context);
  40704. return this;
  40705. };
  40706. Dispatcher.prototype.bind_global = function (callback) {
  40707. this.global_callbacks.push(callback);
  40708. return this;
  40709. };
  40710. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40711. this.callbacks.remove(eventName, callback, context);
  40712. return this;
  40713. };
  40714. Dispatcher.prototype.unbind_global = function (callback) {
  40715. if (!callback) {
  40716. this.global_callbacks = [];
  40717. return this;
  40718. }
  40719. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40720. return this;
  40721. };
  40722. Dispatcher.prototype.unbind_all = function () {
  40723. this.unbind();
  40724. this.unbind_global();
  40725. return this;
  40726. };
  40727. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40728. for (var i = 0; i < this.global_callbacks.length; i++) {
  40729. this.global_callbacks[i](eventName, data);
  40730. }
  40731. var callbacks = this.callbacks.get(eventName);
  40732. var args = [];
  40733. if (metadata) {
  40734. args.push(data, metadata);
  40735. }
  40736. else if (data) {
  40737. args.push(data);
  40738. }
  40739. if (callbacks && callbacks.length > 0) {
  40740. for (var i = 0; i < callbacks.length; i++) {
  40741. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40742. }
  40743. }
  40744. else if (this.failThrough) {
  40745. this.failThrough(eventName, data);
  40746. }
  40747. return this;
  40748. };
  40749. return Dispatcher;
  40750. }());
  40751. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40752. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40753. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40754. var extendStatics = function (d, b) {
  40755. extendStatics = Object.setPrototypeOf ||
  40756. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40757. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40758. return extendStatics(d, b);
  40759. };
  40760. return function (d, b) {
  40761. extendStatics(d, b);
  40762. function __() { this.constructor = d; }
  40763. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40764. };
  40765. })();
  40766. var transport_connection_TransportConnection = (function (_super) {
  40767. transport_connection_extends(TransportConnection, _super);
  40768. function TransportConnection(hooks, name, priority, key, options) {
  40769. var _this = _super.call(this) || this;
  40770. _this.initialize = runtime.transportConnectionInitializer;
  40771. _this.hooks = hooks;
  40772. _this.name = name;
  40773. _this.priority = priority;
  40774. _this.key = key;
  40775. _this.options = options;
  40776. _this.state = "new";
  40777. _this.timeline = options.timeline;
  40778. _this.activityTimeout = options.activityTimeout;
  40779. _this.id = _this.timeline.generateUniqueID();
  40780. return _this;
  40781. }
  40782. TransportConnection.prototype.handlesActivityChecks = function () {
  40783. return Boolean(this.hooks.handlesActivityChecks);
  40784. };
  40785. TransportConnection.prototype.supportsPing = function () {
  40786. return Boolean(this.hooks.supportsPing);
  40787. };
  40788. TransportConnection.prototype.connect = function () {
  40789. var _this = this;
  40790. if (this.socket || this.state !== "initialized") {
  40791. return false;
  40792. }
  40793. var url = this.hooks.urls.getInitial(this.key, this.options);
  40794. try {
  40795. this.socket = this.hooks.getSocket(url, this.options);
  40796. }
  40797. catch (e) {
  40798. util.defer(function () {
  40799. _this.onError(e);
  40800. _this.changeState("closed");
  40801. });
  40802. return false;
  40803. }
  40804. this.bindListeners();
  40805. logger.debug("Connecting", { transport: this.name, url: url });
  40806. this.changeState("connecting");
  40807. return true;
  40808. };
  40809. TransportConnection.prototype.close = function () {
  40810. if (this.socket) {
  40811. this.socket.close();
  40812. return true;
  40813. }
  40814. else {
  40815. return false;
  40816. }
  40817. };
  40818. TransportConnection.prototype.send = function (data) {
  40819. var _this = this;
  40820. if (this.state === "open") {
  40821. util.defer(function () {
  40822. if (_this.socket) {
  40823. _this.socket.send(data);
  40824. }
  40825. });
  40826. return true;
  40827. }
  40828. else {
  40829. return false;
  40830. }
  40831. };
  40832. TransportConnection.prototype.ping = function () {
  40833. if (this.state === "open" && this.supportsPing()) {
  40834. this.socket.ping();
  40835. }
  40836. };
  40837. TransportConnection.prototype.onOpen = function () {
  40838. if (this.hooks.beforeOpen) {
  40839. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40840. }
  40841. this.changeState("open");
  40842. this.socket.onopen = undefined;
  40843. };
  40844. TransportConnection.prototype.onError = function (error) {
  40845. this.emit("error", { type: 'WebSocketError', error: error });
  40846. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40847. };
  40848. TransportConnection.prototype.onClose = function (closeEvent) {
  40849. if (closeEvent) {
  40850. this.changeState("closed", {
  40851. code: closeEvent.code,
  40852. reason: closeEvent.reason,
  40853. wasClean: closeEvent.wasClean
  40854. });
  40855. }
  40856. else {
  40857. this.changeState("closed");
  40858. }
  40859. this.unbindListeners();
  40860. this.socket = undefined;
  40861. };
  40862. TransportConnection.prototype.onMessage = function (message) {
  40863. this.emit("message", message);
  40864. };
  40865. TransportConnection.prototype.onActivity = function () {
  40866. this.emit("activity");
  40867. };
  40868. TransportConnection.prototype.bindListeners = function () {
  40869. var _this = this;
  40870. this.socket.onopen = function () {
  40871. _this.onOpen();
  40872. };
  40873. this.socket.onerror = function (error) {
  40874. _this.onError(error);
  40875. };
  40876. this.socket.onclose = function (closeEvent) {
  40877. _this.onClose(closeEvent);
  40878. };
  40879. this.socket.onmessage = function (message) {
  40880. _this.onMessage(message);
  40881. };
  40882. if (this.supportsPing()) {
  40883. this.socket.onactivity = function () { _this.onActivity(); };
  40884. }
  40885. };
  40886. TransportConnection.prototype.unbindListeners = function () {
  40887. if (this.socket) {
  40888. this.socket.onopen = undefined;
  40889. this.socket.onerror = undefined;
  40890. this.socket.onclose = undefined;
  40891. this.socket.onmessage = undefined;
  40892. if (this.supportsPing()) {
  40893. this.socket.onactivity = undefined;
  40894. }
  40895. }
  40896. };
  40897. TransportConnection.prototype.changeState = function (state, params) {
  40898. this.state = state;
  40899. this.timeline.info(this.buildTimelineMessage({
  40900. state: state,
  40901. params: params
  40902. }));
  40903. this.emit(state, params);
  40904. };
  40905. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40906. return extend({ cid: this.id }, message);
  40907. };
  40908. return TransportConnection;
  40909. }(dispatcher));
  40910. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40911. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40912. var transport_Transport = (function () {
  40913. function Transport(hooks) {
  40914. this.hooks = hooks;
  40915. }
  40916. Transport.prototype.isSupported = function (environment) {
  40917. return this.hooks.isSupported(environment);
  40918. };
  40919. Transport.prototype.createConnection = function (name, priority, key, options) {
  40920. return new transport_connection(this.hooks, name, priority, key, options);
  40921. };
  40922. return Transport;
  40923. }());
  40924. /* harmony default export */ var transports_transport = (transport_Transport);
  40925. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40926. var WSTransport = new transports_transport({
  40927. urls: ws,
  40928. handlesActivityChecks: false,
  40929. supportsPing: false,
  40930. isInitialized: function () {
  40931. return Boolean(runtime.getWebSocketAPI());
  40932. },
  40933. isSupported: function () {
  40934. return Boolean(runtime.getWebSocketAPI());
  40935. },
  40936. getSocket: function (url) {
  40937. return runtime.createWebSocket(url);
  40938. }
  40939. });
  40940. var httpConfiguration = {
  40941. urls: http,
  40942. handlesActivityChecks: false,
  40943. supportsPing: true,
  40944. isInitialized: function () {
  40945. return true;
  40946. }
  40947. };
  40948. var streamingConfiguration = extend({ getSocket: function (url) {
  40949. return runtime.HTTPFactory.createStreamingSocket(url);
  40950. }
  40951. }, httpConfiguration);
  40952. var pollingConfiguration = extend({ getSocket: function (url) {
  40953. return runtime.HTTPFactory.createPollingSocket(url);
  40954. }
  40955. }, httpConfiguration);
  40956. var xhrConfiguration = {
  40957. isSupported: function () {
  40958. return runtime.isXHRSupported();
  40959. }
  40960. };
  40961. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40962. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40963. var Transports = {
  40964. ws: WSTransport,
  40965. xhr_streaming: XHRStreamingTransport,
  40966. xhr_polling: XHRPollingTransport
  40967. };
  40968. /* harmony default export */ var transports = (Transports);
  40969. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40970. var SockJSTransport = new transports_transport({
  40971. file: "sockjs",
  40972. urls: sockjs,
  40973. handlesActivityChecks: true,
  40974. supportsPing: false,
  40975. isSupported: function () {
  40976. return true;
  40977. },
  40978. isInitialized: function () {
  40979. return window.SockJS !== undefined;
  40980. },
  40981. getSocket: function (url, options) {
  40982. return new window.SockJS(url, null, {
  40983. js_path: Dependencies.getPath("sockjs", {
  40984. useTLS: options.useTLS
  40985. }),
  40986. ignore_null_origin: options.ignoreNullOrigin
  40987. });
  40988. },
  40989. beforeOpen: function (socket, path) {
  40990. socket.send(JSON.stringify({
  40991. path: path
  40992. }));
  40993. }
  40994. });
  40995. var xdrConfiguration = {
  40996. isSupported: function (environment) {
  40997. var yes = runtime.isXDRSupported(environment.useTLS);
  40998. return yes;
  40999. }
  41000. };
  41001. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41002. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41003. transports.xdr_streaming = XDRStreamingTransport;
  41004. transports.xdr_polling = XDRPollingTransport;
  41005. transports.sockjs = SockJSTransport;
  41006. /* harmony default export */ var transports_transports = (transports);
  41007. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41008. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41009. var extendStatics = function (d, b) {
  41010. extendStatics = Object.setPrototypeOf ||
  41011. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41012. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41013. return extendStatics(d, b);
  41014. };
  41015. return function (d, b) {
  41016. extendStatics(d, b);
  41017. function __() { this.constructor = d; }
  41018. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41019. };
  41020. })();
  41021. var NetInfo = (function (_super) {
  41022. net_info_extends(NetInfo, _super);
  41023. function NetInfo() {
  41024. var _this = _super.call(this) || this;
  41025. var self = _this;
  41026. if (window.addEventListener !== undefined) {
  41027. window.addEventListener("online", function () {
  41028. self.emit('online');
  41029. }, false);
  41030. window.addEventListener("offline", function () {
  41031. self.emit('offline');
  41032. }, false);
  41033. }
  41034. return _this;
  41035. }
  41036. NetInfo.prototype.isOnline = function () {
  41037. if (window.navigator.onLine === undefined) {
  41038. return true;
  41039. }
  41040. else {
  41041. return window.navigator.onLine;
  41042. }
  41043. };
  41044. return NetInfo;
  41045. }(dispatcher));
  41046. var net_info_Network = new NetInfo();
  41047. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41048. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41049. function AssistantToTheTransportManager(manager, transport, options) {
  41050. this.manager = manager;
  41051. this.transport = transport;
  41052. this.minPingDelay = options.minPingDelay;
  41053. this.maxPingDelay = options.maxPingDelay;
  41054. this.pingDelay = undefined;
  41055. }
  41056. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41057. var _this = this;
  41058. options = extend({}, options, {
  41059. activityTimeout: this.pingDelay
  41060. });
  41061. var connection = this.transport.createConnection(name, priority, key, options);
  41062. var openTimestamp = null;
  41063. var onOpen = function () {
  41064. connection.unbind("open", onOpen);
  41065. connection.bind("closed", onClosed);
  41066. openTimestamp = util.now();
  41067. };
  41068. var onClosed = function (closeEvent) {
  41069. connection.unbind("closed", onClosed);
  41070. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41071. _this.manager.reportDeath();
  41072. }
  41073. else if (!closeEvent.wasClean && openTimestamp) {
  41074. var lifespan = util.now() - openTimestamp;
  41075. if (lifespan < 2 * _this.maxPingDelay) {
  41076. _this.manager.reportDeath();
  41077. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41078. }
  41079. }
  41080. };
  41081. connection.bind("open", onOpen);
  41082. return connection;
  41083. };
  41084. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41085. return this.manager.isAlive() && this.transport.isSupported(environment);
  41086. };
  41087. return AssistantToTheTransportManager;
  41088. }());
  41089. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41090. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41091. var Protocol = {
  41092. decodeMessage: function (messageEvent) {
  41093. try {
  41094. var messageData = JSON.parse(messageEvent.data);
  41095. var pusherEventData = messageData.data;
  41096. if (typeof pusherEventData === 'string') {
  41097. try {
  41098. pusherEventData = JSON.parse(messageData.data);
  41099. }
  41100. catch (e) { }
  41101. }
  41102. var pusherEvent = {
  41103. event: messageData.event,
  41104. channel: messageData.channel,
  41105. data: pusherEventData,
  41106. };
  41107. if (messageData.user_id) {
  41108. pusherEvent.user_id = messageData.user_id;
  41109. }
  41110. return pusherEvent;
  41111. }
  41112. catch (e) {
  41113. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41114. }
  41115. },
  41116. encodeMessage: function (event) {
  41117. return JSON.stringify(event);
  41118. },
  41119. processHandshake: function (messageEvent) {
  41120. var message = Protocol.decodeMessage(messageEvent);
  41121. if (message.event === "pusher:connection_established") {
  41122. if (!message.data.activity_timeout) {
  41123. throw "No activity timeout specified in handshake";
  41124. }
  41125. return {
  41126. action: "connected",
  41127. id: message.data.socket_id,
  41128. activityTimeout: message.data.activity_timeout * 1000
  41129. };
  41130. }
  41131. else if (message.event === "pusher:error") {
  41132. return {
  41133. action: this.getCloseAction(message.data),
  41134. error: this.getCloseError(message.data)
  41135. };
  41136. }
  41137. else {
  41138. throw "Invalid handshake";
  41139. }
  41140. },
  41141. getCloseAction: function (closeEvent) {
  41142. if (closeEvent.code < 4000) {
  41143. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41144. return "backoff";
  41145. }
  41146. else {
  41147. return null;
  41148. }
  41149. }
  41150. else if (closeEvent.code === 4000) {
  41151. return "tls_only";
  41152. }
  41153. else if (closeEvent.code < 4100) {
  41154. return "refused";
  41155. }
  41156. else if (closeEvent.code < 4200) {
  41157. return "backoff";
  41158. }
  41159. else if (closeEvent.code < 4300) {
  41160. return "retry";
  41161. }
  41162. else {
  41163. return "refused";
  41164. }
  41165. },
  41166. getCloseError: function (closeEvent) {
  41167. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41168. return {
  41169. type: 'PusherError',
  41170. data: {
  41171. code: closeEvent.code,
  41172. message: closeEvent.reason || closeEvent.message
  41173. }
  41174. };
  41175. }
  41176. else {
  41177. return null;
  41178. }
  41179. }
  41180. };
  41181. /* harmony default export */ var protocol_protocol = (Protocol);
  41182. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41183. var connection_extends = (undefined && undefined.__extends) || (function () {
  41184. var extendStatics = function (d, b) {
  41185. extendStatics = Object.setPrototypeOf ||
  41186. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41187. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41188. return extendStatics(d, b);
  41189. };
  41190. return function (d, b) {
  41191. extendStatics(d, b);
  41192. function __() { this.constructor = d; }
  41193. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41194. };
  41195. })();
  41196. var connection_Connection = (function (_super) {
  41197. connection_extends(Connection, _super);
  41198. function Connection(id, transport) {
  41199. var _this = _super.call(this) || this;
  41200. _this.id = id;
  41201. _this.transport = transport;
  41202. _this.activityTimeout = transport.activityTimeout;
  41203. _this.bindListeners();
  41204. return _this;
  41205. }
  41206. Connection.prototype.handlesActivityChecks = function () {
  41207. return this.transport.handlesActivityChecks();
  41208. };
  41209. Connection.prototype.send = function (data) {
  41210. return this.transport.send(data);
  41211. };
  41212. Connection.prototype.send_event = function (name, data, channel) {
  41213. var event = { event: name, data: data };
  41214. if (channel) {
  41215. event.channel = channel;
  41216. }
  41217. logger.debug('Event sent', event);
  41218. return this.send(protocol_protocol.encodeMessage(event));
  41219. };
  41220. Connection.prototype.ping = function () {
  41221. if (this.transport.supportsPing()) {
  41222. this.transport.ping();
  41223. }
  41224. else {
  41225. this.send_event('pusher:ping', {});
  41226. }
  41227. };
  41228. Connection.prototype.close = function () {
  41229. this.transport.close();
  41230. };
  41231. Connection.prototype.bindListeners = function () {
  41232. var _this = this;
  41233. var listeners = {
  41234. message: function (messageEvent) {
  41235. var pusherEvent;
  41236. try {
  41237. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41238. }
  41239. catch (e) {
  41240. _this.emit('error', {
  41241. type: 'MessageParseError',
  41242. error: e,
  41243. data: messageEvent.data
  41244. });
  41245. }
  41246. if (pusherEvent !== undefined) {
  41247. logger.debug('Event recd', pusherEvent);
  41248. switch (pusherEvent.event) {
  41249. case 'pusher:error':
  41250. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41251. break;
  41252. case 'pusher:ping':
  41253. _this.emit("ping");
  41254. break;
  41255. case 'pusher:pong':
  41256. _this.emit("pong");
  41257. break;
  41258. }
  41259. _this.emit('message', pusherEvent);
  41260. }
  41261. },
  41262. activity: function () {
  41263. _this.emit("activity");
  41264. },
  41265. error: function (error) {
  41266. _this.emit("error", { type: "WebSocketError", error: error });
  41267. },
  41268. closed: function (closeEvent) {
  41269. unbindListeners();
  41270. if (closeEvent && closeEvent.code) {
  41271. _this.handleCloseEvent(closeEvent);
  41272. }
  41273. _this.transport = null;
  41274. _this.emit("closed");
  41275. }
  41276. };
  41277. var unbindListeners = function () {
  41278. objectApply(listeners, function (listener, event) {
  41279. _this.transport.unbind(event, listener);
  41280. });
  41281. };
  41282. objectApply(listeners, function (listener, event) {
  41283. _this.transport.bind(event, listener);
  41284. });
  41285. };
  41286. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41287. var action = protocol_protocol.getCloseAction(closeEvent);
  41288. var error = protocol_protocol.getCloseError(closeEvent);
  41289. if (error) {
  41290. this.emit('error', error);
  41291. }
  41292. if (action) {
  41293. this.emit(action, { action: action, error: error });
  41294. }
  41295. };
  41296. return Connection;
  41297. }(dispatcher));
  41298. /* harmony default export */ var connection_connection = (connection_Connection);
  41299. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41300. var handshake_Handshake = (function () {
  41301. function Handshake(transport, callback) {
  41302. this.transport = transport;
  41303. this.callback = callback;
  41304. this.bindListeners();
  41305. }
  41306. Handshake.prototype.close = function () {
  41307. this.unbindListeners();
  41308. this.transport.close();
  41309. };
  41310. Handshake.prototype.bindListeners = function () {
  41311. var _this = this;
  41312. this.onMessage = function (m) {
  41313. _this.unbindListeners();
  41314. var result;
  41315. try {
  41316. result = protocol_protocol.processHandshake(m);
  41317. }
  41318. catch (e) {
  41319. _this.finish("error", { error: e });
  41320. _this.transport.close();
  41321. return;
  41322. }
  41323. if (result.action === "connected") {
  41324. _this.finish("connected", {
  41325. connection: new connection_connection(result.id, _this.transport),
  41326. activityTimeout: result.activityTimeout
  41327. });
  41328. }
  41329. else {
  41330. _this.finish(result.action, { error: result.error });
  41331. _this.transport.close();
  41332. }
  41333. };
  41334. this.onClosed = function (closeEvent) {
  41335. _this.unbindListeners();
  41336. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41337. var error = protocol_protocol.getCloseError(closeEvent);
  41338. _this.finish(action, { error: error });
  41339. };
  41340. this.transport.bind("message", this.onMessage);
  41341. this.transport.bind("closed", this.onClosed);
  41342. };
  41343. Handshake.prototype.unbindListeners = function () {
  41344. this.transport.unbind("message", this.onMessage);
  41345. this.transport.unbind("closed", this.onClosed);
  41346. };
  41347. Handshake.prototype.finish = function (action, params) {
  41348. this.callback(extend({ transport: this.transport, action: action }, params));
  41349. };
  41350. return Handshake;
  41351. }());
  41352. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41353. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41354. var pusher_authorizer_PusherAuthorizer = (function () {
  41355. function PusherAuthorizer(channel, options) {
  41356. this.channel = channel;
  41357. var authTransport = options.authTransport;
  41358. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41359. throw "'" + authTransport + "' is not a recognized auth transport";
  41360. }
  41361. this.type = authTransport;
  41362. this.options = options;
  41363. this.authOptions = (options || {}).auth || {};
  41364. }
  41365. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41366. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41367. '&channel_name=' + encodeURIComponent(this.channel.name);
  41368. for (var i in this.authOptions.params) {
  41369. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41370. }
  41371. return query;
  41372. };
  41373. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41374. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41375. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41376. };
  41377. return PusherAuthorizer;
  41378. }());
  41379. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41380. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41381. var timeline_sender_TimelineSender = (function () {
  41382. function TimelineSender(timeline, options) {
  41383. this.timeline = timeline;
  41384. this.options = options || {};
  41385. }
  41386. TimelineSender.prototype.send = function (useTLS, callback) {
  41387. if (this.timeline.isEmpty()) {
  41388. return;
  41389. }
  41390. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41391. };
  41392. return TimelineSender;
  41393. }());
  41394. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41395. // CONCATENATED MODULE: ./src/core/errors.ts
  41396. var errors_extends = (undefined && undefined.__extends) || (function () {
  41397. var extendStatics = function (d, b) {
  41398. extendStatics = Object.setPrototypeOf ||
  41399. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41400. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41401. return extendStatics(d, b);
  41402. };
  41403. return function (d, b) {
  41404. extendStatics(d, b);
  41405. function __() { this.constructor = d; }
  41406. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41407. };
  41408. })();
  41409. var BadEventName = (function (_super) {
  41410. errors_extends(BadEventName, _super);
  41411. function BadEventName(msg) {
  41412. var _newTarget = this.constructor;
  41413. var _this = _super.call(this, msg) || this;
  41414. Object.setPrototypeOf(_this, _newTarget.prototype);
  41415. return _this;
  41416. }
  41417. return BadEventName;
  41418. }(Error));
  41419. var RequestTimedOut = (function (_super) {
  41420. errors_extends(RequestTimedOut, _super);
  41421. function RequestTimedOut(msg) {
  41422. var _newTarget = this.constructor;
  41423. var _this = _super.call(this, msg) || this;
  41424. Object.setPrototypeOf(_this, _newTarget.prototype);
  41425. return _this;
  41426. }
  41427. return RequestTimedOut;
  41428. }(Error));
  41429. var TransportPriorityTooLow = (function (_super) {
  41430. errors_extends(TransportPriorityTooLow, _super);
  41431. function TransportPriorityTooLow(msg) {
  41432. var _newTarget = this.constructor;
  41433. var _this = _super.call(this, msg) || this;
  41434. Object.setPrototypeOf(_this, _newTarget.prototype);
  41435. return _this;
  41436. }
  41437. return TransportPriorityTooLow;
  41438. }(Error));
  41439. var TransportClosed = (function (_super) {
  41440. errors_extends(TransportClosed, _super);
  41441. function TransportClosed(msg) {
  41442. var _newTarget = this.constructor;
  41443. var _this = _super.call(this, msg) || this;
  41444. Object.setPrototypeOf(_this, _newTarget.prototype);
  41445. return _this;
  41446. }
  41447. return TransportClosed;
  41448. }(Error));
  41449. var UnsupportedFeature = (function (_super) {
  41450. errors_extends(UnsupportedFeature, _super);
  41451. function UnsupportedFeature(msg) {
  41452. var _newTarget = this.constructor;
  41453. var _this = _super.call(this, msg) || this;
  41454. Object.setPrototypeOf(_this, _newTarget.prototype);
  41455. return _this;
  41456. }
  41457. return UnsupportedFeature;
  41458. }(Error));
  41459. var UnsupportedTransport = (function (_super) {
  41460. errors_extends(UnsupportedTransport, _super);
  41461. function UnsupportedTransport(msg) {
  41462. var _newTarget = this.constructor;
  41463. var _this = _super.call(this, msg) || this;
  41464. Object.setPrototypeOf(_this, _newTarget.prototype);
  41465. return _this;
  41466. }
  41467. return UnsupportedTransport;
  41468. }(Error));
  41469. var UnsupportedStrategy = (function (_super) {
  41470. errors_extends(UnsupportedStrategy, _super);
  41471. function UnsupportedStrategy(msg) {
  41472. var _newTarget = this.constructor;
  41473. var _this = _super.call(this, msg) || this;
  41474. Object.setPrototypeOf(_this, _newTarget.prototype);
  41475. return _this;
  41476. }
  41477. return UnsupportedStrategy;
  41478. }(Error));
  41479. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41480. var channel_extends = (undefined && undefined.__extends) || (function () {
  41481. var extendStatics = function (d, b) {
  41482. extendStatics = Object.setPrototypeOf ||
  41483. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41484. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41485. return extendStatics(d, b);
  41486. };
  41487. return function (d, b) {
  41488. extendStatics(d, b);
  41489. function __() { this.constructor = d; }
  41490. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41491. };
  41492. })();
  41493. var channel_Channel = (function (_super) {
  41494. channel_extends(Channel, _super);
  41495. function Channel(name, pusher) {
  41496. var _this = _super.call(this, function (event, data) {
  41497. logger.debug('No callbacks on ' + name + ' for ' + event);
  41498. }) || this;
  41499. _this.name = name;
  41500. _this.pusher = pusher;
  41501. _this.subscribed = false;
  41502. _this.subscriptionPending = false;
  41503. _this.subscriptionCancelled = false;
  41504. return _this;
  41505. }
  41506. Channel.prototype.authorize = function (socketId, callback) {
  41507. return callback(false, {});
  41508. };
  41509. Channel.prototype.trigger = function (event, data) {
  41510. if (event.indexOf("client-") !== 0) {
  41511. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41512. }
  41513. if (!this.subscribed) {
  41514. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41515. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41516. }
  41517. return this.pusher.send_event(event, data, this.name);
  41518. };
  41519. Channel.prototype.disconnect = function () {
  41520. this.subscribed = false;
  41521. this.subscriptionPending = false;
  41522. };
  41523. Channel.prototype.handleEvent = function (event) {
  41524. var eventName = event.event;
  41525. var data = event.data;
  41526. if (eventName === "pusher_internal:subscription_succeeded") {
  41527. this.handleSubscriptionSucceededEvent(event);
  41528. }
  41529. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41530. var metadata = {};
  41531. this.emit(eventName, data, metadata);
  41532. }
  41533. };
  41534. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41535. this.subscriptionPending = false;
  41536. this.subscribed = true;
  41537. if (this.subscriptionCancelled) {
  41538. this.pusher.unsubscribe(this.name);
  41539. }
  41540. else {
  41541. this.emit("pusher:subscription_succeeded", event.data);
  41542. }
  41543. };
  41544. Channel.prototype.subscribe = function () {
  41545. var _this = this;
  41546. if (this.subscribed) {
  41547. return;
  41548. }
  41549. this.subscriptionPending = true;
  41550. this.subscriptionCancelled = false;
  41551. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41552. if (error) {
  41553. logger.error(data);
  41554. _this.emit('pusher:subscription_error', data);
  41555. }
  41556. else {
  41557. _this.pusher.send_event('pusher:subscribe', {
  41558. auth: data.auth,
  41559. channel_data: data.channel_data,
  41560. channel: _this.name
  41561. });
  41562. }
  41563. });
  41564. };
  41565. Channel.prototype.unsubscribe = function () {
  41566. this.subscribed = false;
  41567. this.pusher.send_event('pusher:unsubscribe', {
  41568. channel: this.name
  41569. });
  41570. };
  41571. Channel.prototype.cancelSubscription = function () {
  41572. this.subscriptionCancelled = true;
  41573. };
  41574. Channel.prototype.reinstateSubscription = function () {
  41575. this.subscriptionCancelled = false;
  41576. };
  41577. return Channel;
  41578. }(dispatcher));
  41579. /* harmony default export */ var channels_channel = (channel_Channel);
  41580. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41581. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41582. var extendStatics = function (d, b) {
  41583. extendStatics = Object.setPrototypeOf ||
  41584. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41585. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41586. return extendStatics(d, b);
  41587. };
  41588. return function (d, b) {
  41589. extendStatics(d, b);
  41590. function __() { this.constructor = d; }
  41591. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41592. };
  41593. })();
  41594. var private_channel_PrivateChannel = (function (_super) {
  41595. private_channel_extends(PrivateChannel, _super);
  41596. function PrivateChannel() {
  41597. return _super !== null && _super.apply(this, arguments) || this;
  41598. }
  41599. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41600. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41601. return authorizer.authorize(socketId, callback);
  41602. };
  41603. return PrivateChannel;
  41604. }(channels_channel));
  41605. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41606. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41607. var members_Members = (function () {
  41608. function Members() {
  41609. this.reset();
  41610. }
  41611. Members.prototype.get = function (id) {
  41612. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41613. return {
  41614. id: id,
  41615. info: this.members[id]
  41616. };
  41617. }
  41618. else {
  41619. return null;
  41620. }
  41621. };
  41622. Members.prototype.each = function (callback) {
  41623. var _this = this;
  41624. objectApply(this.members, function (member, id) {
  41625. callback(_this.get(id));
  41626. });
  41627. };
  41628. Members.prototype.setMyID = function (id) {
  41629. this.myID = id;
  41630. };
  41631. Members.prototype.onSubscription = function (subscriptionData) {
  41632. this.members = subscriptionData.presence.hash;
  41633. this.count = subscriptionData.presence.count;
  41634. this.me = this.get(this.myID);
  41635. };
  41636. Members.prototype.addMember = function (memberData) {
  41637. if (this.get(memberData.user_id) === null) {
  41638. this.count++;
  41639. }
  41640. this.members[memberData.user_id] = memberData.user_info;
  41641. return this.get(memberData.user_id);
  41642. };
  41643. Members.prototype.removeMember = function (memberData) {
  41644. var member = this.get(memberData.user_id);
  41645. if (member) {
  41646. delete this.members[memberData.user_id];
  41647. this.count--;
  41648. }
  41649. return member;
  41650. };
  41651. Members.prototype.reset = function () {
  41652. this.members = {};
  41653. this.count = 0;
  41654. this.myID = null;
  41655. this.me = null;
  41656. };
  41657. return Members;
  41658. }());
  41659. /* harmony default export */ var members = (members_Members);
  41660. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41661. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41662. var extendStatics = function (d, b) {
  41663. extendStatics = Object.setPrototypeOf ||
  41664. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41665. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41666. return extendStatics(d, b);
  41667. };
  41668. return function (d, b) {
  41669. extendStatics(d, b);
  41670. function __() { this.constructor = d; }
  41671. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41672. };
  41673. })();
  41674. var presence_channel_PresenceChannel = (function (_super) {
  41675. presence_channel_extends(PresenceChannel, _super);
  41676. function PresenceChannel(name, pusher) {
  41677. var _this = _super.call(this, name, pusher) || this;
  41678. _this.members = new members();
  41679. return _this;
  41680. }
  41681. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41682. var _this = this;
  41683. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41684. if (!error) {
  41685. if (authData.channel_data === undefined) {
  41686. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41687. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41688. ("expected 'channel_data' field. " + suffix));
  41689. callback("Invalid auth response");
  41690. return;
  41691. }
  41692. var channelData = JSON.parse(authData.channel_data);
  41693. _this.members.setMyID(channelData.user_id);
  41694. }
  41695. callback(error, authData);
  41696. });
  41697. };
  41698. PresenceChannel.prototype.handleEvent = function (event) {
  41699. var eventName = event.event;
  41700. if (eventName.indexOf("pusher_internal:") === 0) {
  41701. this.handleInternalEvent(event);
  41702. }
  41703. else {
  41704. var data = event.data;
  41705. var metadata = {};
  41706. if (event.user_id) {
  41707. metadata.user_id = event.user_id;
  41708. }
  41709. this.emit(eventName, data, metadata);
  41710. }
  41711. };
  41712. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41713. var eventName = event.event;
  41714. var data = event.data;
  41715. switch (eventName) {
  41716. case "pusher_internal:subscription_succeeded":
  41717. this.handleSubscriptionSucceededEvent(event);
  41718. break;
  41719. case "pusher_internal:member_added":
  41720. var addedMember = this.members.addMember(data);
  41721. this.emit('pusher:member_added', addedMember);
  41722. break;
  41723. case "pusher_internal:member_removed":
  41724. var removedMember = this.members.removeMember(data);
  41725. if (removedMember) {
  41726. this.emit('pusher:member_removed', removedMember);
  41727. }
  41728. break;
  41729. }
  41730. };
  41731. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41732. this.subscriptionPending = false;
  41733. this.subscribed = true;
  41734. if (this.subscriptionCancelled) {
  41735. this.pusher.unsubscribe(this.name);
  41736. }
  41737. else {
  41738. this.members.onSubscription(event.data);
  41739. this.emit("pusher:subscription_succeeded", this.members);
  41740. }
  41741. };
  41742. PresenceChannel.prototype.disconnect = function () {
  41743. this.members.reset();
  41744. _super.prototype.disconnect.call(this);
  41745. };
  41746. return PresenceChannel;
  41747. }(private_channel));
  41748. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41749. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41750. var nacl_fast = __webpack_require__(0);
  41751. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41752. var nacl_util = __webpack_require__(1);
  41753. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41754. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41755. var extendStatics = function (d, b) {
  41756. extendStatics = Object.setPrototypeOf ||
  41757. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41758. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41759. return extendStatics(d, b);
  41760. };
  41761. return function (d, b) {
  41762. extendStatics(d, b);
  41763. function __() { this.constructor = d; }
  41764. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41765. };
  41766. })();
  41767. var encrypted_channel_EncryptedChannel = (function (_super) {
  41768. encrypted_channel_extends(EncryptedChannel, _super);
  41769. function EncryptedChannel() {
  41770. var _this = _super !== null && _super.apply(this, arguments) || this;
  41771. _this.key = null;
  41772. return _this;
  41773. }
  41774. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41775. var _this = this;
  41776. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41777. if (error) {
  41778. callback(true, authData);
  41779. return;
  41780. }
  41781. var sharedSecret = authData["shared_secret"];
  41782. if (!sharedSecret) {
  41783. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41784. callback(true, errorMsg);
  41785. return;
  41786. }
  41787. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41788. delete authData["shared_secret"];
  41789. callback(false, authData);
  41790. });
  41791. };
  41792. EncryptedChannel.prototype.trigger = function (event, data) {
  41793. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41794. };
  41795. EncryptedChannel.prototype.handleEvent = function (event) {
  41796. var eventName = event.event;
  41797. var data = event.data;
  41798. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41799. _super.prototype.handleEvent.call(this, event);
  41800. return;
  41801. }
  41802. this.handleEncryptedEvent(eventName, data);
  41803. };
  41804. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41805. var _this = this;
  41806. if (!this.key) {
  41807. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41808. return;
  41809. }
  41810. if (!data.ciphertext || !data.nonce) {
  41811. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41812. return;
  41813. }
  41814. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41815. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41816. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41817. return;
  41818. }
  41819. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41820. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41821. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41822. return;
  41823. }
  41824. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41825. if (bytes === null) {
  41826. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41827. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41828. if (error) {
  41829. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41830. return;
  41831. }
  41832. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41833. if (bytes === null) {
  41834. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41835. return;
  41836. }
  41837. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41838. return;
  41839. });
  41840. return;
  41841. }
  41842. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41843. };
  41844. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41845. try {
  41846. this.emit(eventName, JSON.parse(data));
  41847. }
  41848. catch (e) {
  41849. this.emit(eventName, data);
  41850. }
  41851. return this;
  41852. };
  41853. return EncryptedChannel;
  41854. }(private_channel));
  41855. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41856. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41857. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41858. var extendStatics = function (d, b) {
  41859. extendStatics = Object.setPrototypeOf ||
  41860. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41861. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41862. return extendStatics(d, b);
  41863. };
  41864. return function (d, b) {
  41865. extendStatics(d, b);
  41866. function __() { this.constructor = d; }
  41867. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41868. };
  41869. })();
  41870. var connection_manager_ConnectionManager = (function (_super) {
  41871. connection_manager_extends(ConnectionManager, _super);
  41872. function ConnectionManager(key, options) {
  41873. var _this = _super.call(this) || this;
  41874. _this.key = key;
  41875. _this.options = options || {};
  41876. _this.state = "initialized";
  41877. _this.connection = null;
  41878. _this.usingTLS = !!options.useTLS;
  41879. _this.timeline = _this.options.timeline;
  41880. _this.errorCallbacks = _this.buildErrorCallbacks();
  41881. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41882. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41883. var Network = runtime.getNetwork();
  41884. Network.bind("online", function () {
  41885. _this.timeline.info({ netinfo: "online" });
  41886. if (_this.state === "connecting" || _this.state === "unavailable") {
  41887. _this.retryIn(0);
  41888. }
  41889. });
  41890. Network.bind("offline", function () {
  41891. _this.timeline.info({ netinfo: "offline" });
  41892. if (_this.connection) {
  41893. _this.sendActivityCheck();
  41894. }
  41895. });
  41896. _this.updateStrategy();
  41897. return _this;
  41898. }
  41899. ConnectionManager.prototype.connect = function () {
  41900. if (this.connection || this.runner) {
  41901. return;
  41902. }
  41903. if (!this.strategy.isSupported()) {
  41904. this.updateState("failed");
  41905. return;
  41906. }
  41907. this.updateState("connecting");
  41908. this.startConnecting();
  41909. this.setUnavailableTimer();
  41910. };
  41911. ;
  41912. ConnectionManager.prototype.send = function (data) {
  41913. if (this.connection) {
  41914. return this.connection.send(data);
  41915. }
  41916. else {
  41917. return false;
  41918. }
  41919. };
  41920. ;
  41921. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41922. if (this.connection) {
  41923. return this.connection.send_event(name, data, channel);
  41924. }
  41925. else {
  41926. return false;
  41927. }
  41928. };
  41929. ;
  41930. ConnectionManager.prototype.disconnect = function () {
  41931. this.disconnectInternally();
  41932. this.updateState("disconnected");
  41933. };
  41934. ;
  41935. ConnectionManager.prototype.isUsingTLS = function () {
  41936. return this.usingTLS;
  41937. };
  41938. ;
  41939. ConnectionManager.prototype.startConnecting = function () {
  41940. var _this = this;
  41941. var callback = function (error, handshake) {
  41942. if (error) {
  41943. _this.runner = _this.strategy.connect(0, callback);
  41944. }
  41945. else {
  41946. if (handshake.action === "error") {
  41947. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41948. _this.timeline.error({ handshakeError: handshake.error });
  41949. }
  41950. else {
  41951. _this.abortConnecting();
  41952. _this.handshakeCallbacks[handshake.action](handshake);
  41953. }
  41954. }
  41955. };
  41956. this.runner = this.strategy.connect(0, callback);
  41957. };
  41958. ;
  41959. ConnectionManager.prototype.abortConnecting = function () {
  41960. if (this.runner) {
  41961. this.runner.abort();
  41962. this.runner = null;
  41963. }
  41964. };
  41965. ;
  41966. ConnectionManager.prototype.disconnectInternally = function () {
  41967. this.abortConnecting();
  41968. this.clearRetryTimer();
  41969. this.clearUnavailableTimer();
  41970. if (this.connection) {
  41971. var connection = this.abandonConnection();
  41972. connection.close();
  41973. }
  41974. };
  41975. ;
  41976. ConnectionManager.prototype.updateStrategy = function () {
  41977. this.strategy = this.options.getStrategy({
  41978. key: this.key,
  41979. timeline: this.timeline,
  41980. useTLS: this.usingTLS
  41981. });
  41982. };
  41983. ;
  41984. ConnectionManager.prototype.retryIn = function (delay) {
  41985. var _this = this;
  41986. this.timeline.info({ action: "retry", delay: delay });
  41987. if (delay > 0) {
  41988. this.emit("connecting_in", Math.round(delay / 1000));
  41989. }
  41990. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41991. _this.disconnectInternally();
  41992. _this.connect();
  41993. });
  41994. };
  41995. ;
  41996. ConnectionManager.prototype.clearRetryTimer = function () {
  41997. if (this.retryTimer) {
  41998. this.retryTimer.ensureAborted();
  41999. this.retryTimer = null;
  42000. }
  42001. };
  42002. ;
  42003. ConnectionManager.prototype.setUnavailableTimer = function () {
  42004. var _this = this;
  42005. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42006. _this.updateState("unavailable");
  42007. });
  42008. };
  42009. ;
  42010. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42011. if (this.unavailableTimer) {
  42012. this.unavailableTimer.ensureAborted();
  42013. }
  42014. };
  42015. ;
  42016. ConnectionManager.prototype.sendActivityCheck = function () {
  42017. var _this = this;
  42018. this.stopActivityCheck();
  42019. this.connection.ping();
  42020. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42021. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42022. _this.retryIn(0);
  42023. });
  42024. };
  42025. ;
  42026. ConnectionManager.prototype.resetActivityCheck = function () {
  42027. var _this = this;
  42028. this.stopActivityCheck();
  42029. if (this.connection && !this.connection.handlesActivityChecks()) {
  42030. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42031. _this.sendActivityCheck();
  42032. });
  42033. }
  42034. };
  42035. ;
  42036. ConnectionManager.prototype.stopActivityCheck = function () {
  42037. if (this.activityTimer) {
  42038. this.activityTimer.ensureAborted();
  42039. }
  42040. };
  42041. ;
  42042. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42043. var _this = this;
  42044. return extend({}, errorCallbacks, {
  42045. message: function (message) {
  42046. _this.resetActivityCheck();
  42047. _this.emit('message', message);
  42048. },
  42049. ping: function () {
  42050. _this.send_event('pusher:pong', {});
  42051. },
  42052. activity: function () {
  42053. _this.resetActivityCheck();
  42054. },
  42055. error: function (error) {
  42056. _this.emit("error", { type: "WebSocketError", error: error });
  42057. },
  42058. closed: function () {
  42059. _this.abandonConnection();
  42060. if (_this.shouldRetry()) {
  42061. _this.retryIn(1000);
  42062. }
  42063. }
  42064. });
  42065. };
  42066. ;
  42067. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42068. var _this = this;
  42069. return extend({}, errorCallbacks, {
  42070. connected: function (handshake) {
  42071. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42072. _this.clearUnavailableTimer();
  42073. _this.setConnection(handshake.connection);
  42074. _this.socket_id = _this.connection.id;
  42075. _this.updateState("connected", { socket_id: _this.socket_id });
  42076. }
  42077. });
  42078. };
  42079. ;
  42080. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42081. var _this = this;
  42082. var withErrorEmitted = function (callback) {
  42083. return function (result) {
  42084. if (result.error) {
  42085. _this.emit("error", { type: "WebSocketError", error: result.error });
  42086. }
  42087. callback(result);
  42088. };
  42089. };
  42090. return {
  42091. tls_only: withErrorEmitted(function () {
  42092. _this.usingTLS = true;
  42093. _this.updateStrategy();
  42094. _this.retryIn(0);
  42095. }),
  42096. refused: withErrorEmitted(function () {
  42097. _this.disconnect();
  42098. }),
  42099. backoff: withErrorEmitted(function () {
  42100. _this.retryIn(1000);
  42101. }),
  42102. retry: withErrorEmitted(function () {
  42103. _this.retryIn(0);
  42104. })
  42105. };
  42106. };
  42107. ;
  42108. ConnectionManager.prototype.setConnection = function (connection) {
  42109. this.connection = connection;
  42110. for (var event in this.connectionCallbacks) {
  42111. this.connection.bind(event, this.connectionCallbacks[event]);
  42112. }
  42113. this.resetActivityCheck();
  42114. };
  42115. ;
  42116. ConnectionManager.prototype.abandonConnection = function () {
  42117. if (!this.connection) {
  42118. return;
  42119. }
  42120. this.stopActivityCheck();
  42121. for (var event in this.connectionCallbacks) {
  42122. this.connection.unbind(event, this.connectionCallbacks[event]);
  42123. }
  42124. var connection = this.connection;
  42125. this.connection = null;
  42126. return connection;
  42127. };
  42128. ConnectionManager.prototype.updateState = function (newState, data) {
  42129. var previousState = this.state;
  42130. this.state = newState;
  42131. if (previousState !== newState) {
  42132. var newStateDescription = newState;
  42133. if (newStateDescription === "connected") {
  42134. newStateDescription += " with new socket ID " + data.socket_id;
  42135. }
  42136. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42137. this.timeline.info({ state: newState, params: data });
  42138. this.emit('state_change', { previous: previousState, current: newState });
  42139. this.emit(newState, data);
  42140. }
  42141. };
  42142. ConnectionManager.prototype.shouldRetry = function () {
  42143. return this.state === "connecting" || this.state === "connected";
  42144. };
  42145. return ConnectionManager;
  42146. }(dispatcher));
  42147. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42148. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42149. var channels_Channels = (function () {
  42150. function Channels() {
  42151. this.channels = {};
  42152. }
  42153. Channels.prototype.add = function (name, pusher) {
  42154. if (!this.channels[name]) {
  42155. this.channels[name] = createChannel(name, pusher);
  42156. }
  42157. return this.channels[name];
  42158. };
  42159. Channels.prototype.all = function () {
  42160. return values(this.channels);
  42161. };
  42162. Channels.prototype.find = function (name) {
  42163. return this.channels[name];
  42164. };
  42165. Channels.prototype.remove = function (name) {
  42166. var channel = this.channels[name];
  42167. delete this.channels[name];
  42168. return channel;
  42169. };
  42170. Channels.prototype.disconnect = function () {
  42171. objectApply(this.channels, function (channel) {
  42172. channel.disconnect();
  42173. });
  42174. };
  42175. return Channels;
  42176. }());
  42177. /* harmony default export */ var channels = (channels_Channels);
  42178. function createChannel(name, pusher) {
  42179. if (name.indexOf('private-encrypted-') === 0) {
  42180. if (false) { var errorMsg; }
  42181. return factory.createEncryptedChannel(name, pusher);
  42182. }
  42183. else if (name.indexOf('private-') === 0) {
  42184. return factory.createPrivateChannel(name, pusher);
  42185. }
  42186. else if (name.indexOf('presence-') === 0) {
  42187. return factory.createPresenceChannel(name, pusher);
  42188. }
  42189. else {
  42190. return factory.createChannel(name, pusher);
  42191. }
  42192. }
  42193. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42194. var Factory = {
  42195. createChannels: function () {
  42196. return new channels();
  42197. },
  42198. createConnectionManager: function (key, options) {
  42199. return new connection_manager(key, options);
  42200. },
  42201. createChannel: function (name, pusher) {
  42202. return new channels_channel(name, pusher);
  42203. },
  42204. createPrivateChannel: function (name, pusher) {
  42205. return new private_channel(name, pusher);
  42206. },
  42207. createPresenceChannel: function (name, pusher) {
  42208. return new presence_channel(name, pusher);
  42209. },
  42210. createEncryptedChannel: function (name, pusher) {
  42211. return new encrypted_channel(name, pusher);
  42212. },
  42213. createTimelineSender: function (timeline, options) {
  42214. return new timeline_sender(timeline, options);
  42215. },
  42216. createAuthorizer: function (channel, options) {
  42217. if (options.authorizer) {
  42218. return options.authorizer(channel, options);
  42219. }
  42220. return new pusher_authorizer(channel, options);
  42221. },
  42222. createHandshake: function (transport, callback) {
  42223. return new connection_handshake(transport, callback);
  42224. },
  42225. createAssistantToTheTransportManager: function (manager, transport, options) {
  42226. return new assistant_to_the_transport_manager(manager, transport, options);
  42227. }
  42228. };
  42229. /* harmony default export */ var factory = (Factory);
  42230. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42231. var transport_manager_TransportManager = (function () {
  42232. function TransportManager(options) {
  42233. this.options = options || {};
  42234. this.livesLeft = this.options.lives || Infinity;
  42235. }
  42236. TransportManager.prototype.getAssistant = function (transport) {
  42237. return factory.createAssistantToTheTransportManager(this, transport, {
  42238. minPingDelay: this.options.minPingDelay,
  42239. maxPingDelay: this.options.maxPingDelay
  42240. });
  42241. };
  42242. TransportManager.prototype.isAlive = function () {
  42243. return this.livesLeft > 0;
  42244. };
  42245. TransportManager.prototype.reportDeath = function () {
  42246. this.livesLeft -= 1;
  42247. };
  42248. return TransportManager;
  42249. }());
  42250. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42251. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42252. var sequential_strategy_SequentialStrategy = (function () {
  42253. function SequentialStrategy(strategies, options) {
  42254. this.strategies = strategies;
  42255. this.loop = Boolean(options.loop);
  42256. this.failFast = Boolean(options.failFast);
  42257. this.timeout = options.timeout;
  42258. this.timeoutLimit = options.timeoutLimit;
  42259. }
  42260. SequentialStrategy.prototype.isSupported = function () {
  42261. return any(this.strategies, util.method("isSupported"));
  42262. };
  42263. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42264. var _this = this;
  42265. var strategies = this.strategies;
  42266. var current = 0;
  42267. var timeout = this.timeout;
  42268. var runner = null;
  42269. var tryNextStrategy = function (error, handshake) {
  42270. if (handshake) {
  42271. callback(null, handshake);
  42272. }
  42273. else {
  42274. current = current + 1;
  42275. if (_this.loop) {
  42276. current = current % strategies.length;
  42277. }
  42278. if (current < strategies.length) {
  42279. if (timeout) {
  42280. timeout = timeout * 2;
  42281. if (_this.timeoutLimit) {
  42282. timeout = Math.min(timeout, _this.timeoutLimit);
  42283. }
  42284. }
  42285. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42286. }
  42287. else {
  42288. callback(true);
  42289. }
  42290. }
  42291. };
  42292. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42293. return {
  42294. abort: function () {
  42295. runner.abort();
  42296. },
  42297. forceMinPriority: function (p) {
  42298. minPriority = p;
  42299. if (runner) {
  42300. runner.forceMinPriority(p);
  42301. }
  42302. }
  42303. };
  42304. };
  42305. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42306. var timer = null;
  42307. var runner = null;
  42308. if (options.timeout > 0) {
  42309. timer = new OneOffTimer(options.timeout, function () {
  42310. runner.abort();
  42311. callback(true);
  42312. });
  42313. }
  42314. runner = strategy.connect(minPriority, function (error, handshake) {
  42315. if (error && timer && timer.isRunning() && !options.failFast) {
  42316. return;
  42317. }
  42318. if (timer) {
  42319. timer.ensureAborted();
  42320. }
  42321. callback(error, handshake);
  42322. });
  42323. return {
  42324. abort: function () {
  42325. if (timer) {
  42326. timer.ensureAborted();
  42327. }
  42328. runner.abort();
  42329. },
  42330. forceMinPriority: function (p) {
  42331. runner.forceMinPriority(p);
  42332. }
  42333. };
  42334. };
  42335. return SequentialStrategy;
  42336. }());
  42337. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42338. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42339. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42340. function BestConnectedEverStrategy(strategies) {
  42341. this.strategies = strategies;
  42342. }
  42343. BestConnectedEverStrategy.prototype.isSupported = function () {
  42344. return any(this.strategies, util.method("isSupported"));
  42345. };
  42346. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42347. return connect(this.strategies, minPriority, function (i, runners) {
  42348. return function (error, handshake) {
  42349. runners[i].error = error;
  42350. if (error) {
  42351. if (allRunnersFailed(runners)) {
  42352. callback(true);
  42353. }
  42354. return;
  42355. }
  42356. apply(runners, function (runner) {
  42357. runner.forceMinPriority(handshake.transport.priority);
  42358. });
  42359. callback(null, handshake);
  42360. };
  42361. });
  42362. };
  42363. return BestConnectedEverStrategy;
  42364. }());
  42365. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42366. function connect(strategies, minPriority, callbackBuilder) {
  42367. var runners = map(strategies, function (strategy, i, _, rs) {
  42368. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42369. });
  42370. return {
  42371. abort: function () {
  42372. apply(runners, abortRunner);
  42373. },
  42374. forceMinPriority: function (p) {
  42375. apply(runners, function (runner) {
  42376. runner.forceMinPriority(p);
  42377. });
  42378. }
  42379. };
  42380. }
  42381. function allRunnersFailed(runners) {
  42382. return collections_all(runners, function (runner) {
  42383. return Boolean(runner.error);
  42384. });
  42385. }
  42386. function abortRunner(runner) {
  42387. if (!runner.error && !runner.aborted) {
  42388. runner.abort();
  42389. runner.aborted = true;
  42390. }
  42391. }
  42392. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42393. var cached_strategy_CachedStrategy = (function () {
  42394. function CachedStrategy(strategy, transports, options) {
  42395. this.strategy = strategy;
  42396. this.transports = transports;
  42397. this.ttl = options.ttl || 1800 * 1000;
  42398. this.usingTLS = options.useTLS;
  42399. this.timeline = options.timeline;
  42400. }
  42401. CachedStrategy.prototype.isSupported = function () {
  42402. return this.strategy.isSupported();
  42403. };
  42404. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42405. var usingTLS = this.usingTLS;
  42406. var info = fetchTransportCache(usingTLS);
  42407. var strategies = [this.strategy];
  42408. if (info && info.timestamp + this.ttl >= util.now()) {
  42409. var transport = this.transports[info.transport];
  42410. if (transport) {
  42411. this.timeline.info({
  42412. cached: true,
  42413. transport: info.transport,
  42414. latency: info.latency
  42415. });
  42416. strategies.push(new sequential_strategy([transport], {
  42417. timeout: info.latency * 2 + 1000,
  42418. failFast: true
  42419. }));
  42420. }
  42421. }
  42422. var startTimestamp = util.now();
  42423. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42424. if (error) {
  42425. flushTransportCache(usingTLS);
  42426. if (strategies.length > 0) {
  42427. startTimestamp = util.now();
  42428. runner = strategies.pop().connect(minPriority, cb);
  42429. }
  42430. else {
  42431. callback(error);
  42432. }
  42433. }
  42434. else {
  42435. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42436. callback(null, handshake);
  42437. }
  42438. });
  42439. return {
  42440. abort: function () {
  42441. runner.abort();
  42442. },
  42443. forceMinPriority: function (p) {
  42444. minPriority = p;
  42445. if (runner) {
  42446. runner.forceMinPriority(p);
  42447. }
  42448. }
  42449. };
  42450. };
  42451. return CachedStrategy;
  42452. }());
  42453. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42454. function getTransportCacheKey(usingTLS) {
  42455. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42456. }
  42457. function fetchTransportCache(usingTLS) {
  42458. var storage = runtime.getLocalStorage();
  42459. if (storage) {
  42460. try {
  42461. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42462. if (serializedCache) {
  42463. return JSON.parse(serializedCache);
  42464. }
  42465. }
  42466. catch (e) {
  42467. flushTransportCache(usingTLS);
  42468. }
  42469. }
  42470. return null;
  42471. }
  42472. function storeTransportCache(usingTLS, transport, latency) {
  42473. var storage = runtime.getLocalStorage();
  42474. if (storage) {
  42475. try {
  42476. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42477. timestamp: util.now(),
  42478. transport: transport,
  42479. latency: latency
  42480. });
  42481. }
  42482. catch (e) {
  42483. }
  42484. }
  42485. }
  42486. function flushTransportCache(usingTLS) {
  42487. var storage = runtime.getLocalStorage();
  42488. if (storage) {
  42489. try {
  42490. delete storage[getTransportCacheKey(usingTLS)];
  42491. }
  42492. catch (e) {
  42493. }
  42494. }
  42495. }
  42496. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42497. var delayed_strategy_DelayedStrategy = (function () {
  42498. function DelayedStrategy(strategy, _a) {
  42499. var number = _a.delay;
  42500. this.strategy = strategy;
  42501. this.options = { delay: number };
  42502. }
  42503. DelayedStrategy.prototype.isSupported = function () {
  42504. return this.strategy.isSupported();
  42505. };
  42506. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42507. var strategy = this.strategy;
  42508. var runner;
  42509. var timer = new OneOffTimer(this.options.delay, function () {
  42510. runner = strategy.connect(minPriority, callback);
  42511. });
  42512. return {
  42513. abort: function () {
  42514. timer.ensureAborted();
  42515. if (runner) {
  42516. runner.abort();
  42517. }
  42518. },
  42519. forceMinPriority: function (p) {
  42520. minPriority = p;
  42521. if (runner) {
  42522. runner.forceMinPriority(p);
  42523. }
  42524. }
  42525. };
  42526. };
  42527. return DelayedStrategy;
  42528. }());
  42529. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42530. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42531. var IfStrategy = (function () {
  42532. function IfStrategy(test, trueBranch, falseBranch) {
  42533. this.test = test;
  42534. this.trueBranch = trueBranch;
  42535. this.falseBranch = falseBranch;
  42536. }
  42537. IfStrategy.prototype.isSupported = function () {
  42538. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42539. return branch.isSupported();
  42540. };
  42541. IfStrategy.prototype.connect = function (minPriority, callback) {
  42542. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42543. return branch.connect(minPriority, callback);
  42544. };
  42545. return IfStrategy;
  42546. }());
  42547. /* harmony default export */ var if_strategy = (IfStrategy);
  42548. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42549. var FirstConnectedStrategy = (function () {
  42550. function FirstConnectedStrategy(strategy) {
  42551. this.strategy = strategy;
  42552. }
  42553. FirstConnectedStrategy.prototype.isSupported = function () {
  42554. return this.strategy.isSupported();
  42555. };
  42556. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42557. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42558. if (handshake) {
  42559. runner.abort();
  42560. }
  42561. callback(error, handshake);
  42562. });
  42563. return runner;
  42564. };
  42565. return FirstConnectedStrategy;
  42566. }());
  42567. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42568. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42569. function testSupportsStrategy(strategy) {
  42570. return function () {
  42571. return strategy.isSupported();
  42572. };
  42573. }
  42574. var getDefaultStrategy = function (config, defineTransport) {
  42575. var definedTransports = {};
  42576. function defineTransportStrategy(name, type, priority, options, manager) {
  42577. var transport = defineTransport(config, name, type, priority, options, manager);
  42578. definedTransports[name] = transport;
  42579. return transport;
  42580. }
  42581. var ws_options = {
  42582. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42583. hostTLS: config.wsHost + ":" + config.wssPort,
  42584. httpPath: config.wsPath
  42585. };
  42586. var wss_options = extend({}, ws_options, {
  42587. useTLS: true
  42588. });
  42589. var sockjs_options = {
  42590. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42591. hostTLS: config.httpHost + ":" + config.httpsPort,
  42592. httpPath: config.httpPath
  42593. };
  42594. var timeouts = {
  42595. loop: true,
  42596. timeout: 15000,
  42597. timeoutLimit: 60000
  42598. };
  42599. var ws_manager = new transport_manager({
  42600. lives: 2,
  42601. minPingDelay: 10000,
  42602. maxPingDelay: config.activity_timeout
  42603. });
  42604. var streaming_manager = new transport_manager({
  42605. lives: 2,
  42606. minPingDelay: 10000,
  42607. maxPingDelay: config.activity_timeout
  42608. });
  42609. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42610. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42611. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42612. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42613. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42614. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42615. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42616. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42617. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42618. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42619. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42620. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42621. 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);
  42622. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42623. var wsStrategy;
  42624. if (config.useTLS) {
  42625. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42626. }
  42627. else {
  42628. wsStrategy = new best_connected_ever_strategy([
  42629. ws_loop,
  42630. new delayed_strategy(wss_loop, { delay: 2000 }),
  42631. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42632. ]);
  42633. }
  42634. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42635. ttl: 1800000,
  42636. timeline: config.timeline,
  42637. useTLS: config.useTLS
  42638. });
  42639. };
  42640. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42641. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42642. /* harmony default export */ var transport_connection_initializer = (function () {
  42643. var self = this;
  42644. self.timeline.info(self.buildTimelineMessage({
  42645. transport: self.name + (self.options.useTLS ? "s" : "")
  42646. }));
  42647. if (self.hooks.isInitialized()) {
  42648. self.changeState("initialized");
  42649. }
  42650. else if (self.hooks.file) {
  42651. self.changeState("initializing");
  42652. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42653. if (self.hooks.isInitialized()) {
  42654. self.changeState("initialized");
  42655. callback(true);
  42656. }
  42657. else {
  42658. if (error) {
  42659. self.onError(error);
  42660. }
  42661. self.onClose();
  42662. callback(false);
  42663. }
  42664. });
  42665. }
  42666. else {
  42667. self.onClose();
  42668. }
  42669. });
  42670. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42671. var http_xdomain_request_hooks = {
  42672. getRequest: function (socket) {
  42673. var xdr = new window.XDomainRequest();
  42674. xdr.ontimeout = function () {
  42675. socket.emit("error", new RequestTimedOut());
  42676. socket.close();
  42677. };
  42678. xdr.onerror = function (e) {
  42679. socket.emit("error", e);
  42680. socket.close();
  42681. };
  42682. xdr.onprogress = function () {
  42683. if (xdr.responseText && xdr.responseText.length > 0) {
  42684. socket.onChunk(200, xdr.responseText);
  42685. }
  42686. };
  42687. xdr.onload = function () {
  42688. if (xdr.responseText && xdr.responseText.length > 0) {
  42689. socket.onChunk(200, xdr.responseText);
  42690. }
  42691. socket.emit("finished", 200);
  42692. socket.close();
  42693. };
  42694. return xdr;
  42695. },
  42696. abortRequest: function (xdr) {
  42697. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42698. xdr.abort();
  42699. }
  42700. };
  42701. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42702. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42703. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42704. var extendStatics = function (d, b) {
  42705. extendStatics = Object.setPrototypeOf ||
  42706. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42707. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42708. return extendStatics(d, b);
  42709. };
  42710. return function (d, b) {
  42711. extendStatics(d, b);
  42712. function __() { this.constructor = d; }
  42713. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42714. };
  42715. })();
  42716. var MAX_BUFFER_LENGTH = 256 * 1024;
  42717. var http_request_HTTPRequest = (function (_super) {
  42718. http_request_extends(HTTPRequest, _super);
  42719. function HTTPRequest(hooks, method, url) {
  42720. var _this = _super.call(this) || this;
  42721. _this.hooks = hooks;
  42722. _this.method = method;
  42723. _this.url = url;
  42724. return _this;
  42725. }
  42726. HTTPRequest.prototype.start = function (payload) {
  42727. var _this = this;
  42728. this.position = 0;
  42729. this.xhr = this.hooks.getRequest(this);
  42730. this.unloader = function () {
  42731. _this.close();
  42732. };
  42733. runtime.addUnloadListener(this.unloader);
  42734. this.xhr.open(this.method, this.url, true);
  42735. if (this.xhr.setRequestHeader) {
  42736. this.xhr.setRequestHeader("Content-Type", "application/json");
  42737. }
  42738. this.xhr.send(payload);
  42739. };
  42740. HTTPRequest.prototype.close = function () {
  42741. if (this.unloader) {
  42742. runtime.removeUnloadListener(this.unloader);
  42743. this.unloader = null;
  42744. }
  42745. if (this.xhr) {
  42746. this.hooks.abortRequest(this.xhr);
  42747. this.xhr = null;
  42748. }
  42749. };
  42750. HTTPRequest.prototype.onChunk = function (status, data) {
  42751. while (true) {
  42752. var chunk = this.advanceBuffer(data);
  42753. if (chunk) {
  42754. this.emit("chunk", { status: status, data: chunk });
  42755. }
  42756. else {
  42757. break;
  42758. }
  42759. }
  42760. if (this.isBufferTooLong(data)) {
  42761. this.emit("buffer_too_long");
  42762. }
  42763. };
  42764. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42765. var unreadData = buffer.slice(this.position);
  42766. var endOfLinePosition = unreadData.indexOf("\n");
  42767. if (endOfLinePosition !== -1) {
  42768. this.position += endOfLinePosition + 1;
  42769. return unreadData.slice(0, endOfLinePosition);
  42770. }
  42771. else {
  42772. return null;
  42773. }
  42774. };
  42775. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42776. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42777. };
  42778. return HTTPRequest;
  42779. }(dispatcher));
  42780. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42781. // CONCATENATED MODULE: ./src/core/http/state.ts
  42782. var State;
  42783. (function (State) {
  42784. State[State["CONNECTING"] = 0] = "CONNECTING";
  42785. State[State["OPEN"] = 1] = "OPEN";
  42786. State[State["CLOSED"] = 3] = "CLOSED";
  42787. })(State || (State = {}));
  42788. /* harmony default export */ var state = (State);
  42789. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42790. var autoIncrement = 1;
  42791. var http_socket_HTTPSocket = (function () {
  42792. function HTTPSocket(hooks, url) {
  42793. this.hooks = hooks;
  42794. this.session = randomNumber(1000) + "/" + randomString(8);
  42795. this.location = getLocation(url);
  42796. this.readyState = state.CONNECTING;
  42797. this.openStream();
  42798. }
  42799. HTTPSocket.prototype.send = function (payload) {
  42800. return this.sendRaw(JSON.stringify([payload]));
  42801. };
  42802. HTTPSocket.prototype.ping = function () {
  42803. this.hooks.sendHeartbeat(this);
  42804. };
  42805. HTTPSocket.prototype.close = function (code, reason) {
  42806. this.onClose(code, reason, true);
  42807. };
  42808. HTTPSocket.prototype.sendRaw = function (payload) {
  42809. if (this.readyState === state.OPEN) {
  42810. try {
  42811. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42812. return true;
  42813. }
  42814. catch (e) {
  42815. return false;
  42816. }
  42817. }
  42818. else {
  42819. return false;
  42820. }
  42821. };
  42822. HTTPSocket.prototype.reconnect = function () {
  42823. this.closeStream();
  42824. this.openStream();
  42825. };
  42826. ;
  42827. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42828. this.closeStream();
  42829. this.readyState = state.CLOSED;
  42830. if (this.onclose) {
  42831. this.onclose({
  42832. code: code,
  42833. reason: reason,
  42834. wasClean: wasClean
  42835. });
  42836. }
  42837. };
  42838. HTTPSocket.prototype.onChunk = function (chunk) {
  42839. if (chunk.status !== 200) {
  42840. return;
  42841. }
  42842. if (this.readyState === state.OPEN) {
  42843. this.onActivity();
  42844. }
  42845. var payload;
  42846. var type = chunk.data.slice(0, 1);
  42847. switch (type) {
  42848. case 'o':
  42849. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42850. this.onOpen(payload);
  42851. break;
  42852. case 'a':
  42853. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42854. for (var i = 0; i < payload.length; i++) {
  42855. this.onEvent(payload[i]);
  42856. }
  42857. break;
  42858. case 'm':
  42859. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42860. this.onEvent(payload);
  42861. break;
  42862. case 'h':
  42863. this.hooks.onHeartbeat(this);
  42864. break;
  42865. case 'c':
  42866. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42867. this.onClose(payload[0], payload[1], true);
  42868. break;
  42869. }
  42870. };
  42871. HTTPSocket.prototype.onOpen = function (options) {
  42872. if (this.readyState === state.CONNECTING) {
  42873. if (options && options.hostname) {
  42874. this.location.base = replaceHost(this.location.base, options.hostname);
  42875. }
  42876. this.readyState = state.OPEN;
  42877. if (this.onopen) {
  42878. this.onopen();
  42879. }
  42880. }
  42881. else {
  42882. this.onClose(1006, "Server lost session", true);
  42883. }
  42884. };
  42885. HTTPSocket.prototype.onEvent = function (event) {
  42886. if (this.readyState === state.OPEN && this.onmessage) {
  42887. this.onmessage({ data: event });
  42888. }
  42889. };
  42890. HTTPSocket.prototype.onActivity = function () {
  42891. if (this.onactivity) {
  42892. this.onactivity();
  42893. }
  42894. };
  42895. HTTPSocket.prototype.onError = function (error) {
  42896. if (this.onerror) {
  42897. this.onerror(error);
  42898. }
  42899. };
  42900. HTTPSocket.prototype.openStream = function () {
  42901. var _this = this;
  42902. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42903. this.stream.bind("chunk", function (chunk) {
  42904. _this.onChunk(chunk);
  42905. });
  42906. this.stream.bind("finished", function (status) {
  42907. _this.hooks.onFinished(_this, status);
  42908. });
  42909. this.stream.bind("buffer_too_long", function () {
  42910. _this.reconnect();
  42911. });
  42912. try {
  42913. this.stream.start();
  42914. }
  42915. catch (error) {
  42916. util.defer(function () {
  42917. _this.onError(error);
  42918. _this.onClose(1006, "Could not start streaming", false);
  42919. });
  42920. }
  42921. };
  42922. HTTPSocket.prototype.closeStream = function () {
  42923. if (this.stream) {
  42924. this.stream.unbind_all();
  42925. this.stream.close();
  42926. this.stream = null;
  42927. }
  42928. };
  42929. return HTTPSocket;
  42930. }());
  42931. function getLocation(url) {
  42932. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42933. return {
  42934. base: parts[1],
  42935. queryString: parts[2]
  42936. };
  42937. }
  42938. function getSendURL(url, session) {
  42939. return url.base + "/" + session + "/xhr_send";
  42940. }
  42941. function getUniqueURL(url) {
  42942. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42943. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42944. }
  42945. function replaceHost(url, hostname) {
  42946. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42947. return urlParts[1] + hostname + urlParts[3];
  42948. }
  42949. function randomNumber(max) {
  42950. return Math.floor(Math.random() * max);
  42951. }
  42952. function randomString(length) {
  42953. var result = [];
  42954. for (var i = 0; i < length; i++) {
  42955. result.push(randomNumber(32).toString(32));
  42956. }
  42957. return result.join('');
  42958. }
  42959. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42960. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42961. var http_streaming_socket_hooks = {
  42962. getReceiveURL: function (url, session) {
  42963. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42964. },
  42965. onHeartbeat: function (socket) {
  42966. socket.sendRaw("[]");
  42967. },
  42968. sendHeartbeat: function (socket) {
  42969. socket.sendRaw("[]");
  42970. },
  42971. onFinished: function (socket, status) {
  42972. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42973. }
  42974. };
  42975. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42976. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42977. var http_polling_socket_hooks = {
  42978. getReceiveURL: function (url, session) {
  42979. return url.base + "/" + session + "/xhr" + url.queryString;
  42980. },
  42981. onHeartbeat: function () {
  42982. },
  42983. sendHeartbeat: function (socket) {
  42984. socket.sendRaw("[]");
  42985. },
  42986. onFinished: function (socket, status) {
  42987. if (status === 200) {
  42988. socket.reconnect();
  42989. }
  42990. else {
  42991. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42992. }
  42993. }
  42994. };
  42995. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42996. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42997. var http_xhr_request_hooks = {
  42998. getRequest: function (socket) {
  42999. var Constructor = runtime.getXHRAPI();
  43000. var xhr = new Constructor();
  43001. xhr.onreadystatechange = xhr.onprogress = function () {
  43002. switch (xhr.readyState) {
  43003. case 3:
  43004. if (xhr.responseText && xhr.responseText.length > 0) {
  43005. socket.onChunk(xhr.status, xhr.responseText);
  43006. }
  43007. break;
  43008. case 4:
  43009. if (xhr.responseText && xhr.responseText.length > 0) {
  43010. socket.onChunk(xhr.status, xhr.responseText);
  43011. }
  43012. socket.emit("finished", xhr.status);
  43013. socket.close();
  43014. break;
  43015. }
  43016. };
  43017. return xhr;
  43018. },
  43019. abortRequest: function (xhr) {
  43020. xhr.onreadystatechange = null;
  43021. xhr.abort();
  43022. }
  43023. };
  43024. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43025. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43026. var HTTP = {
  43027. createStreamingSocket: function (url) {
  43028. return this.createSocket(http_streaming_socket, url);
  43029. },
  43030. createPollingSocket: function (url) {
  43031. return this.createSocket(http_polling_socket, url);
  43032. },
  43033. createSocket: function (hooks, url) {
  43034. return new http_socket(hooks, url);
  43035. },
  43036. createXHR: function (method, url) {
  43037. return this.createRequest(http_xhr_request, method, url);
  43038. },
  43039. createRequest: function (hooks, method, url) {
  43040. return new http_request(hooks, method, url);
  43041. }
  43042. };
  43043. /* harmony default export */ var http_http = (HTTP);
  43044. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43045. http_http.createXDR = function (method, url) {
  43046. return this.createRequest(http_xdomain_request, method, url);
  43047. };
  43048. /* harmony default export */ var web_http_http = (http_http);
  43049. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43050. var Runtime = {
  43051. nextAuthCallbackID: 1,
  43052. auth_callbacks: {},
  43053. ScriptReceivers: ScriptReceivers,
  43054. DependenciesReceivers: DependenciesReceivers,
  43055. getDefaultStrategy: default_strategy,
  43056. Transports: transports_transports,
  43057. transportConnectionInitializer: transport_connection_initializer,
  43058. HTTPFactory: web_http_http,
  43059. TimelineTransport: jsonp_timeline,
  43060. getXHRAPI: function () {
  43061. return window.XMLHttpRequest;
  43062. },
  43063. getWebSocketAPI: function () {
  43064. return window.WebSocket || window.MozWebSocket;
  43065. },
  43066. setup: function (PusherClass) {
  43067. var _this = this;
  43068. window.Pusher = PusherClass;
  43069. var initializeOnDocumentBody = function () {
  43070. _this.onDocumentBody(PusherClass.ready);
  43071. };
  43072. if (!window.JSON) {
  43073. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43074. }
  43075. else {
  43076. initializeOnDocumentBody();
  43077. }
  43078. },
  43079. getDocument: function () {
  43080. return document;
  43081. },
  43082. getProtocol: function () {
  43083. return this.getDocument().location.protocol;
  43084. },
  43085. getAuthorizers: function () {
  43086. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43087. },
  43088. onDocumentBody: function (callback) {
  43089. var _this = this;
  43090. if (document.body) {
  43091. callback();
  43092. }
  43093. else {
  43094. setTimeout(function () {
  43095. _this.onDocumentBody(callback);
  43096. }, 0);
  43097. }
  43098. },
  43099. createJSONPRequest: function (url, data) {
  43100. return new jsonp_request(url, data);
  43101. },
  43102. createScriptRequest: function (src) {
  43103. return new script_request(src);
  43104. },
  43105. getLocalStorage: function () {
  43106. try {
  43107. return window.localStorage;
  43108. }
  43109. catch (e) {
  43110. return undefined;
  43111. }
  43112. },
  43113. createXHR: function () {
  43114. if (this.getXHRAPI()) {
  43115. return this.createXMLHttpRequest();
  43116. }
  43117. else {
  43118. return this.createMicrosoftXHR();
  43119. }
  43120. },
  43121. createXMLHttpRequest: function () {
  43122. var Constructor = this.getXHRAPI();
  43123. return new Constructor();
  43124. },
  43125. createMicrosoftXHR: function () {
  43126. return new ActiveXObject("Microsoft.XMLHTTP");
  43127. },
  43128. getNetwork: function () {
  43129. return net_info_Network;
  43130. },
  43131. createWebSocket: function (url) {
  43132. var Constructor = this.getWebSocketAPI();
  43133. return new Constructor(url);
  43134. },
  43135. createSocketRequest: function (method, url) {
  43136. if (this.isXHRSupported()) {
  43137. return this.HTTPFactory.createXHR(method, url);
  43138. }
  43139. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43140. return this.HTTPFactory.createXDR(method, url);
  43141. }
  43142. else {
  43143. throw "Cross-origin HTTP requests are not supported";
  43144. }
  43145. },
  43146. isXHRSupported: function () {
  43147. var Constructor = this.getXHRAPI();
  43148. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43149. },
  43150. isXDRSupported: function (useTLS) {
  43151. var protocol = useTLS ? "https:" : "http:";
  43152. var documentProtocol = this.getProtocol();
  43153. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43154. },
  43155. addUnloadListener: function (listener) {
  43156. if (window.addEventListener !== undefined) {
  43157. window.addEventListener("unload", listener, false);
  43158. }
  43159. else if (window.attachEvent !== undefined) {
  43160. window.attachEvent("onunload", listener);
  43161. }
  43162. },
  43163. removeUnloadListener: function (listener) {
  43164. if (window.addEventListener !== undefined) {
  43165. window.removeEventListener("unload", listener, false);
  43166. }
  43167. else if (window.detachEvent !== undefined) {
  43168. window.detachEvent("onunload", listener);
  43169. }
  43170. }
  43171. };
  43172. /* harmony default export */ var runtime = (Runtime);
  43173. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43174. var TimelineLevel;
  43175. (function (TimelineLevel) {
  43176. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43177. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43178. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43179. })(TimelineLevel || (TimelineLevel = {}));
  43180. /* harmony default export */ var timeline_level = (TimelineLevel);
  43181. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43182. var timeline_Timeline = (function () {
  43183. function Timeline(key, session, options) {
  43184. this.key = key;
  43185. this.session = session;
  43186. this.events = [];
  43187. this.options = options || {};
  43188. this.sent = 0;
  43189. this.uniqueID = 0;
  43190. }
  43191. Timeline.prototype.log = function (level, event) {
  43192. if (level <= this.options.level) {
  43193. this.events.push(extend({}, event, { timestamp: util.now() }));
  43194. if (this.options.limit && this.events.length > this.options.limit) {
  43195. this.events.shift();
  43196. }
  43197. }
  43198. };
  43199. Timeline.prototype.error = function (event) {
  43200. this.log(timeline_level.ERROR, event);
  43201. };
  43202. Timeline.prototype.info = function (event) {
  43203. this.log(timeline_level.INFO, event);
  43204. };
  43205. Timeline.prototype.debug = function (event) {
  43206. this.log(timeline_level.DEBUG, event);
  43207. };
  43208. Timeline.prototype.isEmpty = function () {
  43209. return this.events.length === 0;
  43210. };
  43211. Timeline.prototype.send = function (sendfn, callback) {
  43212. var _this = this;
  43213. var data = extend({
  43214. session: this.session,
  43215. bundle: this.sent + 1,
  43216. key: this.key,
  43217. lib: "js",
  43218. version: this.options.version,
  43219. cluster: this.options.cluster,
  43220. features: this.options.features,
  43221. timeline: this.events
  43222. }, this.options.params);
  43223. this.events = [];
  43224. sendfn(data, function (error, result) {
  43225. if (!error) {
  43226. _this.sent++;
  43227. }
  43228. if (callback) {
  43229. callback(error, result);
  43230. }
  43231. });
  43232. return true;
  43233. };
  43234. Timeline.prototype.generateUniqueID = function () {
  43235. this.uniqueID++;
  43236. return this.uniqueID;
  43237. };
  43238. return Timeline;
  43239. }());
  43240. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43241. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43242. var transport_strategy_TransportStrategy = (function () {
  43243. function TransportStrategy(name, priority, transport, options) {
  43244. this.name = name;
  43245. this.priority = priority;
  43246. this.transport = transport;
  43247. this.options = options || {};
  43248. }
  43249. TransportStrategy.prototype.isSupported = function () {
  43250. return this.transport.isSupported({
  43251. useTLS: this.options.useTLS
  43252. });
  43253. };
  43254. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43255. var _this = this;
  43256. if (!this.isSupported()) {
  43257. return failAttempt(new UnsupportedStrategy(), callback);
  43258. }
  43259. else if (this.priority < minPriority) {
  43260. return failAttempt(new TransportPriorityTooLow(), callback);
  43261. }
  43262. var connected = false;
  43263. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43264. var handshake = null;
  43265. var onInitialized = function () {
  43266. transport.unbind("initialized", onInitialized);
  43267. transport.connect();
  43268. };
  43269. var onOpen = function () {
  43270. handshake = factory.createHandshake(transport, function (result) {
  43271. connected = true;
  43272. unbindListeners();
  43273. callback(null, result);
  43274. });
  43275. };
  43276. var onError = function (error) {
  43277. unbindListeners();
  43278. callback(error);
  43279. };
  43280. var onClosed = function () {
  43281. unbindListeners();
  43282. var serializedTransport;
  43283. serializedTransport = safeJSONStringify(transport);
  43284. callback(new TransportClosed(serializedTransport));
  43285. };
  43286. var unbindListeners = function () {
  43287. transport.unbind("initialized", onInitialized);
  43288. transport.unbind("open", onOpen);
  43289. transport.unbind("error", onError);
  43290. transport.unbind("closed", onClosed);
  43291. };
  43292. transport.bind("initialized", onInitialized);
  43293. transport.bind("open", onOpen);
  43294. transport.bind("error", onError);
  43295. transport.bind("closed", onClosed);
  43296. transport.initialize();
  43297. return {
  43298. abort: function () {
  43299. if (connected) {
  43300. return;
  43301. }
  43302. unbindListeners();
  43303. if (handshake) {
  43304. handshake.close();
  43305. }
  43306. else {
  43307. transport.close();
  43308. }
  43309. },
  43310. forceMinPriority: function (p) {
  43311. if (connected) {
  43312. return;
  43313. }
  43314. if (_this.priority < p) {
  43315. if (handshake) {
  43316. handshake.close();
  43317. }
  43318. else {
  43319. transport.close();
  43320. }
  43321. }
  43322. }
  43323. };
  43324. };
  43325. return TransportStrategy;
  43326. }());
  43327. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43328. function failAttempt(error, callback) {
  43329. util.defer(function () {
  43330. callback(error);
  43331. });
  43332. return {
  43333. abort: function () { },
  43334. forceMinPriority: function () { }
  43335. };
  43336. }
  43337. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43338. var strategy_builder_Transports = runtime.Transports;
  43339. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43340. var transportClass = strategy_builder_Transports[type];
  43341. if (!transportClass) {
  43342. throw new UnsupportedTransport(type);
  43343. }
  43344. var enabled = (!config.enabledTransports ||
  43345. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43346. (!config.disabledTransports ||
  43347. arrayIndexOf(config.disabledTransports, name) === -1);
  43348. var transport;
  43349. if (enabled) {
  43350. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43351. key: config.key,
  43352. useTLS: config.useTLS,
  43353. timeline: config.timeline,
  43354. ignoreNullOrigin: config.ignoreNullOrigin
  43355. }, options));
  43356. }
  43357. else {
  43358. transport = strategy_builder_UnsupportedStrategy;
  43359. }
  43360. return transport;
  43361. };
  43362. var strategy_builder_UnsupportedStrategy = {
  43363. isSupported: function () {
  43364. return false;
  43365. },
  43366. connect: function (_, callback) {
  43367. var deferred = util.defer(function () {
  43368. callback(new UnsupportedStrategy());
  43369. });
  43370. return {
  43371. abort: function () {
  43372. deferred.ensureAborted();
  43373. },
  43374. forceMinPriority: function () { }
  43375. };
  43376. }
  43377. };
  43378. // CONCATENATED MODULE: ./src/core/config.ts
  43379. var getGlobalConfig = function () {
  43380. return {
  43381. wsHost: defaults.host,
  43382. wsPort: defaults.ws_port,
  43383. wssPort: defaults.wss_port,
  43384. wsPath: defaults.ws_path,
  43385. httpHost: defaults.sockjs_host,
  43386. httpPort: defaults.sockjs_http_port,
  43387. httpsPort: defaults.sockjs_https_port,
  43388. httpPath: defaults.sockjs_path,
  43389. statsHost: defaults.stats_host,
  43390. authEndpoint: defaults.channel_auth_endpoint,
  43391. authTransport: defaults.channel_auth_transport,
  43392. activity_timeout: defaults.activity_timeout,
  43393. pong_timeout: defaults.pong_timeout,
  43394. unavailable_timeout: defaults.unavailable_timeout
  43395. };
  43396. };
  43397. var getClusterConfig = function (clusterName) {
  43398. return {
  43399. wsHost: 'ws-' + clusterName + '.pusher.com',
  43400. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43401. };
  43402. };
  43403. // CONCATENATED MODULE: ./src/core/pusher.ts
  43404. var pusher_Pusher = (function () {
  43405. function Pusher(app_key, options) {
  43406. var _this = this;
  43407. checkAppKey(app_key);
  43408. options = options || {};
  43409. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43410. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43411. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43412. }
  43413. this.key = app_key;
  43414. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43415. this.channels = factory.createChannels();
  43416. this.global_emitter = new dispatcher();
  43417. this.sessionID = Math.floor(Math.random() * 1000000000);
  43418. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43419. cluster: this.config.cluster,
  43420. features: Pusher.getClientFeatures(),
  43421. params: this.config.timelineParams || {},
  43422. limit: 50,
  43423. level: timeline_level.INFO,
  43424. version: defaults.VERSION
  43425. });
  43426. if (!this.config.disableStats) {
  43427. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43428. host: this.config.statsHost,
  43429. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43430. });
  43431. }
  43432. var getStrategy = function (options) {
  43433. var config = extend({}, _this.config, options);
  43434. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43435. };
  43436. this.connection = factory.createConnectionManager(this.key, extend({
  43437. getStrategy: getStrategy,
  43438. timeline: this.timeline,
  43439. activityTimeout: this.config.activity_timeout,
  43440. pongTimeout: this.config.pong_timeout,
  43441. unavailableTimeout: this.config.unavailable_timeout
  43442. }, this.config, { useTLS: this.shouldUseTLS() }));
  43443. this.connection.bind('connected', function () {
  43444. _this.subscribeAll();
  43445. if (_this.timelineSender) {
  43446. _this.timelineSender.send(_this.connection.isUsingTLS());
  43447. }
  43448. });
  43449. this.connection.bind('message', function (event) {
  43450. var eventName = event.event;
  43451. var internal = eventName.indexOf('pusher_internal:') === 0;
  43452. if (event.channel) {
  43453. var channel = _this.channel(event.channel);
  43454. if (channel) {
  43455. channel.handleEvent(event);
  43456. }
  43457. }
  43458. if (!internal) {
  43459. _this.global_emitter.emit(event.event, event.data);
  43460. }
  43461. });
  43462. this.connection.bind('connecting', function () {
  43463. _this.channels.disconnect();
  43464. });
  43465. this.connection.bind('disconnected', function () {
  43466. _this.channels.disconnect();
  43467. });
  43468. this.connection.bind('error', function (err) {
  43469. logger.warn(err);
  43470. });
  43471. Pusher.instances.push(this);
  43472. this.timeline.info({ instances: Pusher.instances.length });
  43473. if (Pusher.isReady) {
  43474. this.connect();
  43475. }
  43476. }
  43477. Pusher.ready = function () {
  43478. Pusher.isReady = true;
  43479. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43480. Pusher.instances[i].connect();
  43481. }
  43482. };
  43483. Pusher.getClientFeatures = function () {
  43484. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43485. return t.isSupported({});
  43486. }));
  43487. };
  43488. Pusher.prototype.channel = function (name) {
  43489. return this.channels.find(name);
  43490. };
  43491. Pusher.prototype.allChannels = function () {
  43492. return this.channels.all();
  43493. };
  43494. Pusher.prototype.connect = function () {
  43495. this.connection.connect();
  43496. if (this.timelineSender) {
  43497. if (!this.timelineSenderTimer) {
  43498. var usingTLS = this.connection.isUsingTLS();
  43499. var timelineSender = this.timelineSender;
  43500. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43501. timelineSender.send(usingTLS);
  43502. });
  43503. }
  43504. }
  43505. };
  43506. Pusher.prototype.disconnect = function () {
  43507. this.connection.disconnect();
  43508. if (this.timelineSenderTimer) {
  43509. this.timelineSenderTimer.ensureAborted();
  43510. this.timelineSenderTimer = null;
  43511. }
  43512. };
  43513. Pusher.prototype.bind = function (event_name, callback, context) {
  43514. this.global_emitter.bind(event_name, callback, context);
  43515. return this;
  43516. };
  43517. Pusher.prototype.unbind = function (event_name, callback, context) {
  43518. this.global_emitter.unbind(event_name, callback, context);
  43519. return this;
  43520. };
  43521. Pusher.prototype.bind_global = function (callback) {
  43522. this.global_emitter.bind_global(callback);
  43523. return this;
  43524. };
  43525. Pusher.prototype.unbind_global = function (callback) {
  43526. this.global_emitter.unbind_global(callback);
  43527. return this;
  43528. };
  43529. Pusher.prototype.unbind_all = function (callback) {
  43530. this.global_emitter.unbind_all();
  43531. return this;
  43532. };
  43533. Pusher.prototype.subscribeAll = function () {
  43534. var channelName;
  43535. for (channelName in this.channels.channels) {
  43536. if (this.channels.channels.hasOwnProperty(channelName)) {
  43537. this.subscribe(channelName);
  43538. }
  43539. }
  43540. };
  43541. Pusher.prototype.subscribe = function (channel_name) {
  43542. var channel = this.channels.add(channel_name, this);
  43543. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43544. channel.reinstateSubscription();
  43545. }
  43546. else if (!channel.subscriptionPending &&
  43547. this.connection.state === 'connected') {
  43548. channel.subscribe();
  43549. }
  43550. return channel;
  43551. };
  43552. Pusher.prototype.unsubscribe = function (channel_name) {
  43553. var channel = this.channels.find(channel_name);
  43554. if (channel && channel.subscriptionPending) {
  43555. channel.cancelSubscription();
  43556. }
  43557. else {
  43558. channel = this.channels.remove(channel_name);
  43559. if (channel && this.connection.state === 'connected') {
  43560. channel.unsubscribe();
  43561. }
  43562. }
  43563. };
  43564. Pusher.prototype.send_event = function (event_name, data, channel) {
  43565. return this.connection.send_event(event_name, data, channel);
  43566. };
  43567. Pusher.prototype.shouldUseTLS = function () {
  43568. if (runtime.getProtocol() === 'https:') {
  43569. return true;
  43570. }
  43571. else if (this.config.forceTLS === true) {
  43572. return true;
  43573. }
  43574. else {
  43575. return Boolean(this.config.encrypted);
  43576. }
  43577. };
  43578. Pusher.instances = [];
  43579. Pusher.isReady = false;
  43580. Pusher.logToConsole = false;
  43581. Pusher.Runtime = runtime;
  43582. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43583. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43584. Pusher.auth_callbacks = runtime.auth_callbacks;
  43585. return Pusher;
  43586. }());
  43587. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43588. function checkAppKey(key) {
  43589. if (key === null || key === undefined) {
  43590. throw 'You must pass your app key when you instantiate Pusher.';
  43591. }
  43592. }
  43593. runtime.setup(pusher_Pusher);
  43594. /***/ })
  43595. /******/ ]);
  43596. });
  43597. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43598. /***/ }),
  43599. /***/ "./node_modules/setimmediate/setImmediate.js":
  43600. /*!***************************************************!*\
  43601. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43602. \***************************************************/
  43603. /*! no static exports found */
  43604. /***/ (function(module, exports, __webpack_require__) {
  43605. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43606. "use strict";
  43607. if (global.setImmediate) {
  43608. return;
  43609. }
  43610. var nextHandle = 1; // Spec says greater than zero
  43611. var tasksByHandle = {};
  43612. var currentlyRunningATask = false;
  43613. var doc = global.document;
  43614. var registerImmediate;
  43615. function setImmediate(callback) {
  43616. // Callback can either be a function or a string
  43617. if (typeof callback !== "function") {
  43618. callback = new Function("" + callback);
  43619. }
  43620. // Copy function arguments
  43621. var args = new Array(arguments.length - 1);
  43622. for (var i = 0; i < args.length; i++) {
  43623. args[i] = arguments[i + 1];
  43624. }
  43625. // Store and register the task
  43626. var task = { callback: callback, args: args };
  43627. tasksByHandle[nextHandle] = task;
  43628. registerImmediate(nextHandle);
  43629. return nextHandle++;
  43630. }
  43631. function clearImmediate(handle) {
  43632. delete tasksByHandle[handle];
  43633. }
  43634. function run(task) {
  43635. var callback = task.callback;
  43636. var args = task.args;
  43637. switch (args.length) {
  43638. case 0:
  43639. callback();
  43640. break;
  43641. case 1:
  43642. callback(args[0]);
  43643. break;
  43644. case 2:
  43645. callback(args[0], args[1]);
  43646. break;
  43647. case 3:
  43648. callback(args[0], args[1], args[2]);
  43649. break;
  43650. default:
  43651. callback.apply(undefined, args);
  43652. break;
  43653. }
  43654. }
  43655. function runIfPresent(handle) {
  43656. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43657. // So if we're currently running a task, we'll need to delay this invocation.
  43658. if (currentlyRunningATask) {
  43659. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43660. // "too much recursion" error.
  43661. setTimeout(runIfPresent, 0, handle);
  43662. } else {
  43663. var task = tasksByHandle[handle];
  43664. if (task) {
  43665. currentlyRunningATask = true;
  43666. try {
  43667. run(task);
  43668. } finally {
  43669. clearImmediate(handle);
  43670. currentlyRunningATask = false;
  43671. }
  43672. }
  43673. }
  43674. }
  43675. function installNextTickImplementation() {
  43676. registerImmediate = function(handle) {
  43677. process.nextTick(function () { runIfPresent(handle); });
  43678. };
  43679. }
  43680. function canUsePostMessage() {
  43681. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43682. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43683. if (global.postMessage && !global.importScripts) {
  43684. var postMessageIsAsynchronous = true;
  43685. var oldOnMessage = global.onmessage;
  43686. global.onmessage = function() {
  43687. postMessageIsAsynchronous = false;
  43688. };
  43689. global.postMessage("", "*");
  43690. global.onmessage = oldOnMessage;
  43691. return postMessageIsAsynchronous;
  43692. }
  43693. }
  43694. function installPostMessageImplementation() {
  43695. // Installs an event handler on `global` for the `message` event: see
  43696. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43697. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43698. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43699. var onGlobalMessage = function(event) {
  43700. if (event.source === global &&
  43701. typeof event.data === "string" &&
  43702. event.data.indexOf(messagePrefix) === 0) {
  43703. runIfPresent(+event.data.slice(messagePrefix.length));
  43704. }
  43705. };
  43706. if (global.addEventListener) {
  43707. global.addEventListener("message", onGlobalMessage, false);
  43708. } else {
  43709. global.attachEvent("onmessage", onGlobalMessage);
  43710. }
  43711. registerImmediate = function(handle) {
  43712. global.postMessage(messagePrefix + handle, "*");
  43713. };
  43714. }
  43715. function installMessageChannelImplementation() {
  43716. var channel = new MessageChannel();
  43717. channel.port1.onmessage = function(event) {
  43718. var handle = event.data;
  43719. runIfPresent(handle);
  43720. };
  43721. registerImmediate = function(handle) {
  43722. channel.port2.postMessage(handle);
  43723. };
  43724. }
  43725. function installReadyStateChangeImplementation() {
  43726. var html = doc.documentElement;
  43727. registerImmediate = function(handle) {
  43728. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43729. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43730. var script = doc.createElement("script");
  43731. script.onreadystatechange = function () {
  43732. runIfPresent(handle);
  43733. script.onreadystatechange = null;
  43734. html.removeChild(script);
  43735. script = null;
  43736. };
  43737. html.appendChild(script);
  43738. };
  43739. }
  43740. function installSetTimeoutImplementation() {
  43741. registerImmediate = function(handle) {
  43742. setTimeout(runIfPresent, 0, handle);
  43743. };
  43744. }
  43745. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43746. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43747. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43748. // Don't get fooled by e.g. browserify environments.
  43749. if ({}.toString.call(global.process) === "[object process]") {
  43750. // For Node.js before 0.9
  43751. installNextTickImplementation();
  43752. } else if (canUsePostMessage()) {
  43753. // For non-IE10 modern browsers
  43754. installPostMessageImplementation();
  43755. } else if (global.MessageChannel) {
  43756. // For web workers, where supported
  43757. installMessageChannelImplementation();
  43758. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43759. // For IE 6–8
  43760. installReadyStateChangeImplementation();
  43761. } else {
  43762. // For older browsers
  43763. installSetTimeoutImplementation();
  43764. }
  43765. attachTo.setImmediate = setImmediate;
  43766. attachTo.clearImmediate = clearImmediate;
  43767. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43768. /* 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")))
  43769. /***/ }),
  43770. /***/ "./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&":
  43771. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43772. !*** ./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& ***!
  43773. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43774. /*! no static exports found */
  43775. /***/ (function(module, exports, __webpack_require__) {
  43776. 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&");
  43777. if(typeof content === 'string') content = [[module.i, content, '']];
  43778. var transform;
  43779. var insertInto;
  43780. var options = {"hmr":true}
  43781. options.transform = transform
  43782. options.insertInto = undefined;
  43783. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43784. if(content.locals) module.exports = content.locals;
  43785. if(false) {}
  43786. /***/ }),
  43787. /***/ "./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&":
  43788. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43789. !*** ./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& ***!
  43790. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43791. /*! no static exports found */
  43792. /***/ (function(module, exports, __webpack_require__) {
  43793. 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&");
  43794. if(typeof content === 'string') content = [[module.i, content, '']];
  43795. var transform;
  43796. var insertInto;
  43797. var options = {"hmr":true}
  43798. options.transform = transform
  43799. options.insertInto = undefined;
  43800. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43801. if(content.locals) module.exports = content.locals;
  43802. if(false) {}
  43803. /***/ }),
  43804. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43805. /*!****************************************************!*\
  43806. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43807. \****************************************************/
  43808. /*! no static exports found */
  43809. /***/ (function(module, exports, __webpack_require__) {
  43810. /*
  43811. MIT License http://www.opensource.org/licenses/mit-license.php
  43812. Author Tobias Koppers @sokra
  43813. */
  43814. var stylesInDom = {};
  43815. var memoize = function (fn) {
  43816. var memo;
  43817. return function () {
  43818. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43819. return memo;
  43820. };
  43821. };
  43822. var isOldIE = memoize(function () {
  43823. // Test for IE <= 9 as proposed by Browserhacks
  43824. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43825. // Tests for existence of standard globals is to allow style-loader
  43826. // to operate correctly into non-standard environments
  43827. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43828. return window && document && document.all && !window.atob;
  43829. });
  43830. var getTarget = function (target, parent) {
  43831. if (parent){
  43832. return parent.querySelector(target);
  43833. }
  43834. return document.querySelector(target);
  43835. };
  43836. var getElement = (function (fn) {
  43837. var memo = {};
  43838. return function(target, parent) {
  43839. // If passing function in options, then use it for resolve "head" element.
  43840. // Useful for Shadow Root style i.e
  43841. // {
  43842. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43843. // }
  43844. if (typeof target === 'function') {
  43845. return target();
  43846. }
  43847. if (typeof memo[target] === "undefined") {
  43848. var styleTarget = getTarget.call(this, target, parent);
  43849. // Special case to return head of iframe instead of iframe itself
  43850. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43851. try {
  43852. // This will throw an exception if access to iframe is blocked
  43853. // due to cross-origin restrictions
  43854. styleTarget = styleTarget.contentDocument.head;
  43855. } catch(e) {
  43856. styleTarget = null;
  43857. }
  43858. }
  43859. memo[target] = styleTarget;
  43860. }
  43861. return memo[target]
  43862. };
  43863. })();
  43864. var singleton = null;
  43865. var singletonCounter = 0;
  43866. var stylesInsertedAtTop = [];
  43867. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43868. module.exports = function(list, options) {
  43869. if (typeof DEBUG !== "undefined" && DEBUG) {
  43870. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43871. }
  43872. options = options || {};
  43873. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43874. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43875. // tags it will allow on a page
  43876. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43877. // By default, add <style> tags to the <head> element
  43878. if (!options.insertInto) options.insertInto = "head";
  43879. // By default, add <style> tags to the bottom of the target
  43880. if (!options.insertAt) options.insertAt = "bottom";
  43881. var styles = listToStyles(list, options);
  43882. addStylesToDom(styles, options);
  43883. return function update (newList) {
  43884. var mayRemove = [];
  43885. for (var i = 0; i < styles.length; i++) {
  43886. var item = styles[i];
  43887. var domStyle = stylesInDom[item.id];
  43888. domStyle.refs--;
  43889. mayRemove.push(domStyle);
  43890. }
  43891. if(newList) {
  43892. var newStyles = listToStyles(newList, options);
  43893. addStylesToDom(newStyles, options);
  43894. }
  43895. for (var i = 0; i < mayRemove.length; i++) {
  43896. var domStyle = mayRemove[i];
  43897. if(domStyle.refs === 0) {
  43898. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43899. delete stylesInDom[domStyle.id];
  43900. }
  43901. }
  43902. };
  43903. };
  43904. function addStylesToDom (styles, options) {
  43905. for (var i = 0; i < styles.length; i++) {
  43906. var item = styles[i];
  43907. var domStyle = stylesInDom[item.id];
  43908. if(domStyle) {
  43909. domStyle.refs++;
  43910. for(var j = 0; j < domStyle.parts.length; j++) {
  43911. domStyle.parts[j](item.parts[j]);
  43912. }
  43913. for(; j < item.parts.length; j++) {
  43914. domStyle.parts.push(addStyle(item.parts[j], options));
  43915. }
  43916. } else {
  43917. var parts = [];
  43918. for(var j = 0; j < item.parts.length; j++) {
  43919. parts.push(addStyle(item.parts[j], options));
  43920. }
  43921. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43922. }
  43923. }
  43924. }
  43925. function listToStyles (list, options) {
  43926. var styles = [];
  43927. var newStyles = {};
  43928. for (var i = 0; i < list.length; i++) {
  43929. var item = list[i];
  43930. var id = options.base ? item[0] + options.base : item[0];
  43931. var css = item[1];
  43932. var media = item[2];
  43933. var sourceMap = item[3];
  43934. var part = {css: css, media: media, sourceMap: sourceMap};
  43935. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43936. else newStyles[id].parts.push(part);
  43937. }
  43938. return styles;
  43939. }
  43940. function insertStyleElement (options, style) {
  43941. var target = getElement(options.insertInto)
  43942. if (!target) {
  43943. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43944. }
  43945. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43946. if (options.insertAt === "top") {
  43947. if (!lastStyleElementInsertedAtTop) {
  43948. target.insertBefore(style, target.firstChild);
  43949. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43950. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43951. } else {
  43952. target.appendChild(style);
  43953. }
  43954. stylesInsertedAtTop.push(style);
  43955. } else if (options.insertAt === "bottom") {
  43956. target.appendChild(style);
  43957. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43958. var nextSibling = getElement(options.insertAt.before, target);
  43959. target.insertBefore(style, nextSibling);
  43960. } else {
  43961. 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");
  43962. }
  43963. }
  43964. function removeStyleElement (style) {
  43965. if (style.parentNode === null) return false;
  43966. style.parentNode.removeChild(style);
  43967. var idx = stylesInsertedAtTop.indexOf(style);
  43968. if(idx >= 0) {
  43969. stylesInsertedAtTop.splice(idx, 1);
  43970. }
  43971. }
  43972. function createStyleElement (options) {
  43973. var style = document.createElement("style");
  43974. if(options.attrs.type === undefined) {
  43975. options.attrs.type = "text/css";
  43976. }
  43977. if(options.attrs.nonce === undefined) {
  43978. var nonce = getNonce();
  43979. if (nonce) {
  43980. options.attrs.nonce = nonce;
  43981. }
  43982. }
  43983. addAttrs(style, options.attrs);
  43984. insertStyleElement(options, style);
  43985. return style;
  43986. }
  43987. function createLinkElement (options) {
  43988. var link = document.createElement("link");
  43989. if(options.attrs.type === undefined) {
  43990. options.attrs.type = "text/css";
  43991. }
  43992. options.attrs.rel = "stylesheet";
  43993. addAttrs(link, options.attrs);
  43994. insertStyleElement(options, link);
  43995. return link;
  43996. }
  43997. function addAttrs (el, attrs) {
  43998. Object.keys(attrs).forEach(function (key) {
  43999. el.setAttribute(key, attrs[key]);
  44000. });
  44001. }
  44002. function getNonce() {
  44003. if (false) {}
  44004. return __webpack_require__.nc;
  44005. }
  44006. function addStyle (obj, options) {
  44007. var style, update, remove, result;
  44008. // If a transform function was defined, run it on the css
  44009. if (options.transform && obj.css) {
  44010. result = typeof options.transform === 'function'
  44011. ? options.transform(obj.css)
  44012. : options.transform.default(obj.css);
  44013. if (result) {
  44014. // If transform returns a value, use that instead of the original css.
  44015. // This allows running runtime transformations on the css.
  44016. obj.css = result;
  44017. } else {
  44018. // If the transform function returns a falsy value, don't add this css.
  44019. // This allows conditional loading of css
  44020. return function() {
  44021. // noop
  44022. };
  44023. }
  44024. }
  44025. if (options.singleton) {
  44026. var styleIndex = singletonCounter++;
  44027. style = singleton || (singleton = createStyleElement(options));
  44028. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44029. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44030. } else if (
  44031. obj.sourceMap &&
  44032. typeof URL === "function" &&
  44033. typeof URL.createObjectURL === "function" &&
  44034. typeof URL.revokeObjectURL === "function" &&
  44035. typeof Blob === "function" &&
  44036. typeof btoa === "function"
  44037. ) {
  44038. style = createLinkElement(options);
  44039. update = updateLink.bind(null, style, options);
  44040. remove = function () {
  44041. removeStyleElement(style);
  44042. if(style.href) URL.revokeObjectURL(style.href);
  44043. };
  44044. } else {
  44045. style = createStyleElement(options);
  44046. update = applyToTag.bind(null, style);
  44047. remove = function () {
  44048. removeStyleElement(style);
  44049. };
  44050. }
  44051. update(obj);
  44052. return function updateStyle (newObj) {
  44053. if (newObj) {
  44054. if (
  44055. newObj.css === obj.css &&
  44056. newObj.media === obj.media &&
  44057. newObj.sourceMap === obj.sourceMap
  44058. ) {
  44059. return;
  44060. }
  44061. update(obj = newObj);
  44062. } else {
  44063. remove();
  44064. }
  44065. };
  44066. }
  44067. var replaceText = (function () {
  44068. var textStore = [];
  44069. return function (index, replacement) {
  44070. textStore[index] = replacement;
  44071. return textStore.filter(Boolean).join('\n');
  44072. };
  44073. })();
  44074. function applyToSingletonTag (style, index, remove, obj) {
  44075. var css = remove ? "" : obj.css;
  44076. if (style.styleSheet) {
  44077. style.styleSheet.cssText = replaceText(index, css);
  44078. } else {
  44079. var cssNode = document.createTextNode(css);
  44080. var childNodes = style.childNodes;
  44081. if (childNodes[index]) style.removeChild(childNodes[index]);
  44082. if (childNodes.length) {
  44083. style.insertBefore(cssNode, childNodes[index]);
  44084. } else {
  44085. style.appendChild(cssNode);
  44086. }
  44087. }
  44088. }
  44089. function applyToTag (style, obj) {
  44090. var css = obj.css;
  44091. var media = obj.media;
  44092. if(media) {
  44093. style.setAttribute("media", media)
  44094. }
  44095. if(style.styleSheet) {
  44096. style.styleSheet.cssText = css;
  44097. } else {
  44098. while(style.firstChild) {
  44099. style.removeChild(style.firstChild);
  44100. }
  44101. style.appendChild(document.createTextNode(css));
  44102. }
  44103. }
  44104. function updateLink (link, options, obj) {
  44105. var css = obj.css;
  44106. var sourceMap = obj.sourceMap;
  44107. /*
  44108. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44109. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44110. on by default. Otherwise default to the convertToAbsoluteUrls option
  44111. directly
  44112. */
  44113. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44114. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44115. css = fixUrls(css);
  44116. }
  44117. if (sourceMap) {
  44118. // http://stackoverflow.com/a/26603875
  44119. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44120. }
  44121. var blob = new Blob([css], { type: "text/css" });
  44122. var oldSrc = link.href;
  44123. link.href = URL.createObjectURL(blob);
  44124. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44125. }
  44126. /***/ }),
  44127. /***/ "./node_modules/style-loader/lib/urls.js":
  44128. /*!***********************************************!*\
  44129. !*** ./node_modules/style-loader/lib/urls.js ***!
  44130. \***********************************************/
  44131. /*! no static exports found */
  44132. /***/ (function(module, exports) {
  44133. /**
  44134. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44135. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44136. * bundle instead of the current page.
  44137. *
  44138. * One solution is to only use full urls, but that may be impossible.
  44139. *
  44140. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44141. *
  44142. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44143. *
  44144. */
  44145. module.exports = function (css) {
  44146. // get current location
  44147. var location = typeof window !== "undefined" && window.location;
  44148. if (!location) {
  44149. throw new Error("fixUrls requires window.location");
  44150. }
  44151. // blank or null?
  44152. if (!css || typeof css !== "string") {
  44153. return css;
  44154. }
  44155. var baseUrl = location.protocol + "//" + location.host;
  44156. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44157. // convert each url(...)
  44158. /*
  44159. This regular expression is just a way to recursively match brackets within
  44160. a string.
  44161. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44162. ( = Start a capturing group
  44163. (?: = Start a non-capturing group
  44164. [^)(] = Match anything that isn't a parentheses
  44165. | = OR
  44166. \( = Match a start parentheses
  44167. (?: = Start another non-capturing groups
  44168. [^)(]+ = Match anything that isn't a parentheses
  44169. | = OR
  44170. \( = Match a start parentheses
  44171. [^)(]* = Match anything that isn't a parentheses
  44172. \) = Match a end parentheses
  44173. ) = End Group
  44174. *\) = Match anything and then a close parens
  44175. ) = Close non-capturing group
  44176. * = Match anything
  44177. ) = Close capturing group
  44178. \) = Match a close parens
  44179. /gi = Get all matches, not the first. Be case insensitive.
  44180. */
  44181. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44182. // strip quotes (if they exist)
  44183. var unquotedOrigUrl = origUrl
  44184. .trim()
  44185. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44186. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44187. // already a full url? no change
  44188. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44189. return fullMatch;
  44190. }
  44191. // convert the url to a full url
  44192. var newUrl;
  44193. if (unquotedOrigUrl.indexOf("//") === 0) {
  44194. //TODO: should we add protocol?
  44195. newUrl = unquotedOrigUrl;
  44196. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44197. // path should be relative to the base url
  44198. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44199. } else {
  44200. // path should be relative to current directory
  44201. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44202. }
  44203. // send back the fixed url(...)
  44204. return "url(" + JSON.stringify(newUrl) + ")";
  44205. });
  44206. // send back the fixed css
  44207. return fixedCss;
  44208. };
  44209. /***/ }),
  44210. /***/ "./node_modules/timers-browserify/main.js":
  44211. /*!************************************************!*\
  44212. !*** ./node_modules/timers-browserify/main.js ***!
  44213. \************************************************/
  44214. /*! no static exports found */
  44215. /***/ (function(module, exports, __webpack_require__) {
  44216. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44217. (typeof self !== "undefined" && self) ||
  44218. window;
  44219. var apply = Function.prototype.apply;
  44220. // DOM APIs, for completeness
  44221. exports.setTimeout = function() {
  44222. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44223. };
  44224. exports.setInterval = function() {
  44225. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44226. };
  44227. exports.clearTimeout =
  44228. exports.clearInterval = function(timeout) {
  44229. if (timeout) {
  44230. timeout.close();
  44231. }
  44232. };
  44233. function Timeout(id, clearFn) {
  44234. this._id = id;
  44235. this._clearFn = clearFn;
  44236. }
  44237. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44238. Timeout.prototype.close = function() {
  44239. this._clearFn.call(scope, this._id);
  44240. };
  44241. // Does not start the time, just sets up the members needed.
  44242. exports.enroll = function(item, msecs) {
  44243. clearTimeout(item._idleTimeoutId);
  44244. item._idleTimeout = msecs;
  44245. };
  44246. exports.unenroll = function(item) {
  44247. clearTimeout(item._idleTimeoutId);
  44248. item._idleTimeout = -1;
  44249. };
  44250. exports._unrefActive = exports.active = function(item) {
  44251. clearTimeout(item._idleTimeoutId);
  44252. var msecs = item._idleTimeout;
  44253. if (msecs >= 0) {
  44254. item._idleTimeoutId = setTimeout(function onTimeout() {
  44255. if (item._onTimeout)
  44256. item._onTimeout();
  44257. }, msecs);
  44258. }
  44259. };
  44260. // setimmediate attaches itself to the global object
  44261. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44262. // On some exotic environments, it's not clear which object `setimmediate` was
  44263. // able to install onto. Search each possibility in the same order as the
  44264. // `setimmediate` library.
  44265. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44266. (typeof global !== "undefined" && global.setImmediate) ||
  44267. (this && this.setImmediate);
  44268. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44269. (typeof global !== "undefined" && global.clearImmediate) ||
  44270. (this && this.clearImmediate);
  44271. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44272. /***/ }),
  44273. /***/ "./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&":
  44274. /*!************************************************************************************************************************************************************************************************************!*\
  44275. !*** ./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& ***!
  44276. \************************************************************************************************************************************************************************************************************/
  44277. /*! exports provided: render, staticRenderFns */
  44278. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44279. "use strict";
  44280. __webpack_require__.r(__webpack_exports__);
  44281. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44282. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44283. var render = function() {
  44284. var _vm = this
  44285. var _h = _vm.$createElement
  44286. var _c = _vm._self._c || _h
  44287. return _c(
  44288. "div",
  44289. [
  44290. _c("asset-info-edit-modal", {
  44291. attrs: {
  44292. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44293. "populate-with": _vm.asset
  44294. }
  44295. }),
  44296. _vm._v(" "),
  44297. _c("h4", { staticClass: "text-center" }, [
  44298. _vm._v(
  44299. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44300. ),
  44301. _c("small", { staticClass: "text-muted" }, [
  44302. _vm._v(_vm._s(this.asset.pcnickname))
  44303. ])
  44304. ]),
  44305. _vm._v(" "),
  44306. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44307. _vm._v(" "),
  44308. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44309. _vm._v(" "),
  44310. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44311. _vm._v(" "),
  44312. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44313. _vm._v(" "),
  44314. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44315. _vm._v(" "),
  44316. _c(
  44317. "button",
  44318. {
  44319. staticClass: "btn btn-primary",
  44320. attrs: {
  44321. type: "button",
  44322. "data-toggle": "modal",
  44323. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44324. }
  44325. },
  44326. [_vm._v("Edit")]
  44327. )
  44328. ],
  44329. 1
  44330. )
  44331. }
  44332. var staticRenderFns = []
  44333. render._withStripped = true
  44334. /***/ }),
  44335. /***/ "./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&":
  44336. /*!*********************************************************************************************************************************************************************************************************************!*\
  44337. !*** ./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& ***!
  44338. \*********************************************************************************************************************************************************************************************************************/
  44339. /*! exports provided: render, staticRenderFns */
  44340. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44341. "use strict";
  44342. __webpack_require__.r(__webpack_exports__);
  44343. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44345. var render = function() {
  44346. var _vm = this
  44347. var _h = _vm.$createElement
  44348. var _c = _vm._self._c || _h
  44349. return _c(
  44350. "modal",
  44351. {
  44352. attrs: {
  44353. id: _vm.modalId,
  44354. tabindex: "-1",
  44355. role: "dialog",
  44356. "aria-labelledby": _vm.modalId + "Label"
  44357. }
  44358. },
  44359. [
  44360. _c(
  44361. "h5",
  44362. {
  44363. staticClass: "modal-title",
  44364. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44365. slot: "header"
  44366. },
  44367. [_vm._v("\n Edit Work Order Information\n ")]
  44368. ),
  44369. _vm._v(" "),
  44370. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44371. _c("div", { staticClass: "form-group" }, [
  44372. _c("label", { attrs: { for: "manufacturer" } }, [
  44373. _vm._v("Manufacturer")
  44374. ]),
  44375. _vm._v(" "),
  44376. _c("input", {
  44377. directives: [
  44378. {
  44379. name: "model",
  44380. rawName: "v-model",
  44381. value: _vm.asset.pcmanu,
  44382. expression: "asset.pcmanu"
  44383. }
  44384. ],
  44385. staticClass: "form-control",
  44386. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44387. domProps: { value: _vm.asset.pcmanu },
  44388. on: {
  44389. input: function($event) {
  44390. if ($event.target.composing) {
  44391. return
  44392. }
  44393. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44394. }
  44395. }
  44396. })
  44397. ]),
  44398. _vm._v(" "),
  44399. _c("div", { staticClass: "form-group" }, [
  44400. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44401. _vm._v(" "),
  44402. _c("input", {
  44403. directives: [
  44404. {
  44405. name: "model",
  44406. rawName: "v-model",
  44407. value: _vm.asset.pcmake,
  44408. expression: "asset.pcmake"
  44409. }
  44410. ],
  44411. staticClass: "form-control",
  44412. attrs: { type: "text", name: "make", id: "make" },
  44413. domProps: { value: _vm.asset.pcmake },
  44414. on: {
  44415. input: function($event) {
  44416. if ($event.target.composing) {
  44417. return
  44418. }
  44419. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44420. }
  44421. }
  44422. })
  44423. ]),
  44424. _vm._v(" "),
  44425. _c("div", { staticClass: "form-group" }, [
  44426. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44427. _vm._v(" "),
  44428. _c("input", {
  44429. directives: [
  44430. {
  44431. name: "model",
  44432. rawName: "v-model",
  44433. value: _vm.asset.pcnickname,
  44434. expression: "asset.pcnickname"
  44435. }
  44436. ],
  44437. staticClass: "form-control",
  44438. attrs: { type: "text", name: "nickname", id: "nickname" },
  44439. domProps: { value: _vm.asset.pcnickname },
  44440. on: {
  44441. input: function($event) {
  44442. if ($event.target.composing) {
  44443. return
  44444. }
  44445. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44446. }
  44447. }
  44448. })
  44449. ]),
  44450. _vm._v(" "),
  44451. _c("div", { staticClass: "form-group" }, [
  44452. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44453. _vm._v(" "),
  44454. _c("input", {
  44455. directives: [
  44456. {
  44457. name: "model",
  44458. rawName: "v-model",
  44459. value: _vm.asset.pcextra[2],
  44460. expression: "asset.pcextra[2]"
  44461. }
  44462. ],
  44463. staticClass: "form-control",
  44464. attrs: { type: "text", name: "os", id: "os" },
  44465. domProps: { value: _vm.asset.pcextra[2] },
  44466. on: {
  44467. input: function($event) {
  44468. if ($event.target.composing) {
  44469. return
  44470. }
  44471. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44472. }
  44473. }
  44474. })
  44475. ]),
  44476. _vm._v(" "),
  44477. _c("div", { staticClass: "form-group" }, [
  44478. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44479. _vm._v(" "),
  44480. _c("input", {
  44481. directives: [
  44482. {
  44483. name: "model",
  44484. rawName: "v-model",
  44485. value: _vm.asset.pcextra[104],
  44486. expression: "asset.pcextra[104]"
  44487. }
  44488. ],
  44489. staticClass: "form-control",
  44490. attrs: { type: "text", id: "serial", name: "serial" },
  44491. domProps: { value: _vm.asset.pcextra[104] },
  44492. on: {
  44493. input: function($event) {
  44494. if ($event.target.composing) {
  44495. return
  44496. }
  44497. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44498. }
  44499. }
  44500. })
  44501. ]),
  44502. _vm._v(" "),
  44503. _c("div", { staticClass: "form-group" }, [
  44504. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44505. _vm._v(" "),
  44506. _c("input", {
  44507. directives: [
  44508. {
  44509. name: "model",
  44510. rawName: "v-model",
  44511. value: _vm.asset.pcextra[101],
  44512. expression: "asset.pcextra[101]"
  44513. }
  44514. ],
  44515. staticClass: "form-control",
  44516. attrs: { type: "text", id: "cpu", name: "cpu" },
  44517. domProps: { value: _vm.asset.pcextra[101] },
  44518. on: {
  44519. input: function($event) {
  44520. if ($event.target.composing) {
  44521. return
  44522. }
  44523. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44524. }
  44525. }
  44526. })
  44527. ]),
  44528. _vm._v(" "),
  44529. _c("div", { staticClass: "form-group" }, [
  44530. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44531. _vm._v(" "),
  44532. _c("input", {
  44533. directives: [
  44534. {
  44535. name: "model",
  44536. rawName: "v-model",
  44537. value: _vm.asset.pcextra[100],
  44538. expression: "asset.pcextra[100]"
  44539. }
  44540. ],
  44541. staticClass: "form-control",
  44542. attrs: { type: "text", name: "ram", id: "ram" },
  44543. domProps: { value: _vm.asset.pcextra[100] },
  44544. on: {
  44545. input: function($event) {
  44546. if ($event.target.composing) {
  44547. return
  44548. }
  44549. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44550. }
  44551. }
  44552. })
  44553. ]),
  44554. _vm._v(" "),
  44555. _c("div", { staticClass: "form-group" }, [
  44556. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44557. _vm._v(" "),
  44558. _c("input", {
  44559. directives: [
  44560. {
  44561. name: "model",
  44562. rawName: "v-model",
  44563. value: _vm.asset.pcextra[4],
  44564. expression: "asset.pcextra[4]"
  44565. }
  44566. ],
  44567. staticClass: "form-control",
  44568. attrs: { type: "text", name: "graphics", id: "grapics" },
  44569. domProps: { value: _vm.asset.pcextra[4] },
  44570. on: {
  44571. input: function($event) {
  44572. if ($event.target.composing) {
  44573. return
  44574. }
  44575. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44576. }
  44577. }
  44578. })
  44579. ])
  44580. ]),
  44581. _vm._v(" "),
  44582. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44583. _c(
  44584. "button",
  44585. {
  44586. staticClass: "btn btn-secondary",
  44587. attrs: { type: "button", "data-dismiss": "modal" }
  44588. },
  44589. [_vm._v("Close")]
  44590. ),
  44591. _vm._v(" "),
  44592. _c(
  44593. "button",
  44594. {
  44595. staticClass: "btn btn-primary",
  44596. attrs: { type: "button" },
  44597. on: {
  44598. click: function($event) {
  44599. return _vm.updateAsset()
  44600. }
  44601. }
  44602. },
  44603. [
  44604. !_vm.assetSaving
  44605. ? _c("div", [_vm._v("Save")])
  44606. : _c("circle-spinner", { attrs: { size: 2 } })
  44607. ],
  44608. 1
  44609. )
  44610. ])
  44611. ]
  44612. )
  44613. }
  44614. var staticRenderFns = []
  44615. render._withStripped = true
  44616. /***/ }),
  44617. /***/ "./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&":
  44618. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44619. !*** ./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& ***!
  44620. \*****************************************************************************************************************************************************************************************************************************/
  44621. /*! exports provided: render, staticRenderFns */
  44622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44623. "use strict";
  44624. __webpack_require__.r(__webpack_exports__);
  44625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44627. var render = function() {
  44628. var _vm = this
  44629. var _h = _vm.$createElement
  44630. var _c = _vm._self._c || _h
  44631. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44632. _c("div", { staticClass: "input-group" }, [
  44633. _c("input", {
  44634. directives: [
  44635. {
  44636. name: "model",
  44637. rawName: "v-model",
  44638. value: _vm.searchText,
  44639. expression: "searchText"
  44640. }
  44641. ],
  44642. staticClass: "form-control",
  44643. attrs: { type: "text" },
  44644. domProps: { value: _vm.searchText },
  44645. on: {
  44646. input: [
  44647. function($event) {
  44648. if ($event.target.composing) {
  44649. return
  44650. }
  44651. _vm.searchText = $event.target.value
  44652. },
  44653. _vm.searchChanged
  44654. ]
  44655. }
  44656. }),
  44657. _vm._v(" "),
  44658. _c("div", { staticClass: "form-group-append" }, [
  44659. _c(
  44660. "a",
  44661. {
  44662. staticClass: "toggle input-group-text bg-primary text-light",
  44663. on: {
  44664. mousedown: function($event) {
  44665. $event.preventDefault()
  44666. },
  44667. click: function($event) {
  44668. return _vm.setOpen(!_vm.open)
  44669. }
  44670. }
  44671. },
  44672. [
  44673. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44674. _vm._v(" "),
  44675. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44676. ]
  44677. )
  44678. ])
  44679. ]),
  44680. _vm._v(" "),
  44681. _c(
  44682. "ul",
  44683. { staticClass: "suggestion-list list-unstyled" },
  44684. _vm._l(_vm.matches, function(suggestion, index) {
  44685. return _c(
  44686. "li",
  44687. {
  44688. key: index,
  44689. on: {
  44690. mousedown: function($event) {
  44691. $event.preventDefault()
  44692. },
  44693. click: function($event) {
  44694. return _vm.suggestionSelected(suggestion)
  44695. }
  44696. }
  44697. },
  44698. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44699. )
  44700. }),
  44701. 0
  44702. )
  44703. ])
  44704. }
  44705. var staticRenderFns = []
  44706. render._withStripped = true
  44707. /***/ }),
  44708. /***/ "./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&":
  44709. /*!****************************************************************************************************************************************************************************************************************************!*\
  44710. !*** ./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& ***!
  44711. \****************************************************************************************************************************************************************************************************************************/
  44712. /*! exports provided: render, staticRenderFns */
  44713. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44714. "use strict";
  44715. __webpack_require__.r(__webpack_exports__);
  44716. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44718. var render = function() {
  44719. var _vm = this
  44720. var _h = _vm.$createElement
  44721. var _c = _vm._self._c || _h
  44722. return _c(
  44723. "div",
  44724. {
  44725. staticClass: "loader",
  44726. style: {
  44727. fontSize: _vm.size + "px",
  44728. borderLeft: "1.1em solid " + _vm.color
  44729. }
  44730. },
  44731. [_vm._v("Loading...")]
  44732. )
  44733. }
  44734. var staticRenderFns = []
  44735. render._withStripped = true
  44736. /***/ }),
  44737. /***/ "./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&":
  44738. /*!*************************************************************************************************************************************************************************************************************!*\
  44739. !*** ./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& ***!
  44740. \*************************************************************************************************************************************************************************************************************/
  44741. /*! exports provided: render, staticRenderFns */
  44742. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44743. "use strict";
  44744. __webpack_require__.r(__webpack_exports__);
  44745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44747. var render = function() {
  44748. var _vm = this
  44749. var _h = _vm.$createElement
  44750. var _c = _vm._self._c || _h
  44751. return _c(
  44752. "div",
  44753. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44754. [
  44755. _c("credential-form-modal", {
  44756. attrs: {
  44757. descriptions: _vm.creddescList,
  44758. "modal-id": "credential" + this.data.credid + "editModal",
  44759. populateWith: this.data
  44760. }
  44761. }),
  44762. _vm._v(" "),
  44763. _c(
  44764. "modal",
  44765. {
  44766. attrs: {
  44767. id: "credential" + this.data.credid + "deleteModal",
  44768. tabindex: "-1"
  44769. }
  44770. },
  44771. [
  44772. _c(
  44773. "h5",
  44774. {
  44775. staticClass: "modal-title",
  44776. attrs: {
  44777. slot: "header",
  44778. id: "credential" + this.data.credid + "deleteModalLabel"
  44779. },
  44780. slot: "header"
  44781. },
  44782. [_vm._v("\r\n Delete Credential\r\n ")]
  44783. ),
  44784. _vm._v(" "),
  44785. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44786. _vm._v("\r\n Are you sure?\r\n ")
  44787. ]),
  44788. _vm._v(" "),
  44789. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44790. _c(
  44791. "button",
  44792. {
  44793. staticClass: "btn btn-secondary",
  44794. attrs: { type: "button", "data-dismiss": "modal" }
  44795. },
  44796. [_vm._v("Cancel")]
  44797. ),
  44798. _vm._v(" "),
  44799. _c(
  44800. "button",
  44801. {
  44802. staticClass: "btn btn-danger",
  44803. attrs: { type: "button" },
  44804. on: {
  44805. click: function($event) {
  44806. return _vm.deleteCredential()
  44807. }
  44808. }
  44809. },
  44810. [_vm._v("Confirm")]
  44811. )
  44812. ])
  44813. ]
  44814. ),
  44815. _vm._v(" "),
  44816. _c("div", { staticClass: "row no-gutters" }, [
  44817. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44818. _vm._v(_vm._s(this.data.creddesc))
  44819. ]),
  44820. _vm._v(" "),
  44821. _c("div", { staticClass: "col-9 text-right" }, [
  44822. _vm._v(_vm._s(this.data.creddate))
  44823. ])
  44824. ]),
  44825. _vm._v(" "),
  44826. _c("div", { staticClass: "row" }, [
  44827. _c("div", { staticClass: "col-lg-9" }, [
  44828. _c("div", [
  44829. _vm._m(0),
  44830. _vm._v(" "),
  44831. _c("input", {
  44832. staticClass: "border-0 credential",
  44833. attrs: {
  44834. type: "text",
  44835. id: "username" + this.data.credid,
  44836. readonly: ""
  44837. },
  44838. domProps: { value: this.data.creduser }
  44839. }),
  44840. _vm._v(" "),
  44841. _c(
  44842. "button",
  44843. {
  44844. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44845. attrs: {
  44846. id: "btn-username" + this.data.credid,
  44847. "data-clipboard-target": "#username" + this.data.credid
  44848. }
  44849. },
  44850. [_c("i", { staticClass: "far fa-clone" })]
  44851. )
  44852. ]),
  44853. _vm._v(" "),
  44854. _c("div", [
  44855. _vm._m(1),
  44856. _vm._v(" "),
  44857. _c("input", {
  44858. staticClass: "border-0 credential",
  44859. attrs: {
  44860. type: "text",
  44861. id: "password" + this.data.credid,
  44862. readonly: ""
  44863. },
  44864. domProps: { value: this.data.credpass }
  44865. }),
  44866. _vm._v(" "),
  44867. _c(
  44868. "button",
  44869. {
  44870. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44871. attrs: {
  44872. id: "btn-password" + this.data.credid,
  44873. "data-clipboard-target": "#password" + this.data.credid
  44874. }
  44875. },
  44876. [_c("i", { staticClass: "far fa-clone" })]
  44877. )
  44878. ])
  44879. ]),
  44880. _vm._v(" "),
  44881. _c(
  44882. "div",
  44883. {
  44884. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44885. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44886. },
  44887. [
  44888. _c(
  44889. "button",
  44890. {
  44891. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44892. attrs: {
  44893. type: "button",
  44894. "data-toggle": "modal",
  44895. "data-target": "#credential" + this.data.credid + "editModal"
  44896. }
  44897. },
  44898. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44899. ),
  44900. _vm._v(" "),
  44901. _c(
  44902. "button",
  44903. {
  44904. staticClass: "btn btn-sm btn-danger p-lg-1",
  44905. attrs: {
  44906. type: "button",
  44907. "data-toggle": "modal",
  44908. "data-target":
  44909. "#credential" + this.data.credid + "deleteModal"
  44910. }
  44911. },
  44912. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44913. )
  44914. ]
  44915. )
  44916. ])
  44917. ],
  44918. 1
  44919. )
  44920. }
  44921. var staticRenderFns = [
  44922. function() {
  44923. var _vm = this
  44924. var _h = _vm.$createElement
  44925. var _c = _vm._self._c || _h
  44926. return _c("label", { attrs: { for: "username" } }, [
  44927. _c("i", { staticClass: "fas fa-fw fa-user" })
  44928. ])
  44929. },
  44930. function() {
  44931. var _vm = this
  44932. var _h = _vm.$createElement
  44933. var _c = _vm._self._c || _h
  44934. return _c("label", { attrs: { for: "password" } }, [
  44935. _c("i", { staticClass: "fas fa-fw fa-key" })
  44936. ])
  44937. }
  44938. ]
  44939. render._withStripped = true
  44940. /***/ }),
  44941. /***/ "./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&":
  44942. /*!**********************************************************************************************************************************************************************************************************************!*\
  44943. !*** ./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& ***!
  44944. \**********************************************************************************************************************************************************************************************************************/
  44945. /*! exports provided: render, staticRenderFns */
  44946. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44947. "use strict";
  44948. __webpack_require__.r(__webpack_exports__);
  44949. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44950. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44951. var render = function() {
  44952. var _vm = this
  44953. var _h = _vm.$createElement
  44954. var _c = _vm._self._c || _h
  44955. return _c(
  44956. "modal",
  44957. {
  44958. attrs: {
  44959. id: _vm.id,
  44960. tabindex: "-1",
  44961. role: "dialog",
  44962. "aria-labelledby": _vm.id + "Label"
  44963. }
  44964. },
  44965. [
  44966. _c(
  44967. "h5",
  44968. {
  44969. staticClass: "modal-title",
  44970. attrs: { slot: "header", id: _vm.id + "Label" },
  44971. slot: "header"
  44972. },
  44973. [_vm._v("\n Edit Credential\n ")]
  44974. ),
  44975. _vm._v(" "),
  44976. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44977. _c(
  44978. "div",
  44979. { staticClass: "form" },
  44980. [
  44981. _c("autocomplete-custom-dropdown", {
  44982. attrs: {
  44983. options: _vm.descriptions,
  44984. value: _vm.creddesc,
  44985. "allow-custom": true
  44986. },
  44987. model: {
  44988. value: _vm.creddesc,
  44989. callback: function($$v) {
  44990. _vm.creddesc = $$v
  44991. },
  44992. expression: "creddesc"
  44993. }
  44994. })
  44995. ],
  44996. 1
  44997. ),
  44998. _vm._v(" "),
  44999. _c("div", { staticClass: "form-group" }, [
  45000. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45001. _vm._v(" "),
  45002. _c("input", {
  45003. directives: [
  45004. {
  45005. name: "model",
  45006. rawName: "v-model",
  45007. value: _vm.data.creduser,
  45008. expression: "data.creduser"
  45009. }
  45010. ],
  45011. staticClass: "form-control credential",
  45012. attrs: {
  45013. type: "text",
  45014. name: "newusername" + _vm.data.credid,
  45015. id: "newusername" + _vm.data.credid
  45016. },
  45017. domProps: { value: _vm.data.creduser },
  45018. on: {
  45019. input: function($event) {
  45020. if ($event.target.composing) {
  45021. return
  45022. }
  45023. _vm.$set(_vm.data, "creduser", $event.target.value)
  45024. }
  45025. }
  45026. })
  45027. ]),
  45028. _vm._v(" "),
  45029. _c("div", { staticClass: "form-group" }, [
  45030. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45031. _vm._v(" "),
  45032. _c("input", {
  45033. directives: [
  45034. {
  45035. name: "model",
  45036. rawName: "v-model",
  45037. value: _vm.data.credpass,
  45038. expression: "data.credpass"
  45039. }
  45040. ],
  45041. staticClass: "form-control credential",
  45042. attrs: {
  45043. type: "text",
  45044. name: "newpassword" + _vm.data.credid,
  45045. id: "newpassword" + _vm.data.credid
  45046. },
  45047. domProps: { value: _vm.data.credpass },
  45048. on: {
  45049. input: function($event) {
  45050. if ($event.target.composing) {
  45051. return
  45052. }
  45053. _vm.$set(_vm.data, "credpass", $event.target.value)
  45054. }
  45055. }
  45056. }),
  45057. _vm._v(" "),
  45058. _c(
  45059. "button",
  45060. {
  45061. staticClass: "btn btn-secondary",
  45062. attrs: { type: "button" },
  45063. on: {
  45064. click: function($event) {
  45065. return _vm.getRandomPassword(_vm.data.credid)
  45066. }
  45067. }
  45068. },
  45069. [_vm._v("Generate Random")]
  45070. )
  45071. ]),
  45072. _vm._v(" "),
  45073. _c("div", { staticClass: "form-group" })
  45074. ]),
  45075. _vm._v(" "),
  45076. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45077. _c(
  45078. "button",
  45079. {
  45080. staticClass: "btn btn-secondary",
  45081. attrs: { type: "button", "data-dismiss": "modal" }
  45082. },
  45083. [_vm._v("Close")]
  45084. ),
  45085. _vm._v(" "),
  45086. _c(
  45087. "button",
  45088. {
  45089. staticClass: "btn btn-primary",
  45090. attrs: { type: "button" },
  45091. on: {
  45092. click: function($event) {
  45093. return _vm.updateCredential()
  45094. }
  45095. }
  45096. },
  45097. [_vm._v("Save")]
  45098. )
  45099. ])
  45100. ]
  45101. )
  45102. }
  45103. var staticRenderFns = []
  45104. render._withStripped = true
  45105. /***/ }),
  45106. /***/ "./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&":
  45107. /*!*****************************************************************************************************************************************************************************************************************!*\
  45108. !*** ./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& ***!
  45109. \*****************************************************************************************************************************************************************************************************************/
  45110. /*! exports provided: render, staticRenderFns */
  45111. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45112. "use strict";
  45113. __webpack_require__.r(__webpack_exports__);
  45114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45116. var render = function() {
  45117. var _vm = this
  45118. var _h = _vm.$createElement
  45119. var _c = _vm._self._c || _h
  45120. return _c(
  45121. "div",
  45122. [
  45123. _c("credential-form-modal", {
  45124. attrs: {
  45125. "modal-id": "newCredentialModal",
  45126. descriptions: _vm.creddescList,
  45127. create: true,
  45128. pcid: _vm.pcid
  45129. }
  45130. }),
  45131. _vm._v(" "),
  45132. _c(
  45133. "button",
  45134. {
  45135. staticClass: "btn btn-primary",
  45136. attrs: {
  45137. type: "button",
  45138. "data-toggle": "modal",
  45139. "data-target": "#newCredentialModal"
  45140. }
  45141. },
  45142. [_vm._v("New Credential")]
  45143. ),
  45144. _vm._v(" "),
  45145. _vm._l(_vm.credentials, function(credential) {
  45146. return _c(
  45147. "div",
  45148. { key: credential.credid },
  45149. [
  45150. _c("credential", {
  45151. attrs: { credential: credential, descriptions: _vm.creddescList }
  45152. })
  45153. ],
  45154. 1
  45155. )
  45156. })
  45157. ],
  45158. 2
  45159. )
  45160. }
  45161. var staticRenderFns = []
  45162. render._withStripped = true
  45163. /***/ }),
  45164. /***/ "./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&":
  45165. /*!********************************************************************************************************************************************************************************************************!*\
  45166. !*** ./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& ***!
  45167. \********************************************************************************************************************************************************************************************************/
  45168. /*! exports provided: render, staticRenderFns */
  45169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45170. "use strict";
  45171. __webpack_require__.r(__webpack_exports__);
  45172. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45173. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45174. var render = function() {
  45175. var _vm = this
  45176. var _h = _vm.$createElement
  45177. var _c = _vm._self._c || _h
  45178. return _c("div", { staticClass: "modal fade" }, [
  45179. _c(
  45180. "div",
  45181. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45182. [
  45183. _c("div", { staticClass: "modal-content" }, [
  45184. _c(
  45185. "div",
  45186. { staticClass: "modal-header" },
  45187. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45188. 2
  45189. ),
  45190. _vm._v(" "),
  45191. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45192. _vm._v(" "),
  45193. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45194. ])
  45195. ]
  45196. )
  45197. ])
  45198. }
  45199. var staticRenderFns = [
  45200. function() {
  45201. var _vm = this
  45202. var _h = _vm.$createElement
  45203. var _c = _vm._self._c || _h
  45204. return _c(
  45205. "button",
  45206. {
  45207. staticClass: "close",
  45208. attrs: {
  45209. type: "button",
  45210. "data-dismiss": "modal",
  45211. "aria-label": "Close"
  45212. }
  45213. },
  45214. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45215. )
  45216. }
  45217. ]
  45218. render._withStripped = true
  45219. /***/ }),
  45220. /***/ "./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&":
  45221. /*!****************************************************************************************************************************************************************************************************************!*\
  45222. !*** ./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& ***!
  45223. \****************************************************************************************************************************************************************************************************************/
  45224. /*! exports provided: render, staticRenderFns */
  45225. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45226. "use strict";
  45227. __webpack_require__.r(__webpack_exports__);
  45228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45230. var render = function() {
  45231. var _vm = this
  45232. var _h = _vm.$createElement
  45233. var _c = _vm._self._c || _h
  45234. return _c(
  45235. "modal",
  45236. {
  45237. attrs: {
  45238. id: _vm.modalId,
  45239. tabindex: "-1",
  45240. role: "dialog",
  45241. "aria-labelledby": _vm.modalId + "Label"
  45242. }
  45243. },
  45244. [
  45245. _c(
  45246. "h5",
  45247. {
  45248. staticClass: "modal-title",
  45249. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45250. slot: "header"
  45251. },
  45252. [_vm._v("\n Edit Note\n ")]
  45253. ),
  45254. _vm._v(" "),
  45255. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45256. _c("div", { staticClass: "form-group" }, [
  45257. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  45258. _vm._v(" "),
  45259. _c("textarea", {
  45260. directives: [
  45261. {
  45262. name: "model",
  45263. rawName: "v-model",
  45264. value: _vm.note.thenote,
  45265. expression: "note.thenote"
  45266. }
  45267. ],
  45268. staticClass: "form-control",
  45269. attrs: {
  45270. name: "content" + _vm.note.noteid,
  45271. id: "content" + _vm.note.noteid
  45272. },
  45273. domProps: { value: _vm.note.thenote },
  45274. on: {
  45275. input: function($event) {
  45276. if ($event.target.composing) {
  45277. return
  45278. }
  45279. _vm.$set(_vm.note, "thenote", $event.target.value)
  45280. }
  45281. }
  45282. })
  45283. ])
  45284. ]),
  45285. _vm._v(" "),
  45286. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45287. _c(
  45288. "button",
  45289. {
  45290. staticClass: "btn btn-secondary",
  45291. attrs: { type: "button", "data-dismiss": "modal" }
  45292. },
  45293. [_vm._v("Close")]
  45294. ),
  45295. _vm._v(" "),
  45296. _c(
  45297. "button",
  45298. {
  45299. staticClass: "btn btn-primary",
  45300. attrs: { type: "button" },
  45301. on: {
  45302. click: function($event) {
  45303. return _vm.updateNote(_vm.note)
  45304. }
  45305. }
  45306. },
  45307. [_vm._v("Save")]
  45308. )
  45309. ])
  45310. ]
  45311. )
  45312. }
  45313. var staticRenderFns = []
  45314. render._withStripped = true
  45315. /***/ }),
  45316. /***/ "./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&":
  45317. /*!********************************************************************************************************************************************************************************************************!*\
  45318. !*** ./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& ***!
  45319. \********************************************************************************************************************************************************************************************************/
  45320. /*! exports provided: render, staticRenderFns */
  45321. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45322. "use strict";
  45323. __webpack_require__.r(__webpack_exports__);
  45324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45325. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45326. var render = function() {
  45327. var _vm = this
  45328. var _h = _vm.$createElement
  45329. var _c = _vm._self._c || _h
  45330. return _c(
  45331. "ul",
  45332. { staticClass: "list-unstyled" },
  45333. [
  45334. _c("div", { staticClass: "row" }, [
  45335. _c(
  45336. "div",
  45337. {
  45338. staticClass:
  45339. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45340. },
  45341. [
  45342. _c(
  45343. "button",
  45344. {
  45345. staticClass: "btn btn-primary m-2",
  45346. attrs: {
  45347. type: "button",
  45348. "data-toggle": "collapse",
  45349. "data-target": "#note" + _vm.noteType + "add"
  45350. }
  45351. },
  45352. [
  45353. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45354. _vm._v(" Add New Note")
  45355. ]
  45356. )
  45357. ]
  45358. ),
  45359. _vm._v(" "),
  45360. _c("div", { staticClass: "col-md-10" }, [
  45361. _c(
  45362. "div",
  45363. {
  45364. staticClass: "collapse",
  45365. attrs: { id: "note" + _vm.noteType + "add" }
  45366. },
  45367. [
  45368. _c(
  45369. "div",
  45370. {
  45371. staticClass:
  45372. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45373. },
  45374. [
  45375. _c("textarea", {
  45376. directives: [
  45377. {
  45378. name: "model",
  45379. rawName: "v-model",
  45380. value: _vm.newNote.thenote,
  45381. expression: "newNote.thenote"
  45382. }
  45383. ],
  45384. staticClass: "form-control",
  45385. attrs: {
  45386. name: "newnote" + _vm.noteType,
  45387. id: "newnote" + _vm.noteType
  45388. },
  45389. domProps: { value: _vm.newNote.thenote },
  45390. on: {
  45391. input: function($event) {
  45392. if ($event.target.composing) {
  45393. return
  45394. }
  45395. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45396. }
  45397. }
  45398. }),
  45399. _vm._v(" "),
  45400. _c(
  45401. "button",
  45402. {
  45403. staticClass: "btn btn-secondary m-2",
  45404. attrs: { type: "button" },
  45405. on: {
  45406. click: function($event) {
  45407. return _vm.createNote()
  45408. }
  45409. }
  45410. },
  45411. [_vm._v("Save")]
  45412. )
  45413. ]
  45414. )
  45415. ]
  45416. )
  45417. ])
  45418. ]),
  45419. _vm._v(" "),
  45420. _vm._l(this.notes, function(note, index) {
  45421. return _c(
  45422. "li",
  45423. { key: index, staticClass: "row no-gutters mb-2" },
  45424. [
  45425. _c("note-form-modal", {
  45426. attrs: {
  45427. "modal-id": "note" + note.noteid + "editModal",
  45428. "populate-with": note
  45429. }
  45430. }),
  45431. _vm._v(" "),
  45432. _c(
  45433. "div",
  45434. {
  45435. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45436. class: _vm.noteOrders[index]
  45437. },
  45438. [
  45439. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45440. _vm._v(_vm._s(note.noteuser))
  45441. ]),
  45442. _vm._v(" "),
  45443. _c(
  45444. "div",
  45445. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45446. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45447. ),
  45448. _vm._v(" "),
  45449. _c(
  45450. "div",
  45451. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45452. [
  45453. _vm.authusername === note.noteuser ||
  45454. _vm.authusername === "admin"
  45455. ? [
  45456. _c(
  45457. "button",
  45458. {
  45459. staticClass: "btn btn-sm btn-primary m-1",
  45460. attrs: {
  45461. "data-toggle": "modal",
  45462. "data-target":
  45463. "#note" + note.noteid + "editModal"
  45464. }
  45465. },
  45466. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45467. ),
  45468. _vm._v(" "),
  45469. _vm._m(0, true),
  45470. _vm._v(" "),
  45471. _vm._m(1, true)
  45472. ]
  45473. : _vm._e()
  45474. ],
  45475. 2
  45476. )
  45477. ]
  45478. ),
  45479. _vm._v(" "),
  45480. _c("div", { staticClass: "col-md-10" }, [
  45481. _c("div", { staticClass: "card m-2" }, [
  45482. _c("div", { staticClass: "card-body p-2" }, [
  45483. _vm._v(
  45484. "\n " +
  45485. _vm._s(note.thenote) +
  45486. "\n "
  45487. )
  45488. ])
  45489. ])
  45490. ])
  45491. ],
  45492. 1
  45493. )
  45494. })
  45495. ],
  45496. 2
  45497. )
  45498. }
  45499. var staticRenderFns = [
  45500. function() {
  45501. var _vm = this
  45502. var _h = _vm.$createElement
  45503. var _c = _vm._self._c || _h
  45504. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  45505. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  45506. ])
  45507. },
  45508. function() {
  45509. var _vm = this
  45510. var _h = _vm.$createElement
  45511. var _c = _vm._self._c || _h
  45512. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  45513. _c("i", { staticClass: "fa fa-fw fa-random" })
  45514. ])
  45515. }
  45516. ]
  45517. render._withStripped = true
  45518. /***/ }),
  45519. /***/ "./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&":
  45520. /*!******************************************************************************************************************************************************************************************************************!*\
  45521. !*** ./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& ***!
  45522. \******************************************************************************************************************************************************************************************************************/
  45523. /*! exports provided: render, staticRenderFns */
  45524. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45525. "use strict";
  45526. __webpack_require__.r(__webpack_exports__);
  45527. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45528. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45529. var render = function() {
  45530. var _vm = this
  45531. var _h = _vm.$createElement
  45532. var _c = _vm._self._c || _h
  45533. return _c(
  45534. "modal",
  45535. {
  45536. attrs: {
  45537. id: _vm.id,
  45538. tabindex: "-1",
  45539. role: "dialog",
  45540. "aria-labelledby": _vm.id + "Label"
  45541. }
  45542. },
  45543. [
  45544. _c(
  45545. "h5",
  45546. {
  45547. staticClass: "modal-title",
  45548. attrs: { slot: "header", id: _vm.id + "Label" },
  45549. slot: "header"
  45550. },
  45551. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45552. ),
  45553. _vm._v(" "),
  45554. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45555. _c(
  45556. "div",
  45557. { staticClass: "form-group" },
  45558. [
  45559. _c("label", { attrs: { for: "probdesc" } }, [
  45560. _vm._v("Problem Description")
  45561. ]),
  45562. _vm._v(" "),
  45563. _c("textarea", {
  45564. directives: [
  45565. {
  45566. name: "model",
  45567. rawName: "v-model",
  45568. value: _vm.data.probdesc,
  45569. expression: "data.probdesc"
  45570. }
  45571. ],
  45572. class: {
  45573. "form-control": true,
  45574. "is-invalid": _vm.errors.probdesc
  45575. },
  45576. attrs: { id: "probdesc", name: "probdesc" },
  45577. domProps: { value: _vm.data.probdesc },
  45578. on: {
  45579. input: function($event) {
  45580. if ($event.target.composing) {
  45581. return
  45582. }
  45583. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45584. }
  45585. }
  45586. }),
  45587. _vm._v(" "),
  45588. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  45589. ],
  45590. 1
  45591. ),
  45592. _vm._v(" "),
  45593. _c(
  45594. "div",
  45595. { staticClass: "form-group" },
  45596. [
  45597. _c("label", { attrs: { for: "suggested" } }, [
  45598. _vm._v("Suggested Solution")
  45599. ]),
  45600. _vm._v(" "),
  45601. _c("textarea", {
  45602. directives: [
  45603. {
  45604. name: "model",
  45605. rawName: "v-model",
  45606. value: _vm.data.suggested,
  45607. expression: "data.suggested"
  45608. }
  45609. ],
  45610. class: {
  45611. "form-control": true,
  45612. "is-invalid": _vm.errors.suggested
  45613. },
  45614. attrs: { id: "suggested", name: "suggested" },
  45615. domProps: { value: _vm.data.suggested },
  45616. on: {
  45617. input: function($event) {
  45618. if ($event.target.composing) {
  45619. return
  45620. }
  45621. _vm.$set(_vm.data, "suggested", $event.target.value)
  45622. }
  45623. }
  45624. }),
  45625. _vm._v(" "),
  45626. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  45627. ],
  45628. 1
  45629. ),
  45630. _vm._v(" "),
  45631. _c(
  45632. "div",
  45633. { staticClass: "form-group" },
  45634. [
  45635. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45636. _vm._v(" "),
  45637. _c("autocomplete-custom-dropdown", {
  45638. attrs: { options: _vm.storeList, value: this.store },
  45639. model: {
  45640. value: _vm.store,
  45641. callback: function($$v) {
  45642. _vm.store = $$v
  45643. },
  45644. expression: "store"
  45645. }
  45646. })
  45647. ],
  45648. 1
  45649. )
  45650. ]),
  45651. _vm._v(" "),
  45652. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45653. _c(
  45654. "button",
  45655. {
  45656. staticClass: "btn btn-secondary",
  45657. attrs: { type: "button", "data-dismiss": "modal" }
  45658. },
  45659. [_vm._v("Close")]
  45660. ),
  45661. _vm._v(" "),
  45662. _c(
  45663. "button",
  45664. {
  45665. staticClass: "btn btn-primary",
  45666. attrs: { type: "button" },
  45667. on: {
  45668. click: function($event) {
  45669. return _vm.updateWorkOrder()
  45670. }
  45671. }
  45672. },
  45673. [_vm._v("Save")]
  45674. )
  45675. ])
  45676. ]
  45677. )
  45678. }
  45679. var staticRenderFns = []
  45680. render._withStripped = true
  45681. /***/ }),
  45682. /***/ "./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&":
  45683. /*!****************************************************************************************************************************************************************************************************************!*\
  45684. !*** ./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& ***!
  45685. \****************************************************************************************************************************************************************************************************************/
  45686. /*! exports provided: render, staticRenderFns */
  45687. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45688. "use strict";
  45689. __webpack_require__.r(__webpack_exports__);
  45690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45692. var render = function() {
  45693. var _vm = this
  45694. var _h = _vm.$createElement
  45695. var _c = _vm._self._c || _h
  45696. return _c(
  45697. "div",
  45698. [
  45699. _c("wo-info-edit-modal", {
  45700. attrs: {
  45701. "modal-id": "workordereditModal",
  45702. "populate-with": _vm.workOrder,
  45703. "store-list": this.storeList
  45704. }
  45705. }),
  45706. _vm._v(" "),
  45707. _c("p", [
  45708. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45709. _vm._v(" "),
  45710. _c("span", {
  45711. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45712. })
  45713. ]),
  45714. _vm._v(" "),
  45715. _c("p", [
  45716. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45717. _vm._v(" "),
  45718. _c("span", {
  45719. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45720. })
  45721. ]),
  45722. _vm._v(" "),
  45723. _c("p", [
  45724. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45725. _vm._v(" "),
  45726. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45727. ]),
  45728. _vm._v(" "),
  45729. _c("p", [
  45730. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45731. _vm._v(" "),
  45732. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45733. ]),
  45734. _vm._v(" "),
  45735. _c("p", [
  45736. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45737. _vm._v(" "),
  45738. _c(
  45739. "span",
  45740. {
  45741. staticClass: "dashed-underline",
  45742. attrs: {
  45743. "data-toggle": "tooltip",
  45744. "data-placement": "bottom",
  45745. title: this.getHRDate(_vm.workOrder.dropdate)
  45746. }
  45747. },
  45748. [
  45749. _vm._v(
  45750. "\n " +
  45751. _vm._s(
  45752. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45753. ) +
  45754. " days ago\n "
  45755. )
  45756. ]
  45757. )
  45758. ]),
  45759. _vm._v(" "),
  45760. _c("p", [
  45761. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45762. _vm._v(" "),
  45763. !this.isZero(_vm.workOrder.pickupdate)
  45764. ? _c(
  45765. "span",
  45766. {
  45767. staticClass: "dashed-underline",
  45768. attrs: {
  45769. "data-toggle": "tooltip",
  45770. "data-placement": "bottom",
  45771. title: this.getHRDate(_vm.workOrder.pickupdate)
  45772. }
  45773. },
  45774. [
  45775. _vm._v(
  45776. "\n " +
  45777. _vm._s(
  45778. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45779. ) +
  45780. " days ago\n "
  45781. )
  45782. ]
  45783. )
  45784. : _vm._e()
  45785. ]),
  45786. _vm._v(" "),
  45787. _c(
  45788. "button",
  45789. {
  45790. staticClass: "btn btn-primary",
  45791. attrs: {
  45792. type: "button",
  45793. "data-toggle": "modal",
  45794. "data-target": "#workordereditModal"
  45795. }
  45796. },
  45797. [_vm._v("Edit")]
  45798. )
  45799. ],
  45800. 1
  45801. )
  45802. }
  45803. var staticRenderFns = []
  45804. render._withStripped = true
  45805. /***/ }),
  45806. /***/ "./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&":
  45807. /*!*************************************************************************************************************************************************************************************************!*\
  45808. !*** ./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& ***!
  45809. \*************************************************************************************************************************************************************************************************/
  45810. /*! exports provided: render, staticRenderFns */
  45811. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45812. "use strict";
  45813. __webpack_require__.r(__webpack_exports__);
  45814. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45815. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45816. var render = function() {
  45817. var _vm = this
  45818. var _h = _vm.$createElement
  45819. var _c = _vm._self._c || _h
  45820. return _c("div", [
  45821. _c(
  45822. "nav",
  45823. {
  45824. staticClass:
  45825. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45826. },
  45827. [
  45828. _c(
  45829. "div",
  45830. { staticClass: "container-fluid" },
  45831. [
  45832. _c(
  45833. "router-link",
  45834. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45835. [_vm._v("\n UPCCRT\n ")]
  45836. ),
  45837. _vm._v(" "),
  45838. _vm._m(0),
  45839. _vm._v(" "),
  45840. _c(
  45841. "div",
  45842. {
  45843. staticClass: "collapse navbar-collapse",
  45844. attrs: { id: "navbarSupportedContent" }
  45845. },
  45846. [
  45847. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45848. _vm._m(1),
  45849. _vm._v(" "),
  45850. _vm._m(2),
  45851. _vm._v(" "),
  45852. _c(
  45853. "li",
  45854. { staticClass: "nav-item" },
  45855. [
  45856. _c(
  45857. "router-link",
  45858. {
  45859. staticClass: "nav-link",
  45860. attrs: { to: { name: "dashboard" } }
  45861. },
  45862. [
  45863. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45864. _vm._v(" "),
  45865. _c(
  45866. "span",
  45867. { staticClass: "d-none d-sm-block d-md-inline" },
  45868. [_vm._v("Dashboard")]
  45869. )
  45870. ]
  45871. )
  45872. ],
  45873. 1
  45874. ),
  45875. _vm._v(" "),
  45876. _vm._m(3)
  45877. ]),
  45878. _vm._v(" "),
  45879. _c(
  45880. "ul",
  45881. { staticClass: "navbar-nav ml-auto" },
  45882. [
  45883. !_vm.isLoggedIn
  45884. ? _c(
  45885. "router-link",
  45886. {
  45887. staticClass: "nav-link",
  45888. attrs: { to: { name: "login" } }
  45889. },
  45890. [_vm._v("Login")]
  45891. )
  45892. : _vm._e(),
  45893. _vm._v(" "),
  45894. _vm.isLoggedIn
  45895. ? _c("li", { staticClass: "nav-link" }, [
  45896. _vm._v(_vm._s(_vm.username))
  45897. ])
  45898. : _vm._e(),
  45899. _vm._v(" "),
  45900. _vm.isLoggedIn
  45901. ? _c(
  45902. "router-link",
  45903. {
  45904. staticClass: "nav-link",
  45905. attrs: { to: { name: "home" } }
  45906. },
  45907. [_vm._v("Home")]
  45908. )
  45909. : _vm._e()
  45910. ],
  45911. 1
  45912. )
  45913. ]
  45914. )
  45915. ],
  45916. 1
  45917. )
  45918. ]
  45919. ),
  45920. _vm._v(" "),
  45921. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  45922. ])
  45923. }
  45924. var staticRenderFns = [
  45925. function() {
  45926. var _vm = this
  45927. var _h = _vm.$createElement
  45928. var _c = _vm._self._c || _h
  45929. return _c(
  45930. "button",
  45931. {
  45932. staticClass: "navbar-toggler",
  45933. attrs: {
  45934. type: "button",
  45935. "data-toggle": "collapse",
  45936. "data-target": "#navbarSupportedContent",
  45937. "aria-controls": "navbarSupportedContent",
  45938. "aria-expanded": "false"
  45939. }
  45940. },
  45941. [_c("span", { staticClass: "navbar-toggler-icon" })]
  45942. )
  45943. },
  45944. function() {
  45945. var _vm = this
  45946. var _h = _vm.$createElement
  45947. var _c = _vm._self._c || _h
  45948. return _c("li", { staticClass: "nav-item" }, [
  45949. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45950. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  45951. _vm._v(" "),
  45952. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45953. _vm._v("Check-In")
  45954. ])
  45955. ])
  45956. ])
  45957. },
  45958. function() {
  45959. var _vm = this
  45960. var _h = _vm.$createElement
  45961. var _c = _vm._self._c || _h
  45962. return _c("li", { staticClass: "nav-item" }, [
  45963. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45964. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45965. _vm._v(" "),
  45966. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45967. _vm._v("Check-Out")
  45968. ])
  45969. ])
  45970. ])
  45971. },
  45972. function() {
  45973. var _vm = this
  45974. var _h = _vm.$createElement
  45975. var _c = _vm._self._c || _h
  45976. return _c("li", { staticClass: "nav-item" }, [
  45977. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45978. _c("i", { staticClass: "fas fa-chart-bar" }),
  45979. _vm._v(" "),
  45980. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45981. _vm._v("Reports")
  45982. ])
  45983. ])
  45984. ])
  45985. }
  45986. ]
  45987. render._withStripped = true
  45988. /***/ }),
  45989. /***/ "./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&":
  45990. /*!*******************************************************************************************************************************************************************************************************!*\
  45991. !*** ./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& ***!
  45992. \*******************************************************************************************************************************************************************************************************/
  45993. /*! exports provided: render, staticRenderFns */
  45994. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45995. "use strict";
  45996. __webpack_require__.r(__webpack_exports__);
  45997. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45998. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45999. var render = function() {
  46000. var _vm = this
  46001. var _h = _vm.$createElement
  46002. var _c = _vm._self._c || _h
  46003. return _c("div", { staticClass: "container" }, [
  46004. _c("div", { staticClass: "row justify-content-center" }, [
  46005. !_vm.isLoading
  46006. ? _c(
  46007. "div",
  46008. { staticClass: "col-md-12" },
  46009. _vm._l(_vm.workOrders, function(workOrder, index) {
  46010. return _c(
  46011. "div",
  46012. { key: workOrder.woid, staticClass: "col-md-4" },
  46013. [
  46014. _c("div", { staticClass: "card" }, [
  46015. _c(
  46016. "div",
  46017. { staticClass: "card-header" },
  46018. [
  46019. _c(
  46020. "router-link",
  46021. {
  46022. staticClass: "h4 card-title",
  46023. attrs: {
  46024. to: {
  46025. name: "workorders",
  46026. params: { id: workOrder.woid }
  46027. }
  46028. }
  46029. },
  46030. [_vm._v(_vm._s(workOrder.woid))]
  46031. )
  46032. ],
  46033. 1
  46034. ),
  46035. _vm._v(" "),
  46036. _c("div", { staticClass: "card-body card-body-dark" }, [
  46037. _c("div", [
  46038. _vm._v(
  46039. "\n " +
  46040. _vm._s(workOrder.probdesc) +
  46041. "\n "
  46042. )
  46043. ]),
  46044. _vm._v(" "),
  46045. _c("div", [
  46046. _vm._v(
  46047. "\n " +
  46048. _vm._s(workOrder.suggested) +
  46049. "\n "
  46050. )
  46051. ])
  46052. ])
  46053. ])
  46054. ]
  46055. )
  46056. }),
  46057. 0
  46058. )
  46059. : _c(
  46060. "div",
  46061. { staticClass: "col-md-12" },
  46062. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46063. 1
  46064. )
  46065. ])
  46066. ])
  46067. }
  46068. var staticRenderFns = []
  46069. render._withStripped = true
  46070. /***/ }),
  46071. /***/ "./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&":
  46072. /*!***************************************************************************************************************************************************************************************************!*\
  46073. !*** ./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& ***!
  46074. \***************************************************************************************************************************************************************************************************/
  46075. /*! exports provided: render, staticRenderFns */
  46076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46077. "use strict";
  46078. __webpack_require__.r(__webpack_exports__);
  46079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46081. var render = function() {
  46082. var _vm = this
  46083. var _h = _vm.$createElement
  46084. var _c = _vm._self._c || _h
  46085. return _c("div", { staticClass: "container" }, [
  46086. _c("div", { staticClass: "row justify-content-center" }, [
  46087. _c("div", { staticClass: "col-md-8" }, [
  46088. _c("div", { staticClass: "card card-default" }, [
  46089. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46090. _vm._v(" "),
  46091. _c("div", { staticClass: "card-body" }, [
  46092. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46093. _c("div", { staticClass: "form-group row" }, [
  46094. _c(
  46095. "label",
  46096. {
  46097. staticClass: "col-sm-4 col-form-label text-md-right",
  46098. attrs: { for: "username" }
  46099. },
  46100. [_vm._v("Username")]
  46101. ),
  46102. _vm._v(" "),
  46103. _c("div", { staticClass: "col-md-6" }, [
  46104. _c("input", {
  46105. directives: [
  46106. {
  46107. name: "model",
  46108. rawName: "v-model",
  46109. value: _vm.username,
  46110. expression: "username"
  46111. }
  46112. ],
  46113. staticClass: "form-control",
  46114. attrs: {
  46115. id: "username",
  46116. type: "username",
  46117. required: "",
  46118. autofocus: ""
  46119. },
  46120. domProps: { value: _vm.username },
  46121. on: {
  46122. input: function($event) {
  46123. if ($event.target.composing) {
  46124. return
  46125. }
  46126. _vm.username = $event.target.value
  46127. }
  46128. }
  46129. })
  46130. ])
  46131. ]),
  46132. _vm._v(" "),
  46133. _c("div", { staticClass: "form-group row" }, [
  46134. _c(
  46135. "label",
  46136. {
  46137. staticClass: "col-md-4 col-form-label text-md-right",
  46138. attrs: { for: "password" }
  46139. },
  46140. [_vm._v("Password")]
  46141. ),
  46142. _vm._v(" "),
  46143. _c("div", { staticClass: "col-md-6" }, [
  46144. _c("input", {
  46145. directives: [
  46146. {
  46147. name: "model",
  46148. rawName: "v-model",
  46149. value: _vm.password,
  46150. expression: "password"
  46151. }
  46152. ],
  46153. staticClass: "form-control",
  46154. attrs: { id: "password", type: "password", required: "" },
  46155. domProps: { value: _vm.password },
  46156. on: {
  46157. input: function($event) {
  46158. if ($event.target.composing) {
  46159. return
  46160. }
  46161. _vm.password = $event.target.value
  46162. }
  46163. }
  46164. })
  46165. ])
  46166. ]),
  46167. _vm._v(" "),
  46168. _c("div", { staticClass: "form-group row mb-0" }, [
  46169. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46170. _c(
  46171. "button",
  46172. {
  46173. staticClass: "btn btn-primary",
  46174. attrs: { type: "submit" },
  46175. on: { click: _vm.handleSubmit }
  46176. },
  46177. [
  46178. _vm._v(
  46179. "\n Login\n "
  46180. )
  46181. ]
  46182. )
  46183. ])
  46184. ])
  46185. ])
  46186. ])
  46187. ])
  46188. ])
  46189. ])
  46190. ])
  46191. }
  46192. var staticRenderFns = []
  46193. render._withStripped = true
  46194. /***/ }),
  46195. /***/ "./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&":
  46196. /*!*****************************************************************************************************************************************************************************************************************!*\
  46197. !*** ./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& ***!
  46198. \*****************************************************************************************************************************************************************************************************************/
  46199. /*! exports provided: render, staticRenderFns */
  46200. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46201. "use strict";
  46202. __webpack_require__.r(__webpack_exports__);
  46203. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46204. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46205. var render = function() {
  46206. var _vm = this
  46207. var _h = _vm.$createElement
  46208. var _c = _vm._self._c || _h
  46209. return _vm._m(0)
  46210. }
  46211. var staticRenderFns = [
  46212. function() {
  46213. var _vm = this
  46214. var _h = _vm.$createElement
  46215. var _c = _vm._self._c || _h
  46216. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46217. _c("div", { staticClass: "content" }, [
  46218. _c("div", { staticClass: "m-b-md" }, [
  46219. _c("h2", { staticClass: "title m-b-md" }, [
  46220. _vm._v("\n UPCCRT\n ")
  46221. ]),
  46222. _vm._v(" "),
  46223. _c("h3", [
  46224. _vm._v(
  46225. "\n University PC Care Repair Tracker\n "
  46226. )
  46227. ])
  46228. ])
  46229. ])
  46230. ])
  46231. }
  46232. ]
  46233. render._withStripped = true
  46234. /***/ }),
  46235. /***/ "./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&":
  46236. /*!*******************************************************************************************************************************************************************************************************!*\
  46237. !*** ./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& ***!
  46238. \*******************************************************************************************************************************************************************************************************/
  46239. /*! exports provided: render, staticRenderFns */
  46240. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46241. "use strict";
  46242. __webpack_require__.r(__webpack_exports__);
  46243. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46244. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46245. var render = function() {
  46246. var _vm = this
  46247. var _h = _vm.$createElement
  46248. var _c = _vm._self._c || _h
  46249. return _c("div", { staticClass: "container-fluid" }, [
  46250. _c("div", { staticClass: "row my-3" }, [
  46251. _c("div", { staticClass: "col-lg-6" }, [
  46252. _c("div", { staticClass: "card h-100" }, [
  46253. _vm._m(0),
  46254. _vm._v(" "),
  46255. _c("div", { staticClass: "card-body" }, [
  46256. _c("div", { staticClass: "tab-content" }, [
  46257. _c(
  46258. "div",
  46259. {
  46260. staticClass: "tab-pane active",
  46261. attrs: {
  46262. id: "assetinfo",
  46263. role: "tabpanel",
  46264. "aria-labelledby": "assetinfo-tab"
  46265. }
  46266. },
  46267. [
  46268. !_vm.assetLoading
  46269. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46270. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46271. ],
  46272. 1
  46273. ),
  46274. _vm._v(" "),
  46275. _c(
  46276. "div",
  46277. {
  46278. staticClass: "tab-pane",
  46279. attrs: {
  46280. id: "credentials",
  46281. role: "tabpanel",
  46282. "aria-labelledby": "credentials-tab"
  46283. }
  46284. },
  46285. [
  46286. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46287. ? _c("credential-list", {
  46288. attrs: {
  46289. credentials: _vm.credentials,
  46290. descriptions: _vm.credentialDescriptions,
  46291. pcid: _vm.asset.pcid
  46292. }
  46293. })
  46294. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46295. ],
  46296. 1
  46297. )
  46298. ])
  46299. ])
  46300. ])
  46301. ]),
  46302. _vm._v(" "),
  46303. _c("div", { staticClass: "col-lg-6" }, [
  46304. _c("div", { staticClass: "card h-100" }, [
  46305. _vm._m(1),
  46306. _vm._v(" "),
  46307. _c("div", { staticClass: "card-body" }, [
  46308. _c("div", { staticClass: "tab-content" }, [
  46309. _c(
  46310. "div",
  46311. {
  46312. staticClass: "tab-pane active",
  46313. attrs: {
  46314. id: "workordersumm",
  46315. role: "tabpanel",
  46316. "aria-labelledby": "workordersumm-tab"
  46317. }
  46318. },
  46319. [
  46320. !_vm.woLoading && !_vm.storesLoading
  46321. ? _c("work-order-info", {
  46322. attrs: {
  46323. "work-order": _vm.workOrder,
  46324. stores: _vm.stores
  46325. }
  46326. })
  46327. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46328. ],
  46329. 1
  46330. ),
  46331. _vm._v(" "),
  46332. _c(
  46333. "div",
  46334. {
  46335. staticClass: "tab-pane",
  46336. attrs: {
  46337. id: "attachments",
  46338. role: "tabpanel",
  46339. "aria-labelledby": "attachments-tab"
  46340. }
  46341. },
  46342. [
  46343. _vm._v(
  46344. "\n TODO 2\n "
  46345. )
  46346. ]
  46347. )
  46348. ])
  46349. ])
  46350. ])
  46351. ])
  46352. ]),
  46353. _vm._v(" "),
  46354. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46355. _c("div", { staticClass: "col-12" }, [
  46356. _c("div", { staticClass: "card" }, [
  46357. _c(
  46358. "div",
  46359. { staticClass: "card-body" },
  46360. [
  46361. _c("h5", { staticClass: "card-title" }, [
  46362. _vm._v("Customer Notes")
  46363. ]),
  46364. _vm._v(" "),
  46365. !_vm.workOrderNotesLoading
  46366. ? _c("notes", {
  46367. attrs: {
  46368. notes: _vm.publicNotes,
  46369. authusername: _vm.authUser,
  46370. "note-type": 0,
  46371. woid: _vm.id
  46372. }
  46373. })
  46374. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46375. ],
  46376. 1
  46377. )
  46378. ])
  46379. ])
  46380. ]),
  46381. _vm._v(" "),
  46382. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46383. _c("div", { staticClass: "col-12" }, [
  46384. _c("div", { staticClass: "card" }, [
  46385. _c(
  46386. "div",
  46387. { staticClass: "card-body" },
  46388. [
  46389. _c("h5", { staticClass: "card-title" }, [
  46390. _vm._v("Private/Billing Notes")
  46391. ]),
  46392. _vm._v(" "),
  46393. !_vm.workOrderNotesLoading
  46394. ? _c("notes", {
  46395. attrs: {
  46396. notes: _vm.privateNotes,
  46397. authusername: _vm.authUser,
  46398. "note-type": 1,
  46399. woid: _vm.id
  46400. }
  46401. })
  46402. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46403. ],
  46404. 1
  46405. )
  46406. ])
  46407. ])
  46408. ])
  46409. ])
  46410. }
  46411. var staticRenderFns = [
  46412. function() {
  46413. var _vm = this
  46414. var _h = _vm.$createElement
  46415. var _c = _vm._self._c || _h
  46416. return _c("div", { staticClass: "card-header text-right" }, [
  46417. _c(
  46418. "button",
  46419. {
  46420. staticClass: "btn btn-default xs-toggle",
  46421. attrs: {
  46422. type: "button",
  46423. "data-toggle": "collapse",
  46424. "data-target": "#assetTab"
  46425. }
  46426. },
  46427. [
  46428. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46429. _vm._v(" "),
  46430. _c("span", { staticClass: "icon-bar" }),
  46431. _vm._v(" "),
  46432. _c("span", { staticClass: "icon-bar" }),
  46433. _vm._v(" "),
  46434. _c("span", { staticClass: "icon-bar" })
  46435. ]
  46436. ),
  46437. _vm._v(" "),
  46438. _c(
  46439. "ul",
  46440. {
  46441. staticClass:
  46442. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46443. attrs: { id: "assetTab", role: "tablist" }
  46444. },
  46445. [
  46446. _c("li", { staticClass: "nav-item" }, [
  46447. _c(
  46448. "a",
  46449. {
  46450. staticClass: "nav-link active",
  46451. attrs: {
  46452. id: "assetinfo-tab",
  46453. "data-toggle": "pill",
  46454. href: "#assetinfo",
  46455. role: "tab",
  46456. "aria-controls": "assetinfo",
  46457. "aria-selected": "true"
  46458. }
  46459. },
  46460. [_vm._v("Hardware")]
  46461. )
  46462. ]),
  46463. _vm._v(" "),
  46464. _c("li", { staticClass: "nav-item" }, [
  46465. _c(
  46466. "a",
  46467. {
  46468. staticClass: "nav-link",
  46469. attrs: {
  46470. id: "credentials-tab",
  46471. "data-toggle": "pill",
  46472. href: "#credentials",
  46473. role: "tab",
  46474. "aria-controls": "credentials",
  46475. "aria-selected": "false"
  46476. }
  46477. },
  46478. [_vm._v("Credentials")]
  46479. )
  46480. ])
  46481. ]
  46482. )
  46483. ])
  46484. },
  46485. function() {
  46486. var _vm = this
  46487. var _h = _vm.$createElement
  46488. var _c = _vm._self._c || _h
  46489. return _c("div", { staticClass: "card-header text-right" }, [
  46490. _c(
  46491. "button",
  46492. {
  46493. staticClass: "btn btn-default xs-toggle",
  46494. attrs: {
  46495. type: "button",
  46496. "data-toggle": "collapse",
  46497. "data-target": "#workorderTab"
  46498. }
  46499. },
  46500. [
  46501. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46502. _vm._v(" "),
  46503. _c("span", { staticClass: "icon-bar" }),
  46504. _vm._v(" "),
  46505. _c("span", { staticClass: "icon-bar" }),
  46506. _vm._v(" "),
  46507. _c("span", { staticClass: "icon-bar" })
  46508. ]
  46509. ),
  46510. _vm._v(" "),
  46511. _c(
  46512. "ul",
  46513. {
  46514. staticClass:
  46515. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46516. attrs: { id: "workorderTab", role: "tablist" }
  46517. },
  46518. [
  46519. _c("li", { staticClass: "nav-item" }, [
  46520. _c(
  46521. "a",
  46522. {
  46523. staticClass: "nav-link active",
  46524. attrs: {
  46525. id: "workordersumm-tab",
  46526. "data-toggle": "pill",
  46527. href: "#workordersumm",
  46528. role: "tab",
  46529. "aria-controls": "workordersumm",
  46530. "aria-selected": "true"
  46531. }
  46532. },
  46533. [_vm._v("Summary")]
  46534. )
  46535. ]),
  46536. _vm._v(" "),
  46537. _c("li", { staticClass: "nav-item" }, [
  46538. _c(
  46539. "a",
  46540. {
  46541. staticClass: "nav-link",
  46542. attrs: {
  46543. id: "attachments-tab",
  46544. "data-toggle": "pill",
  46545. href: "#attachments",
  46546. role: "tab",
  46547. "aria-controls": "attachments",
  46548. "aria-selected": "false"
  46549. }
  46550. },
  46551. [_vm._v("Attachments")]
  46552. )
  46553. ])
  46554. ]
  46555. )
  46556. ])
  46557. }
  46558. ]
  46559. render._withStripped = true
  46560. /***/ }),
  46561. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46562. /*!********************************************************************!*\
  46563. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46564. \********************************************************************/
  46565. /*! exports provided: default */
  46566. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46567. "use strict";
  46568. __webpack_require__.r(__webpack_exports__);
  46569. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46570. /* globals __VUE_SSR_CONTEXT__ */
  46571. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46572. // This module is a runtime utility for cleaner component module output and will
  46573. // be included in the final webpack user bundle.
  46574. function normalizeComponent (
  46575. scriptExports,
  46576. render,
  46577. staticRenderFns,
  46578. functionalTemplate,
  46579. injectStyles,
  46580. scopeId,
  46581. moduleIdentifier, /* server only */
  46582. shadowMode /* vue-cli only */
  46583. ) {
  46584. // Vue.extend constructor export interop
  46585. var options = typeof scriptExports === 'function'
  46586. ? scriptExports.options
  46587. : scriptExports
  46588. // render functions
  46589. if (render) {
  46590. options.render = render
  46591. options.staticRenderFns = staticRenderFns
  46592. options._compiled = true
  46593. }
  46594. // functional template
  46595. if (functionalTemplate) {
  46596. options.functional = true
  46597. }
  46598. // scopedId
  46599. if (scopeId) {
  46600. options._scopeId = 'data-v-' + scopeId
  46601. }
  46602. var hook
  46603. if (moduleIdentifier) { // server build
  46604. hook = function (context) {
  46605. // 2.3 injection
  46606. context =
  46607. context || // cached call
  46608. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46609. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46610. // 2.2 with runInNewContext: true
  46611. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46612. context = __VUE_SSR_CONTEXT__
  46613. }
  46614. // inject component styles
  46615. if (injectStyles) {
  46616. injectStyles.call(this, context)
  46617. }
  46618. // register component module identifier for async chunk inferrence
  46619. if (context && context._registeredComponents) {
  46620. context._registeredComponents.add(moduleIdentifier)
  46621. }
  46622. }
  46623. // used by ssr in case component is cached and beforeCreate
  46624. // never gets called
  46625. options._ssrRegister = hook
  46626. } else if (injectStyles) {
  46627. hook = shadowMode
  46628. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46629. : injectStyles
  46630. }
  46631. if (hook) {
  46632. if (options.functional) {
  46633. // for template-only hot-reload because in that case the render fn doesn't
  46634. // go through the normalizer
  46635. options._injectStyles = hook
  46636. // register for functioal component in vue file
  46637. var originalRender = options.render
  46638. options.render = function renderWithStyleInjection (h, context) {
  46639. hook.call(context)
  46640. return originalRender(h, context)
  46641. }
  46642. } else {
  46643. // inject component registration as beforeCreate hook
  46644. var existing = options.beforeCreate
  46645. options.beforeCreate = existing
  46646. ? [].concat(existing, hook)
  46647. : [hook]
  46648. }
  46649. }
  46650. return {
  46651. exports: scriptExports,
  46652. options: options
  46653. }
  46654. }
  46655. /***/ }),
  46656. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46657. /*!********************************************************!*\
  46658. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46659. \********************************************************/
  46660. /*! exports provided: default */
  46661. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46662. "use strict";
  46663. __webpack_require__.r(__webpack_exports__);
  46664. /*!
  46665. * vue-router v3.1.6
  46666. * (c) 2020 Evan You
  46667. * @license MIT
  46668. */
  46669. /* */
  46670. function assert (condition, message) {
  46671. if (!condition) {
  46672. throw new Error(("[vue-router] " + message))
  46673. }
  46674. }
  46675. function warn (condition, message) {
  46676. if ( true && !condition) {
  46677. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46678. }
  46679. }
  46680. function isError (err) {
  46681. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46682. }
  46683. function isExtendedError (constructor, err) {
  46684. return (
  46685. err instanceof constructor ||
  46686. // _name is to support IE9 too
  46687. (err && (err.name === constructor.name || err._name === constructor._name))
  46688. )
  46689. }
  46690. function extend (a, b) {
  46691. for (var key in b) {
  46692. a[key] = b[key];
  46693. }
  46694. return a
  46695. }
  46696. var View = {
  46697. name: 'RouterView',
  46698. functional: true,
  46699. props: {
  46700. name: {
  46701. type: String,
  46702. default: 'default'
  46703. }
  46704. },
  46705. render: function render (_, ref) {
  46706. var props = ref.props;
  46707. var children = ref.children;
  46708. var parent = ref.parent;
  46709. var data = ref.data;
  46710. // used by devtools to display a router-view badge
  46711. data.routerView = true;
  46712. // directly use parent context's createElement() function
  46713. // so that components rendered by router-view can resolve named slots
  46714. var h = parent.$createElement;
  46715. var name = props.name;
  46716. var route = parent.$route;
  46717. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46718. // determine current view depth, also check to see if the tree
  46719. // has been toggled inactive but kept-alive.
  46720. var depth = 0;
  46721. var inactive = false;
  46722. while (parent && parent._routerRoot !== parent) {
  46723. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46724. if (vnodeData.routerView) {
  46725. depth++;
  46726. }
  46727. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46728. inactive = true;
  46729. }
  46730. parent = parent.$parent;
  46731. }
  46732. data.routerViewDepth = depth;
  46733. // render previous view if the tree is inactive and kept-alive
  46734. if (inactive) {
  46735. var cachedData = cache[name];
  46736. var cachedComponent = cachedData && cachedData.component;
  46737. if (cachedComponent) {
  46738. // #2301
  46739. // pass props
  46740. if (cachedData.configProps) {
  46741. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46742. }
  46743. return h(cachedComponent, data, children)
  46744. } else {
  46745. // render previous empty view
  46746. return h()
  46747. }
  46748. }
  46749. var matched = route.matched[depth];
  46750. var component = matched && matched.components[name];
  46751. // render empty node if no matched route or no config component
  46752. if (!matched || !component) {
  46753. cache[name] = null;
  46754. return h()
  46755. }
  46756. // cache component
  46757. cache[name] = { component: component };
  46758. // attach instance registration hook
  46759. // this will be called in the instance's injected lifecycle hooks
  46760. data.registerRouteInstance = function (vm, val) {
  46761. // val could be undefined for unregistration
  46762. var current = matched.instances[name];
  46763. if (
  46764. (val && current !== vm) ||
  46765. (!val && current === vm)
  46766. ) {
  46767. matched.instances[name] = val;
  46768. }
  46769. }
  46770. // also register instance in prepatch hook
  46771. // in case the same component instance is reused across different routes
  46772. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46773. matched.instances[name] = vnode.componentInstance;
  46774. };
  46775. // register instance in init hook
  46776. // in case kept-alive component be actived when routes changed
  46777. data.hook.init = function (vnode) {
  46778. if (vnode.data.keepAlive &&
  46779. vnode.componentInstance &&
  46780. vnode.componentInstance !== matched.instances[name]
  46781. ) {
  46782. matched.instances[name] = vnode.componentInstance;
  46783. }
  46784. };
  46785. var configProps = matched.props && matched.props[name];
  46786. // save route and configProps in cachce
  46787. if (configProps) {
  46788. extend(cache[name], {
  46789. route: route,
  46790. configProps: configProps
  46791. });
  46792. fillPropsinData(component, data, route, configProps);
  46793. }
  46794. return h(component, data, children)
  46795. }
  46796. };
  46797. function fillPropsinData (component, data, route, configProps) {
  46798. // resolve props
  46799. var propsToPass = data.props = resolveProps(route, configProps);
  46800. if (propsToPass) {
  46801. // clone to prevent mutation
  46802. propsToPass = data.props = extend({}, propsToPass);
  46803. // pass non-declared props as attrs
  46804. var attrs = data.attrs = data.attrs || {};
  46805. for (var key in propsToPass) {
  46806. if (!component.props || !(key in component.props)) {
  46807. attrs[key] = propsToPass[key];
  46808. delete propsToPass[key];
  46809. }
  46810. }
  46811. }
  46812. }
  46813. function resolveProps (route, config) {
  46814. switch (typeof config) {
  46815. case 'undefined':
  46816. return
  46817. case 'object':
  46818. return config
  46819. case 'function':
  46820. return config(route)
  46821. case 'boolean':
  46822. return config ? route.params : undefined
  46823. default:
  46824. if (true) {
  46825. warn(
  46826. false,
  46827. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46828. "expecting an object, function or boolean."
  46829. );
  46830. }
  46831. }
  46832. }
  46833. /* */
  46834. var encodeReserveRE = /[!'()*]/g;
  46835. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46836. var commaRE = /%2C/g;
  46837. // fixed encodeURIComponent which is more conformant to RFC3986:
  46838. // - escapes [!'()*]
  46839. // - preserve commas
  46840. var encode = function (str) { return encodeURIComponent(str)
  46841. .replace(encodeReserveRE, encodeReserveReplacer)
  46842. .replace(commaRE, ','); };
  46843. var decode = decodeURIComponent;
  46844. function resolveQuery (
  46845. query,
  46846. extraQuery,
  46847. _parseQuery
  46848. ) {
  46849. if ( extraQuery === void 0 ) extraQuery = {};
  46850. var parse = _parseQuery || parseQuery;
  46851. var parsedQuery;
  46852. try {
  46853. parsedQuery = parse(query || '');
  46854. } catch (e) {
  46855. true && warn(false, e.message);
  46856. parsedQuery = {};
  46857. }
  46858. for (var key in extraQuery) {
  46859. parsedQuery[key] = extraQuery[key];
  46860. }
  46861. return parsedQuery
  46862. }
  46863. function parseQuery (query) {
  46864. var res = {};
  46865. query = query.trim().replace(/^(\?|#|&)/, '');
  46866. if (!query) {
  46867. return res
  46868. }
  46869. query.split('&').forEach(function (param) {
  46870. var parts = param.replace(/\+/g, ' ').split('=');
  46871. var key = decode(parts.shift());
  46872. var val = parts.length > 0
  46873. ? decode(parts.join('='))
  46874. : null;
  46875. if (res[key] === undefined) {
  46876. res[key] = val;
  46877. } else if (Array.isArray(res[key])) {
  46878. res[key].push(val);
  46879. } else {
  46880. res[key] = [res[key], val];
  46881. }
  46882. });
  46883. return res
  46884. }
  46885. function stringifyQuery (obj) {
  46886. var res = obj ? Object.keys(obj).map(function (key) {
  46887. var val = obj[key];
  46888. if (val === undefined) {
  46889. return ''
  46890. }
  46891. if (val === null) {
  46892. return encode(key)
  46893. }
  46894. if (Array.isArray(val)) {
  46895. var result = [];
  46896. val.forEach(function (val2) {
  46897. if (val2 === undefined) {
  46898. return
  46899. }
  46900. if (val2 === null) {
  46901. result.push(encode(key));
  46902. } else {
  46903. result.push(encode(key) + '=' + encode(val2));
  46904. }
  46905. });
  46906. return result.join('&')
  46907. }
  46908. return encode(key) + '=' + encode(val)
  46909. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  46910. return res ? ("?" + res) : ''
  46911. }
  46912. /* */
  46913. var trailingSlashRE = /\/?$/;
  46914. function createRoute (
  46915. record,
  46916. location,
  46917. redirectedFrom,
  46918. router
  46919. ) {
  46920. var stringifyQuery = router && router.options.stringifyQuery;
  46921. var query = location.query || {};
  46922. try {
  46923. query = clone(query);
  46924. } catch (e) {}
  46925. var route = {
  46926. name: location.name || (record && record.name),
  46927. meta: (record && record.meta) || {},
  46928. path: location.path || '/',
  46929. hash: location.hash || '',
  46930. query: query,
  46931. params: location.params || {},
  46932. fullPath: getFullPath(location, stringifyQuery),
  46933. matched: record ? formatMatch(record) : []
  46934. };
  46935. if (redirectedFrom) {
  46936. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  46937. }
  46938. return Object.freeze(route)
  46939. }
  46940. function clone (value) {
  46941. if (Array.isArray(value)) {
  46942. return value.map(clone)
  46943. } else if (value && typeof value === 'object') {
  46944. var res = {};
  46945. for (var key in value) {
  46946. res[key] = clone(value[key]);
  46947. }
  46948. return res
  46949. } else {
  46950. return value
  46951. }
  46952. }
  46953. // the starting route that represents the initial state
  46954. var START = createRoute(null, {
  46955. path: '/'
  46956. });
  46957. function formatMatch (record) {
  46958. var res = [];
  46959. while (record) {
  46960. res.unshift(record);
  46961. record = record.parent;
  46962. }
  46963. return res
  46964. }
  46965. function getFullPath (
  46966. ref,
  46967. _stringifyQuery
  46968. ) {
  46969. var path = ref.path;
  46970. var query = ref.query; if ( query === void 0 ) query = {};
  46971. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  46972. var stringify = _stringifyQuery || stringifyQuery;
  46973. return (path || '/') + stringify(query) + hash
  46974. }
  46975. function isSameRoute (a, b) {
  46976. if (b === START) {
  46977. return a === b
  46978. } else if (!b) {
  46979. return false
  46980. } else if (a.path && b.path) {
  46981. return (
  46982. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  46983. a.hash === b.hash &&
  46984. isObjectEqual(a.query, b.query)
  46985. )
  46986. } else if (a.name && b.name) {
  46987. return (
  46988. a.name === b.name &&
  46989. a.hash === b.hash &&
  46990. isObjectEqual(a.query, b.query) &&
  46991. isObjectEqual(a.params, b.params)
  46992. )
  46993. } else {
  46994. return false
  46995. }
  46996. }
  46997. function isObjectEqual (a, b) {
  46998. if ( a === void 0 ) a = {};
  46999. if ( b === void 0 ) b = {};
  47000. // handle null value #1566
  47001. if (!a || !b) { return a === b }
  47002. var aKeys = Object.keys(a);
  47003. var bKeys = Object.keys(b);
  47004. if (aKeys.length !== bKeys.length) {
  47005. return false
  47006. }
  47007. return aKeys.every(function (key) {
  47008. var aVal = a[key];
  47009. var bVal = b[key];
  47010. // check nested equality
  47011. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47012. return isObjectEqual(aVal, bVal)
  47013. }
  47014. return String(aVal) === String(bVal)
  47015. })
  47016. }
  47017. function isIncludedRoute (current, target) {
  47018. return (
  47019. current.path.replace(trailingSlashRE, '/').indexOf(
  47020. target.path.replace(trailingSlashRE, '/')
  47021. ) === 0 &&
  47022. (!target.hash || current.hash === target.hash) &&
  47023. queryIncludes(current.query, target.query)
  47024. )
  47025. }
  47026. function queryIncludes (current, target) {
  47027. for (var key in target) {
  47028. if (!(key in current)) {
  47029. return false
  47030. }
  47031. }
  47032. return true
  47033. }
  47034. /* */
  47035. function resolvePath (
  47036. relative,
  47037. base,
  47038. append
  47039. ) {
  47040. var firstChar = relative.charAt(0);
  47041. if (firstChar === '/') {
  47042. return relative
  47043. }
  47044. if (firstChar === '?' || firstChar === '#') {
  47045. return base + relative
  47046. }
  47047. var stack = base.split('/');
  47048. // remove trailing segment if:
  47049. // - not appending
  47050. // - appending to trailing slash (last segment is empty)
  47051. if (!append || !stack[stack.length - 1]) {
  47052. stack.pop();
  47053. }
  47054. // resolve relative path
  47055. var segments = relative.replace(/^\//, '').split('/');
  47056. for (var i = 0; i < segments.length; i++) {
  47057. var segment = segments[i];
  47058. if (segment === '..') {
  47059. stack.pop();
  47060. } else if (segment !== '.') {
  47061. stack.push(segment);
  47062. }
  47063. }
  47064. // ensure leading slash
  47065. if (stack[0] !== '') {
  47066. stack.unshift('');
  47067. }
  47068. return stack.join('/')
  47069. }
  47070. function parsePath (path) {
  47071. var hash = '';
  47072. var query = '';
  47073. var hashIndex = path.indexOf('#');
  47074. if (hashIndex >= 0) {
  47075. hash = path.slice(hashIndex);
  47076. path = path.slice(0, hashIndex);
  47077. }
  47078. var queryIndex = path.indexOf('?');
  47079. if (queryIndex >= 0) {
  47080. query = path.slice(queryIndex + 1);
  47081. path = path.slice(0, queryIndex);
  47082. }
  47083. return {
  47084. path: path,
  47085. query: query,
  47086. hash: hash
  47087. }
  47088. }
  47089. function cleanPath (path) {
  47090. return path.replace(/\/\//g, '/')
  47091. }
  47092. var isarray = Array.isArray || function (arr) {
  47093. return Object.prototype.toString.call(arr) == '[object Array]';
  47094. };
  47095. /**
  47096. * Expose `pathToRegexp`.
  47097. */
  47098. var pathToRegexp_1 = pathToRegexp;
  47099. var parse_1 = parse;
  47100. var compile_1 = compile;
  47101. var tokensToFunction_1 = tokensToFunction;
  47102. var tokensToRegExp_1 = tokensToRegExp;
  47103. /**
  47104. * The main path matching regexp utility.
  47105. *
  47106. * @type {RegExp}
  47107. */
  47108. var PATH_REGEXP = new RegExp([
  47109. // Match escaped characters that would otherwise appear in future matches.
  47110. // This allows the user to escape special characters that won't transform.
  47111. '(\\\\.)',
  47112. // Match Express-style parameters and un-named parameters with a prefix
  47113. // and optional suffixes. Matches appear as:
  47114. //
  47115. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47116. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47117. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47118. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47119. ].join('|'), 'g');
  47120. /**
  47121. * Parse a string for the raw tokens.
  47122. *
  47123. * @param {string} str
  47124. * @param {Object=} options
  47125. * @return {!Array}
  47126. */
  47127. function parse (str, options) {
  47128. var tokens = [];
  47129. var key = 0;
  47130. var index = 0;
  47131. var path = '';
  47132. var defaultDelimiter = options && options.delimiter || '/';
  47133. var res;
  47134. while ((res = PATH_REGEXP.exec(str)) != null) {
  47135. var m = res[0];
  47136. var escaped = res[1];
  47137. var offset = res.index;
  47138. path += str.slice(index, offset);
  47139. index = offset + m.length;
  47140. // Ignore already escaped sequences.
  47141. if (escaped) {
  47142. path += escaped[1];
  47143. continue
  47144. }
  47145. var next = str[index];
  47146. var prefix = res[2];
  47147. var name = res[3];
  47148. var capture = res[4];
  47149. var group = res[5];
  47150. var modifier = res[6];
  47151. var asterisk = res[7];
  47152. // Push the current path onto the tokens.
  47153. if (path) {
  47154. tokens.push(path);
  47155. path = '';
  47156. }
  47157. var partial = prefix != null && next != null && next !== prefix;
  47158. var repeat = modifier === '+' || modifier === '*';
  47159. var optional = modifier === '?' || modifier === '*';
  47160. var delimiter = res[2] || defaultDelimiter;
  47161. var pattern = capture || group;
  47162. tokens.push({
  47163. name: name || key++,
  47164. prefix: prefix || '',
  47165. delimiter: delimiter,
  47166. optional: optional,
  47167. repeat: repeat,
  47168. partial: partial,
  47169. asterisk: !!asterisk,
  47170. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47171. });
  47172. }
  47173. // Match any characters still remaining.
  47174. if (index < str.length) {
  47175. path += str.substr(index);
  47176. }
  47177. // If the path exists, push it onto the end.
  47178. if (path) {
  47179. tokens.push(path);
  47180. }
  47181. return tokens
  47182. }
  47183. /**
  47184. * Compile a string to a template function for the path.
  47185. *
  47186. * @param {string} str
  47187. * @param {Object=} options
  47188. * @return {!function(Object=, Object=)}
  47189. */
  47190. function compile (str, options) {
  47191. return tokensToFunction(parse(str, options))
  47192. }
  47193. /**
  47194. * Prettier encoding of URI path segments.
  47195. *
  47196. * @param {string}
  47197. * @return {string}
  47198. */
  47199. function encodeURIComponentPretty (str) {
  47200. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47201. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47202. })
  47203. }
  47204. /**
  47205. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47206. *
  47207. * @param {string}
  47208. * @return {string}
  47209. */
  47210. function encodeAsterisk (str) {
  47211. return encodeURI(str).replace(/[?#]/g, function (c) {
  47212. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47213. })
  47214. }
  47215. /**
  47216. * Expose a method for transforming tokens into the path function.
  47217. */
  47218. function tokensToFunction (tokens) {
  47219. // Compile all the tokens into regexps.
  47220. var matches = new Array(tokens.length);
  47221. // Compile all the patterns before compilation.
  47222. for (var i = 0; i < tokens.length; i++) {
  47223. if (typeof tokens[i] === 'object') {
  47224. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47225. }
  47226. }
  47227. return function (obj, opts) {
  47228. var path = '';
  47229. var data = obj || {};
  47230. var options = opts || {};
  47231. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47232. for (var i = 0; i < tokens.length; i++) {
  47233. var token = tokens[i];
  47234. if (typeof token === 'string') {
  47235. path += token;
  47236. continue
  47237. }
  47238. var value = data[token.name];
  47239. var segment;
  47240. if (value == null) {
  47241. if (token.optional) {
  47242. // Prepend partial segment prefixes.
  47243. if (token.partial) {
  47244. path += token.prefix;
  47245. }
  47246. continue
  47247. } else {
  47248. throw new TypeError('Expected "' + token.name + '" to be defined')
  47249. }
  47250. }
  47251. if (isarray(value)) {
  47252. if (!token.repeat) {
  47253. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47254. }
  47255. if (value.length === 0) {
  47256. if (token.optional) {
  47257. continue
  47258. } else {
  47259. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47260. }
  47261. }
  47262. for (var j = 0; j < value.length; j++) {
  47263. segment = encode(value[j]);
  47264. if (!matches[i].test(segment)) {
  47265. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47266. }
  47267. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47268. }
  47269. continue
  47270. }
  47271. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47272. if (!matches[i].test(segment)) {
  47273. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47274. }
  47275. path += token.prefix + segment;
  47276. }
  47277. return path
  47278. }
  47279. }
  47280. /**
  47281. * Escape a regular expression string.
  47282. *
  47283. * @param {string} str
  47284. * @return {string}
  47285. */
  47286. function escapeString (str) {
  47287. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47288. }
  47289. /**
  47290. * Escape the capturing group by escaping special characters and meaning.
  47291. *
  47292. * @param {string} group
  47293. * @return {string}
  47294. */
  47295. function escapeGroup (group) {
  47296. return group.replace(/([=!:$\/()])/g, '\\$1')
  47297. }
  47298. /**
  47299. * Attach the keys as a property of the regexp.
  47300. *
  47301. * @param {!RegExp} re
  47302. * @param {Array} keys
  47303. * @return {!RegExp}
  47304. */
  47305. function attachKeys (re, keys) {
  47306. re.keys = keys;
  47307. return re
  47308. }
  47309. /**
  47310. * Get the flags for a regexp from the options.
  47311. *
  47312. * @param {Object} options
  47313. * @return {string}
  47314. */
  47315. function flags (options) {
  47316. return options.sensitive ? '' : 'i'
  47317. }
  47318. /**
  47319. * Pull out keys from a regexp.
  47320. *
  47321. * @param {!RegExp} path
  47322. * @param {!Array} keys
  47323. * @return {!RegExp}
  47324. */
  47325. function regexpToRegexp (path, keys) {
  47326. // Use a negative lookahead to match only capturing groups.
  47327. var groups = path.source.match(/\((?!\?)/g);
  47328. if (groups) {
  47329. for (var i = 0; i < groups.length; i++) {
  47330. keys.push({
  47331. name: i,
  47332. prefix: null,
  47333. delimiter: null,
  47334. optional: false,
  47335. repeat: false,
  47336. partial: false,
  47337. asterisk: false,
  47338. pattern: null
  47339. });
  47340. }
  47341. }
  47342. return attachKeys(path, keys)
  47343. }
  47344. /**
  47345. * Transform an array into a regexp.
  47346. *
  47347. * @param {!Array} path
  47348. * @param {Array} keys
  47349. * @param {!Object} options
  47350. * @return {!RegExp}
  47351. */
  47352. function arrayToRegexp (path, keys, options) {
  47353. var parts = [];
  47354. for (var i = 0; i < path.length; i++) {
  47355. parts.push(pathToRegexp(path[i], keys, options).source);
  47356. }
  47357. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47358. return attachKeys(regexp, keys)
  47359. }
  47360. /**
  47361. * Create a path regexp from string input.
  47362. *
  47363. * @param {string} path
  47364. * @param {!Array} keys
  47365. * @param {!Object} options
  47366. * @return {!RegExp}
  47367. */
  47368. function stringToRegexp (path, keys, options) {
  47369. return tokensToRegExp(parse(path, options), keys, options)
  47370. }
  47371. /**
  47372. * Expose a function for taking tokens and returning a RegExp.
  47373. *
  47374. * @param {!Array} tokens
  47375. * @param {(Array|Object)=} keys
  47376. * @param {Object=} options
  47377. * @return {!RegExp}
  47378. */
  47379. function tokensToRegExp (tokens, keys, options) {
  47380. if (!isarray(keys)) {
  47381. options = /** @type {!Object} */ (keys || options);
  47382. keys = [];
  47383. }
  47384. options = options || {};
  47385. var strict = options.strict;
  47386. var end = options.end !== false;
  47387. var route = '';
  47388. // Iterate over the tokens and create our regexp string.
  47389. for (var i = 0; i < tokens.length; i++) {
  47390. var token = tokens[i];
  47391. if (typeof token === 'string') {
  47392. route += escapeString(token);
  47393. } else {
  47394. var prefix = escapeString(token.prefix);
  47395. var capture = '(?:' + token.pattern + ')';
  47396. keys.push(token);
  47397. if (token.repeat) {
  47398. capture += '(?:' + prefix + capture + ')*';
  47399. }
  47400. if (token.optional) {
  47401. if (!token.partial) {
  47402. capture = '(?:' + prefix + '(' + capture + '))?';
  47403. } else {
  47404. capture = prefix + '(' + capture + ')?';
  47405. }
  47406. } else {
  47407. capture = prefix + '(' + capture + ')';
  47408. }
  47409. route += capture;
  47410. }
  47411. }
  47412. var delimiter = escapeString(options.delimiter || '/');
  47413. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47414. // In non-strict mode we allow a slash at the end of match. If the path to
  47415. // match already ends with a slash, we remove it for consistency. The slash
  47416. // is valid at the end of a path match, not in the middle. This is important
  47417. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47418. if (!strict) {
  47419. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47420. }
  47421. if (end) {
  47422. route += '$';
  47423. } else {
  47424. // In non-ending mode, we need the capturing groups to match as much as
  47425. // possible by using a positive lookahead to the end or next path segment.
  47426. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47427. }
  47428. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47429. }
  47430. /**
  47431. * Normalize the given path string, returning a regular expression.
  47432. *
  47433. * An empty array can be passed in for the keys, which will hold the
  47434. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47435. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47436. *
  47437. * @param {(string|RegExp|Array)} path
  47438. * @param {(Array|Object)=} keys
  47439. * @param {Object=} options
  47440. * @return {!RegExp}
  47441. */
  47442. function pathToRegexp (path, keys, options) {
  47443. if (!isarray(keys)) {
  47444. options = /** @type {!Object} */ (keys || options);
  47445. keys = [];
  47446. }
  47447. options = options || {};
  47448. if (path instanceof RegExp) {
  47449. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47450. }
  47451. if (isarray(path)) {
  47452. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47453. }
  47454. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47455. }
  47456. pathToRegexp_1.parse = parse_1;
  47457. pathToRegexp_1.compile = compile_1;
  47458. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47459. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47460. /* */
  47461. // $flow-disable-line
  47462. var regexpCompileCache = Object.create(null);
  47463. function fillParams (
  47464. path,
  47465. params,
  47466. routeMsg
  47467. ) {
  47468. params = params || {};
  47469. try {
  47470. var filler =
  47471. regexpCompileCache[path] ||
  47472. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47473. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47474. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47475. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47476. return filler(params, { pretty: true })
  47477. } catch (e) {
  47478. if (true) {
  47479. // Fix #3072 no warn if `pathMatch` is string
  47480. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47481. }
  47482. return ''
  47483. } finally {
  47484. // delete the 0 if it was added
  47485. delete params[0];
  47486. }
  47487. }
  47488. /* */
  47489. function normalizeLocation (
  47490. raw,
  47491. current,
  47492. append,
  47493. router
  47494. ) {
  47495. var next = typeof raw === 'string' ? { path: raw } : raw;
  47496. // named target
  47497. if (next._normalized) {
  47498. return next
  47499. } else if (next.name) {
  47500. next = extend({}, raw);
  47501. var params = next.params;
  47502. if (params && typeof params === 'object') {
  47503. next.params = extend({}, params);
  47504. }
  47505. return next
  47506. }
  47507. // relative params
  47508. if (!next.path && next.params && current) {
  47509. next = extend({}, next);
  47510. next._normalized = true;
  47511. var params$1 = extend(extend({}, current.params), next.params);
  47512. if (current.name) {
  47513. next.name = current.name;
  47514. next.params = params$1;
  47515. } else if (current.matched.length) {
  47516. var rawPath = current.matched[current.matched.length - 1].path;
  47517. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47518. } else if (true) {
  47519. warn(false, "relative params navigation requires a current route.");
  47520. }
  47521. return next
  47522. }
  47523. var parsedPath = parsePath(next.path || '');
  47524. var basePath = (current && current.path) || '/';
  47525. var path = parsedPath.path
  47526. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47527. : basePath;
  47528. var query = resolveQuery(
  47529. parsedPath.query,
  47530. next.query,
  47531. router && router.options.parseQuery
  47532. );
  47533. var hash = next.hash || parsedPath.hash;
  47534. if (hash && hash.charAt(0) !== '#') {
  47535. hash = "#" + hash;
  47536. }
  47537. return {
  47538. _normalized: true,
  47539. path: path,
  47540. query: query,
  47541. hash: hash
  47542. }
  47543. }
  47544. /* */
  47545. // work around weird flow bug
  47546. var toTypes = [String, Object];
  47547. var eventTypes = [String, Array];
  47548. var noop = function () {};
  47549. var Link = {
  47550. name: 'RouterLink',
  47551. props: {
  47552. to: {
  47553. type: toTypes,
  47554. required: true
  47555. },
  47556. tag: {
  47557. type: String,
  47558. default: 'a'
  47559. },
  47560. exact: Boolean,
  47561. append: Boolean,
  47562. replace: Boolean,
  47563. activeClass: String,
  47564. exactActiveClass: String,
  47565. event: {
  47566. type: eventTypes,
  47567. default: 'click'
  47568. }
  47569. },
  47570. render: function render (h) {
  47571. var this$1 = this;
  47572. var router = this.$router;
  47573. var current = this.$route;
  47574. var ref = router.resolve(
  47575. this.to,
  47576. current,
  47577. this.append
  47578. );
  47579. var location = ref.location;
  47580. var route = ref.route;
  47581. var href = ref.href;
  47582. var classes = {};
  47583. var globalActiveClass = router.options.linkActiveClass;
  47584. var globalExactActiveClass = router.options.linkExactActiveClass;
  47585. // Support global empty active class
  47586. var activeClassFallback =
  47587. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47588. var exactActiveClassFallback =
  47589. globalExactActiveClass == null
  47590. ? 'router-link-exact-active'
  47591. : globalExactActiveClass;
  47592. var activeClass =
  47593. this.activeClass == null ? activeClassFallback : this.activeClass;
  47594. var exactActiveClass =
  47595. this.exactActiveClass == null
  47596. ? exactActiveClassFallback
  47597. : this.exactActiveClass;
  47598. var compareTarget = route.redirectedFrom
  47599. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47600. : route;
  47601. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47602. classes[activeClass] = this.exact
  47603. ? classes[exactActiveClass]
  47604. : isIncludedRoute(current, compareTarget);
  47605. var handler = function (e) {
  47606. if (guardEvent(e)) {
  47607. if (this$1.replace) {
  47608. router.replace(location, noop);
  47609. } else {
  47610. router.push(location, noop);
  47611. }
  47612. }
  47613. };
  47614. var on = { click: guardEvent };
  47615. if (Array.isArray(this.event)) {
  47616. this.event.forEach(function (e) {
  47617. on[e] = handler;
  47618. });
  47619. } else {
  47620. on[this.event] = handler;
  47621. }
  47622. var data = { class: classes };
  47623. var scopedSlot =
  47624. !this.$scopedSlots.$hasNormal &&
  47625. this.$scopedSlots.default &&
  47626. this.$scopedSlots.default({
  47627. href: href,
  47628. route: route,
  47629. navigate: handler,
  47630. isActive: classes[activeClass],
  47631. isExactActive: classes[exactActiveClass]
  47632. });
  47633. if (scopedSlot) {
  47634. if (scopedSlot.length === 1) {
  47635. return scopedSlot[0]
  47636. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47637. if (true) {
  47638. warn(
  47639. false,
  47640. ("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.")
  47641. );
  47642. }
  47643. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47644. }
  47645. }
  47646. if (this.tag === 'a') {
  47647. data.on = on;
  47648. data.attrs = { href: href };
  47649. } else {
  47650. // find the first <a> child and apply listener and href
  47651. var a = findAnchor(this.$slots.default);
  47652. if (a) {
  47653. // in case the <a> is a static node
  47654. a.isStatic = false;
  47655. var aData = (a.data = extend({}, a.data));
  47656. aData.on = aData.on || {};
  47657. // transform existing events in both objects into arrays so we can push later
  47658. for (var event in aData.on) {
  47659. var handler$1 = aData.on[event];
  47660. if (event in on) {
  47661. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47662. }
  47663. }
  47664. // append new listeners for router-link
  47665. for (var event$1 in on) {
  47666. if (event$1 in aData.on) {
  47667. // on[event] is always a function
  47668. aData.on[event$1].push(on[event$1]);
  47669. } else {
  47670. aData.on[event$1] = handler;
  47671. }
  47672. }
  47673. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47674. aAttrs.href = href;
  47675. } else {
  47676. // doesn't have <a> child, apply listener to self
  47677. data.on = on;
  47678. }
  47679. }
  47680. return h(this.tag, data, this.$slots.default)
  47681. }
  47682. };
  47683. function guardEvent (e) {
  47684. // don't redirect with control keys
  47685. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47686. // don't redirect when preventDefault called
  47687. if (e.defaultPrevented) { return }
  47688. // don't redirect on right click
  47689. if (e.button !== undefined && e.button !== 0) { return }
  47690. // don't redirect if `target="_blank"`
  47691. if (e.currentTarget && e.currentTarget.getAttribute) {
  47692. var target = e.currentTarget.getAttribute('target');
  47693. if (/\b_blank\b/i.test(target)) { return }
  47694. }
  47695. // this may be a Weex event which doesn't have this method
  47696. if (e.preventDefault) {
  47697. e.preventDefault();
  47698. }
  47699. return true
  47700. }
  47701. function findAnchor (children) {
  47702. if (children) {
  47703. var child;
  47704. for (var i = 0; i < children.length; i++) {
  47705. child = children[i];
  47706. if (child.tag === 'a') {
  47707. return child
  47708. }
  47709. if (child.children && (child = findAnchor(child.children))) {
  47710. return child
  47711. }
  47712. }
  47713. }
  47714. }
  47715. var _Vue;
  47716. function install (Vue) {
  47717. if (install.installed && _Vue === Vue) { return }
  47718. install.installed = true;
  47719. _Vue = Vue;
  47720. var isDef = function (v) { return v !== undefined; };
  47721. var registerInstance = function (vm, callVal) {
  47722. var i = vm.$options._parentVnode;
  47723. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47724. i(vm, callVal);
  47725. }
  47726. };
  47727. Vue.mixin({
  47728. beforeCreate: function beforeCreate () {
  47729. if (isDef(this.$options.router)) {
  47730. this._routerRoot = this;
  47731. this._router = this.$options.router;
  47732. this._router.init(this);
  47733. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47734. } else {
  47735. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47736. }
  47737. registerInstance(this, this);
  47738. },
  47739. destroyed: function destroyed () {
  47740. registerInstance(this);
  47741. }
  47742. });
  47743. Object.defineProperty(Vue.prototype, '$router', {
  47744. get: function get () { return this._routerRoot._router }
  47745. });
  47746. Object.defineProperty(Vue.prototype, '$route', {
  47747. get: function get () { return this._routerRoot._route }
  47748. });
  47749. Vue.component('RouterView', View);
  47750. Vue.component('RouterLink', Link);
  47751. var strats = Vue.config.optionMergeStrategies;
  47752. // use the same hook merging strategy for route hooks
  47753. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47754. }
  47755. /* */
  47756. var inBrowser = typeof window !== 'undefined';
  47757. /* */
  47758. function createRouteMap (
  47759. routes,
  47760. oldPathList,
  47761. oldPathMap,
  47762. oldNameMap
  47763. ) {
  47764. // the path list is used to control path matching priority
  47765. var pathList = oldPathList || [];
  47766. // $flow-disable-line
  47767. var pathMap = oldPathMap || Object.create(null);
  47768. // $flow-disable-line
  47769. var nameMap = oldNameMap || Object.create(null);
  47770. routes.forEach(function (route) {
  47771. addRouteRecord(pathList, pathMap, nameMap, route);
  47772. });
  47773. // ensure wildcard routes are always at the end
  47774. for (var i = 0, l = pathList.length; i < l; i++) {
  47775. if (pathList[i] === '*') {
  47776. pathList.push(pathList.splice(i, 1)[0]);
  47777. l--;
  47778. i--;
  47779. }
  47780. }
  47781. if (true) {
  47782. // warn if routes do not include leading slashes
  47783. var found = pathList
  47784. // check for missing leading slash
  47785. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47786. if (found.length > 0) {
  47787. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47788. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47789. }
  47790. }
  47791. return {
  47792. pathList: pathList,
  47793. pathMap: pathMap,
  47794. nameMap: nameMap
  47795. }
  47796. }
  47797. function addRouteRecord (
  47798. pathList,
  47799. pathMap,
  47800. nameMap,
  47801. route,
  47802. parent,
  47803. matchAs
  47804. ) {
  47805. var path = route.path;
  47806. var name = route.name;
  47807. if (true) {
  47808. assert(path != null, "\"path\" is required in a route configuration.");
  47809. assert(
  47810. typeof route.component !== 'string',
  47811. "route config \"component\" for path: " + (String(
  47812. path || name
  47813. )) + " cannot be a " + "string id. Use an actual component instead."
  47814. );
  47815. }
  47816. var pathToRegexpOptions =
  47817. route.pathToRegexpOptions || {};
  47818. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47819. if (typeof route.caseSensitive === 'boolean') {
  47820. pathToRegexpOptions.sensitive = route.caseSensitive;
  47821. }
  47822. var record = {
  47823. path: normalizedPath,
  47824. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47825. components: route.components || { default: route.component },
  47826. instances: {},
  47827. name: name,
  47828. parent: parent,
  47829. matchAs: matchAs,
  47830. redirect: route.redirect,
  47831. beforeEnter: route.beforeEnter,
  47832. meta: route.meta || {},
  47833. props:
  47834. route.props == null
  47835. ? {}
  47836. : route.components
  47837. ? route.props
  47838. : { default: route.props }
  47839. };
  47840. if (route.children) {
  47841. // Warn if route is named, does not redirect and has a default child route.
  47842. // If users navigate to this route by name, the default child will
  47843. // not be rendered (GH Issue #629)
  47844. if (true) {
  47845. if (
  47846. route.name &&
  47847. !route.redirect &&
  47848. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47849. ) {
  47850. warn(
  47851. false,
  47852. "Named Route '" + (route.name) + "' has a default child route. " +
  47853. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47854. "the default child route will not be rendered. Remove the name from " +
  47855. "this route and use the name of the default child route for named " +
  47856. "links instead."
  47857. );
  47858. }
  47859. }
  47860. route.children.forEach(function (child) {
  47861. var childMatchAs = matchAs
  47862. ? cleanPath((matchAs + "/" + (child.path)))
  47863. : undefined;
  47864. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47865. });
  47866. }
  47867. if (!pathMap[record.path]) {
  47868. pathList.push(record.path);
  47869. pathMap[record.path] = record;
  47870. }
  47871. if (route.alias !== undefined) {
  47872. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47873. for (var i = 0; i < aliases.length; ++i) {
  47874. var alias = aliases[i];
  47875. if ( true && alias === path) {
  47876. warn(
  47877. false,
  47878. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47879. );
  47880. // skip in dev to make it work
  47881. continue
  47882. }
  47883. var aliasRoute = {
  47884. path: alias,
  47885. children: route.children
  47886. };
  47887. addRouteRecord(
  47888. pathList,
  47889. pathMap,
  47890. nameMap,
  47891. aliasRoute,
  47892. parent,
  47893. record.path || '/' // matchAs
  47894. );
  47895. }
  47896. }
  47897. if (name) {
  47898. if (!nameMap[name]) {
  47899. nameMap[name] = record;
  47900. } else if ( true && !matchAs) {
  47901. warn(
  47902. false,
  47903. "Duplicate named routes definition: " +
  47904. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  47905. );
  47906. }
  47907. }
  47908. }
  47909. function compileRouteRegex (
  47910. path,
  47911. pathToRegexpOptions
  47912. ) {
  47913. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  47914. if (true) {
  47915. var keys = Object.create(null);
  47916. regex.keys.forEach(function (key) {
  47917. warn(
  47918. !keys[key.name],
  47919. ("Duplicate param keys in route with path: \"" + path + "\"")
  47920. );
  47921. keys[key.name] = true;
  47922. });
  47923. }
  47924. return regex
  47925. }
  47926. function normalizePath (
  47927. path,
  47928. parent,
  47929. strict
  47930. ) {
  47931. if (!strict) { path = path.replace(/\/$/, ''); }
  47932. if (path[0] === '/') { return path }
  47933. if (parent == null) { return path }
  47934. return cleanPath(((parent.path) + "/" + path))
  47935. }
  47936. /* */
  47937. function createMatcher (
  47938. routes,
  47939. router
  47940. ) {
  47941. var ref = createRouteMap(routes);
  47942. var pathList = ref.pathList;
  47943. var pathMap = ref.pathMap;
  47944. var nameMap = ref.nameMap;
  47945. function addRoutes (routes) {
  47946. createRouteMap(routes, pathList, pathMap, nameMap);
  47947. }
  47948. function match (
  47949. raw,
  47950. currentRoute,
  47951. redirectedFrom
  47952. ) {
  47953. var location = normalizeLocation(raw, currentRoute, false, router);
  47954. var name = location.name;
  47955. if (name) {
  47956. var record = nameMap[name];
  47957. if (true) {
  47958. warn(record, ("Route with name '" + name + "' does not exist"));
  47959. }
  47960. if (!record) { return _createRoute(null, location) }
  47961. var paramNames = record.regex.keys
  47962. .filter(function (key) { return !key.optional; })
  47963. .map(function (key) { return key.name; });
  47964. if (typeof location.params !== 'object') {
  47965. location.params = {};
  47966. }
  47967. if (currentRoute && typeof currentRoute.params === 'object') {
  47968. for (var key in currentRoute.params) {
  47969. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  47970. location.params[key] = currentRoute.params[key];
  47971. }
  47972. }
  47973. }
  47974. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  47975. return _createRoute(record, location, redirectedFrom)
  47976. } else if (location.path) {
  47977. location.params = {};
  47978. for (var i = 0; i < pathList.length; i++) {
  47979. var path = pathList[i];
  47980. var record$1 = pathMap[path];
  47981. if (matchRoute(record$1.regex, location.path, location.params)) {
  47982. return _createRoute(record$1, location, redirectedFrom)
  47983. }
  47984. }
  47985. }
  47986. // no match
  47987. return _createRoute(null, location)
  47988. }
  47989. function redirect (
  47990. record,
  47991. location
  47992. ) {
  47993. var originalRedirect = record.redirect;
  47994. var redirect = typeof originalRedirect === 'function'
  47995. ? originalRedirect(createRoute(record, location, null, router))
  47996. : originalRedirect;
  47997. if (typeof redirect === 'string') {
  47998. redirect = { path: redirect };
  47999. }
  48000. if (!redirect || typeof redirect !== 'object') {
  48001. if (true) {
  48002. warn(
  48003. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48004. );
  48005. }
  48006. return _createRoute(null, location)
  48007. }
  48008. var re = redirect;
  48009. var name = re.name;
  48010. var path = re.path;
  48011. var query = location.query;
  48012. var hash = location.hash;
  48013. var params = location.params;
  48014. query = re.hasOwnProperty('query') ? re.query : query;
  48015. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48016. params = re.hasOwnProperty('params') ? re.params : params;
  48017. if (name) {
  48018. // resolved named direct
  48019. var targetRecord = nameMap[name];
  48020. if (true) {
  48021. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48022. }
  48023. return match({
  48024. _normalized: true,
  48025. name: name,
  48026. query: query,
  48027. hash: hash,
  48028. params: params
  48029. }, undefined, location)
  48030. } else if (path) {
  48031. // 1. resolve relative redirect
  48032. var rawPath = resolveRecordPath(path, record);
  48033. // 2. resolve params
  48034. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48035. // 3. rematch with existing query and hash
  48036. return match({
  48037. _normalized: true,
  48038. path: resolvedPath,
  48039. query: query,
  48040. hash: hash
  48041. }, undefined, location)
  48042. } else {
  48043. if (true) {
  48044. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48045. }
  48046. return _createRoute(null, location)
  48047. }
  48048. }
  48049. function alias (
  48050. record,
  48051. location,
  48052. matchAs
  48053. ) {
  48054. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48055. var aliasedMatch = match({
  48056. _normalized: true,
  48057. path: aliasedPath
  48058. });
  48059. if (aliasedMatch) {
  48060. var matched = aliasedMatch.matched;
  48061. var aliasedRecord = matched[matched.length - 1];
  48062. location.params = aliasedMatch.params;
  48063. return _createRoute(aliasedRecord, location)
  48064. }
  48065. return _createRoute(null, location)
  48066. }
  48067. function _createRoute (
  48068. record,
  48069. location,
  48070. redirectedFrom
  48071. ) {
  48072. if (record && record.redirect) {
  48073. return redirect(record, redirectedFrom || location)
  48074. }
  48075. if (record && record.matchAs) {
  48076. return alias(record, location, record.matchAs)
  48077. }
  48078. return createRoute(record, location, redirectedFrom, router)
  48079. }
  48080. return {
  48081. match: match,
  48082. addRoutes: addRoutes
  48083. }
  48084. }
  48085. function matchRoute (
  48086. regex,
  48087. path,
  48088. params
  48089. ) {
  48090. var m = path.match(regex);
  48091. if (!m) {
  48092. return false
  48093. } else if (!params) {
  48094. return true
  48095. }
  48096. for (var i = 1, len = m.length; i < len; ++i) {
  48097. var key = regex.keys[i - 1];
  48098. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48099. if (key) {
  48100. // Fix #1994: using * with props: true generates a param named 0
  48101. params[key.name || 'pathMatch'] = val;
  48102. }
  48103. }
  48104. return true
  48105. }
  48106. function resolveRecordPath (path, record) {
  48107. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48108. }
  48109. /* */
  48110. // use User Timing api (if present) for more accurate key precision
  48111. var Time =
  48112. inBrowser && window.performance && window.performance.now
  48113. ? window.performance
  48114. : Date;
  48115. function genStateKey () {
  48116. return Time.now().toFixed(3)
  48117. }
  48118. var _key = genStateKey();
  48119. function getStateKey () {
  48120. return _key
  48121. }
  48122. function setStateKey (key) {
  48123. return (_key = key)
  48124. }
  48125. /* */
  48126. var positionStore = Object.create(null);
  48127. function setupScroll () {
  48128. // Fix for #1585 for Firefox
  48129. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48130. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48131. // window.location.protocol + '//' + window.location.host
  48132. // location.host contains the port and location.hostname doesn't
  48133. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48134. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48135. // preserve existing history state as it could be overriden by the user
  48136. var stateCopy = extend({}, window.history.state);
  48137. stateCopy.key = getStateKey();
  48138. window.history.replaceState(stateCopy, '', absolutePath);
  48139. window.addEventListener('popstate', function (e) {
  48140. saveScrollPosition();
  48141. if (e.state && e.state.key) {
  48142. setStateKey(e.state.key);
  48143. }
  48144. });
  48145. }
  48146. function handleScroll (
  48147. router,
  48148. to,
  48149. from,
  48150. isPop
  48151. ) {
  48152. if (!router.app) {
  48153. return
  48154. }
  48155. var behavior = router.options.scrollBehavior;
  48156. if (!behavior) {
  48157. return
  48158. }
  48159. if (true) {
  48160. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48161. }
  48162. // wait until re-render finishes before scrolling
  48163. router.app.$nextTick(function () {
  48164. var position = getScrollPosition();
  48165. var shouldScroll = behavior.call(
  48166. router,
  48167. to,
  48168. from,
  48169. isPop ? position : null
  48170. );
  48171. if (!shouldScroll) {
  48172. return
  48173. }
  48174. if (typeof shouldScroll.then === 'function') {
  48175. shouldScroll
  48176. .then(function (shouldScroll) {
  48177. scrollToPosition((shouldScroll), position);
  48178. })
  48179. .catch(function (err) {
  48180. if (true) {
  48181. assert(false, err.toString());
  48182. }
  48183. });
  48184. } else {
  48185. scrollToPosition(shouldScroll, position);
  48186. }
  48187. });
  48188. }
  48189. function saveScrollPosition () {
  48190. var key = getStateKey();
  48191. if (key) {
  48192. positionStore[key] = {
  48193. x: window.pageXOffset,
  48194. y: window.pageYOffset
  48195. };
  48196. }
  48197. }
  48198. function getScrollPosition () {
  48199. var key = getStateKey();
  48200. if (key) {
  48201. return positionStore[key]
  48202. }
  48203. }
  48204. function getElementPosition (el, offset) {
  48205. var docEl = document.documentElement;
  48206. var docRect = docEl.getBoundingClientRect();
  48207. var elRect = el.getBoundingClientRect();
  48208. return {
  48209. x: elRect.left - docRect.left - offset.x,
  48210. y: elRect.top - docRect.top - offset.y
  48211. }
  48212. }
  48213. function isValidPosition (obj) {
  48214. return isNumber(obj.x) || isNumber(obj.y)
  48215. }
  48216. function normalizePosition (obj) {
  48217. return {
  48218. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48219. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48220. }
  48221. }
  48222. function normalizeOffset (obj) {
  48223. return {
  48224. x: isNumber(obj.x) ? obj.x : 0,
  48225. y: isNumber(obj.y) ? obj.y : 0
  48226. }
  48227. }
  48228. function isNumber (v) {
  48229. return typeof v === 'number'
  48230. }
  48231. var hashStartsWithNumberRE = /^#\d/;
  48232. function scrollToPosition (shouldScroll, position) {
  48233. var isObject = typeof shouldScroll === 'object';
  48234. if (isObject && typeof shouldScroll.selector === 'string') {
  48235. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48236. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48237. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48238. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48239. : document.querySelector(shouldScroll.selector);
  48240. if (el) {
  48241. var offset =
  48242. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48243. ? shouldScroll.offset
  48244. : {};
  48245. offset = normalizeOffset(offset);
  48246. position = getElementPosition(el, offset);
  48247. } else if (isValidPosition(shouldScroll)) {
  48248. position = normalizePosition(shouldScroll);
  48249. }
  48250. } else if (isObject && isValidPosition(shouldScroll)) {
  48251. position = normalizePosition(shouldScroll);
  48252. }
  48253. if (position) {
  48254. window.scrollTo(position.x, position.y);
  48255. }
  48256. }
  48257. /* */
  48258. var supportsPushState =
  48259. inBrowser &&
  48260. (function () {
  48261. var ua = window.navigator.userAgent;
  48262. if (
  48263. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48264. ua.indexOf('Mobile Safari') !== -1 &&
  48265. ua.indexOf('Chrome') === -1 &&
  48266. ua.indexOf('Windows Phone') === -1
  48267. ) {
  48268. return false
  48269. }
  48270. return window.history && 'pushState' in window.history
  48271. })();
  48272. function pushState (url, replace) {
  48273. saveScrollPosition();
  48274. // try...catch the pushState call to get around Safari
  48275. // DOM Exception 18 where it limits to 100 pushState calls
  48276. var history = window.history;
  48277. try {
  48278. if (replace) {
  48279. // preserve existing history state as it could be overriden by the user
  48280. var stateCopy = extend({}, history.state);
  48281. stateCopy.key = getStateKey();
  48282. history.replaceState(stateCopy, '', url);
  48283. } else {
  48284. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48285. }
  48286. } catch (e) {
  48287. window.location[replace ? 'replace' : 'assign'](url);
  48288. }
  48289. }
  48290. function replaceState (url) {
  48291. pushState(url, true);
  48292. }
  48293. /* */
  48294. function runQueue (queue, fn, cb) {
  48295. var step = function (index) {
  48296. if (index >= queue.length) {
  48297. cb();
  48298. } else {
  48299. if (queue[index]) {
  48300. fn(queue[index], function () {
  48301. step(index + 1);
  48302. });
  48303. } else {
  48304. step(index + 1);
  48305. }
  48306. }
  48307. };
  48308. step(0);
  48309. }
  48310. /* */
  48311. function resolveAsyncComponents (matched) {
  48312. return function (to, from, next) {
  48313. var hasAsync = false;
  48314. var pending = 0;
  48315. var error = null;
  48316. flatMapComponents(matched, function (def, _, match, key) {
  48317. // if it's a function and doesn't have cid attached,
  48318. // assume it's an async component resolve function.
  48319. // we are not using Vue's default async resolving mechanism because
  48320. // we want to halt the navigation until the incoming component has been
  48321. // resolved.
  48322. if (typeof def === 'function' && def.cid === undefined) {
  48323. hasAsync = true;
  48324. pending++;
  48325. var resolve = once(function (resolvedDef) {
  48326. if (isESModule(resolvedDef)) {
  48327. resolvedDef = resolvedDef.default;
  48328. }
  48329. // save resolved on async factory in case it's used elsewhere
  48330. def.resolved = typeof resolvedDef === 'function'
  48331. ? resolvedDef
  48332. : _Vue.extend(resolvedDef);
  48333. match.components[key] = resolvedDef;
  48334. pending--;
  48335. if (pending <= 0) {
  48336. next();
  48337. }
  48338. });
  48339. var reject = once(function (reason) {
  48340. var msg = "Failed to resolve async component " + key + ": " + reason;
  48341. true && warn(false, msg);
  48342. if (!error) {
  48343. error = isError(reason)
  48344. ? reason
  48345. : new Error(msg);
  48346. next(error);
  48347. }
  48348. });
  48349. var res;
  48350. try {
  48351. res = def(resolve, reject);
  48352. } catch (e) {
  48353. reject(e);
  48354. }
  48355. if (res) {
  48356. if (typeof res.then === 'function') {
  48357. res.then(resolve, reject);
  48358. } else {
  48359. // new syntax in Vue 2.3
  48360. var comp = res.component;
  48361. if (comp && typeof comp.then === 'function') {
  48362. comp.then(resolve, reject);
  48363. }
  48364. }
  48365. }
  48366. }
  48367. });
  48368. if (!hasAsync) { next(); }
  48369. }
  48370. }
  48371. function flatMapComponents (
  48372. matched,
  48373. fn
  48374. ) {
  48375. return flatten(matched.map(function (m) {
  48376. return Object.keys(m.components).map(function (key) { return fn(
  48377. m.components[key],
  48378. m.instances[key],
  48379. m, key
  48380. ); })
  48381. }))
  48382. }
  48383. function flatten (arr) {
  48384. return Array.prototype.concat.apply([], arr)
  48385. }
  48386. var hasSymbol =
  48387. typeof Symbol === 'function' &&
  48388. typeof Symbol.toStringTag === 'symbol';
  48389. function isESModule (obj) {
  48390. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48391. }
  48392. // in Webpack 2, require.ensure now also returns a Promise
  48393. // so the resolve/reject functions may get called an extra time
  48394. // if the user uses an arrow function shorthand that happens to
  48395. // return that Promise.
  48396. function once (fn) {
  48397. var called = false;
  48398. return function () {
  48399. var args = [], len = arguments.length;
  48400. while ( len-- ) args[ len ] = arguments[ len ];
  48401. if (called) { return }
  48402. called = true;
  48403. return fn.apply(this, args)
  48404. }
  48405. }
  48406. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48407. function NavigationDuplicated (normalizedLocation) {
  48408. Error.call(this);
  48409. this.name = this._name = 'NavigationDuplicated';
  48410. // passing the message to super() doesn't seem to work in the transpiled version
  48411. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48412. // add a stack property so services like Sentry can correctly display it
  48413. Object.defineProperty(this, 'stack', {
  48414. value: new Error().stack,
  48415. writable: true,
  48416. configurable: true
  48417. });
  48418. // we could also have used
  48419. // Error.captureStackTrace(this, this.constructor)
  48420. // but it only exists on node and chrome
  48421. }
  48422. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48423. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48424. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48425. return NavigationDuplicated;
  48426. }(Error));
  48427. // support IE9
  48428. NavigationDuplicated._name = 'NavigationDuplicated';
  48429. /* */
  48430. var History = function History (router, base) {
  48431. this.router = router;
  48432. this.base = normalizeBase(base);
  48433. // start with a route object that stands for "nowhere"
  48434. this.current = START;
  48435. this.pending = null;
  48436. this.ready = false;
  48437. this.readyCbs = [];
  48438. this.readyErrorCbs = [];
  48439. this.errorCbs = [];
  48440. };
  48441. History.prototype.listen = function listen (cb) {
  48442. this.cb = cb;
  48443. };
  48444. History.prototype.onReady = function onReady (cb, errorCb) {
  48445. if (this.ready) {
  48446. cb();
  48447. } else {
  48448. this.readyCbs.push(cb);
  48449. if (errorCb) {
  48450. this.readyErrorCbs.push(errorCb);
  48451. }
  48452. }
  48453. };
  48454. History.prototype.onError = function onError (errorCb) {
  48455. this.errorCbs.push(errorCb);
  48456. };
  48457. History.prototype.transitionTo = function transitionTo (
  48458. location,
  48459. onComplete,
  48460. onAbort
  48461. ) {
  48462. var this$1 = this;
  48463. var route = this.router.match(location, this.current);
  48464. this.confirmTransition(
  48465. route,
  48466. function () {
  48467. this$1.updateRoute(route);
  48468. onComplete && onComplete(route);
  48469. this$1.ensureURL();
  48470. // fire ready cbs once
  48471. if (!this$1.ready) {
  48472. this$1.ready = true;
  48473. this$1.readyCbs.forEach(function (cb) {
  48474. cb(route);
  48475. });
  48476. }
  48477. },
  48478. function (err) {
  48479. if (onAbort) {
  48480. onAbort(err);
  48481. }
  48482. if (err && !this$1.ready) {
  48483. this$1.ready = true;
  48484. this$1.readyErrorCbs.forEach(function (cb) {
  48485. cb(err);
  48486. });
  48487. }
  48488. }
  48489. );
  48490. };
  48491. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48492. var this$1 = this;
  48493. var current = this.current;
  48494. var abort = function (err) {
  48495. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48496. // When the user navigates through history through back/forward buttons
  48497. // we do not want to throw the error. We only throw it if directly calling
  48498. // push/replace. That's why it's not included in isError
  48499. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48500. if (this$1.errorCbs.length) {
  48501. this$1.errorCbs.forEach(function (cb) {
  48502. cb(err);
  48503. });
  48504. } else {
  48505. warn(false, 'uncaught error during route navigation:');
  48506. console.error(err);
  48507. }
  48508. }
  48509. onAbort && onAbort(err);
  48510. };
  48511. if (
  48512. isSameRoute(route, current) &&
  48513. // in the case the route map has been dynamically appended to
  48514. route.matched.length === current.matched.length
  48515. ) {
  48516. this.ensureURL();
  48517. return abort(new NavigationDuplicated(route))
  48518. }
  48519. var ref = resolveQueue(
  48520. this.current.matched,
  48521. route.matched
  48522. );
  48523. var updated = ref.updated;
  48524. var deactivated = ref.deactivated;
  48525. var activated = ref.activated;
  48526. var queue = [].concat(
  48527. // in-component leave guards
  48528. extractLeaveGuards(deactivated),
  48529. // global before hooks
  48530. this.router.beforeHooks,
  48531. // in-component update hooks
  48532. extractUpdateHooks(updated),
  48533. // in-config enter guards
  48534. activated.map(function (m) { return m.beforeEnter; }),
  48535. // async components
  48536. resolveAsyncComponents(activated)
  48537. );
  48538. this.pending = route;
  48539. var iterator = function (hook, next) {
  48540. if (this$1.pending !== route) {
  48541. return abort()
  48542. }
  48543. try {
  48544. hook(route, current, function (to) {
  48545. if (to === false || isError(to)) {
  48546. // next(false) -> abort navigation, ensure current URL
  48547. this$1.ensureURL(true);
  48548. abort(to);
  48549. } else if (
  48550. typeof to === 'string' ||
  48551. (typeof to === 'object' &&
  48552. (typeof to.path === 'string' || typeof to.name === 'string'))
  48553. ) {
  48554. // next('/') or next({ path: '/' }) -> redirect
  48555. abort();
  48556. if (typeof to === 'object' && to.replace) {
  48557. this$1.replace(to);
  48558. } else {
  48559. this$1.push(to);
  48560. }
  48561. } else {
  48562. // confirm transition and pass on the value
  48563. next(to);
  48564. }
  48565. });
  48566. } catch (e) {
  48567. abort(e);
  48568. }
  48569. };
  48570. runQueue(queue, iterator, function () {
  48571. var postEnterCbs = [];
  48572. var isValid = function () { return this$1.current === route; };
  48573. // wait until async components are resolved before
  48574. // extracting in-component enter guards
  48575. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48576. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48577. runQueue(queue, iterator, function () {
  48578. if (this$1.pending !== route) {
  48579. return abort()
  48580. }
  48581. this$1.pending = null;
  48582. onComplete(route);
  48583. if (this$1.router.app) {
  48584. this$1.router.app.$nextTick(function () {
  48585. postEnterCbs.forEach(function (cb) {
  48586. cb();
  48587. });
  48588. });
  48589. }
  48590. });
  48591. });
  48592. };
  48593. History.prototype.updateRoute = function updateRoute (route) {
  48594. var prev = this.current;
  48595. this.current = route;
  48596. this.cb && this.cb(route);
  48597. this.router.afterHooks.forEach(function (hook) {
  48598. hook && hook(route, prev);
  48599. });
  48600. };
  48601. function normalizeBase (base) {
  48602. if (!base) {
  48603. if (inBrowser) {
  48604. // respect <base> tag
  48605. var baseEl = document.querySelector('base');
  48606. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48607. // strip full URL origin
  48608. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48609. } else {
  48610. base = '/';
  48611. }
  48612. }
  48613. // make sure there's the starting slash
  48614. if (base.charAt(0) !== '/') {
  48615. base = '/' + base;
  48616. }
  48617. // remove trailing slash
  48618. return base.replace(/\/$/, '')
  48619. }
  48620. function resolveQueue (
  48621. current,
  48622. next
  48623. ) {
  48624. var i;
  48625. var max = Math.max(current.length, next.length);
  48626. for (i = 0; i < max; i++) {
  48627. if (current[i] !== next[i]) {
  48628. break
  48629. }
  48630. }
  48631. return {
  48632. updated: next.slice(0, i),
  48633. activated: next.slice(i),
  48634. deactivated: current.slice(i)
  48635. }
  48636. }
  48637. function extractGuards (
  48638. records,
  48639. name,
  48640. bind,
  48641. reverse
  48642. ) {
  48643. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48644. var guard = extractGuard(def, name);
  48645. if (guard) {
  48646. return Array.isArray(guard)
  48647. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48648. : bind(guard, instance, match, key)
  48649. }
  48650. });
  48651. return flatten(reverse ? guards.reverse() : guards)
  48652. }
  48653. function extractGuard (
  48654. def,
  48655. key
  48656. ) {
  48657. if (typeof def !== 'function') {
  48658. // extend now so that global mixins are applied.
  48659. def = _Vue.extend(def);
  48660. }
  48661. return def.options[key]
  48662. }
  48663. function extractLeaveGuards (deactivated) {
  48664. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48665. }
  48666. function extractUpdateHooks (updated) {
  48667. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48668. }
  48669. function bindGuard (guard, instance) {
  48670. if (instance) {
  48671. return function boundRouteGuard () {
  48672. return guard.apply(instance, arguments)
  48673. }
  48674. }
  48675. }
  48676. function extractEnterGuards (
  48677. activated,
  48678. cbs,
  48679. isValid
  48680. ) {
  48681. return extractGuards(
  48682. activated,
  48683. 'beforeRouteEnter',
  48684. function (guard, _, match, key) {
  48685. return bindEnterGuard(guard, match, key, cbs, isValid)
  48686. }
  48687. )
  48688. }
  48689. function bindEnterGuard (
  48690. guard,
  48691. match,
  48692. key,
  48693. cbs,
  48694. isValid
  48695. ) {
  48696. return function routeEnterGuard (to, from, next) {
  48697. return guard(to, from, function (cb) {
  48698. if (typeof cb === 'function') {
  48699. cbs.push(function () {
  48700. // #750
  48701. // if a router-view is wrapped with an out-in transition,
  48702. // the instance may not have been registered at this time.
  48703. // we will need to poll for registration until current route
  48704. // is no longer valid.
  48705. poll(cb, match.instances, key, isValid);
  48706. });
  48707. }
  48708. next(cb);
  48709. })
  48710. }
  48711. }
  48712. function poll (
  48713. cb, // somehow flow cannot infer this is a function
  48714. instances,
  48715. key,
  48716. isValid
  48717. ) {
  48718. if (
  48719. instances[key] &&
  48720. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48721. ) {
  48722. cb(instances[key]);
  48723. } else if (isValid()) {
  48724. setTimeout(function () {
  48725. poll(cb, instances, key, isValid);
  48726. }, 16);
  48727. }
  48728. }
  48729. /* */
  48730. var HTML5History = /*@__PURE__*/(function (History) {
  48731. function HTML5History (router, base) {
  48732. var this$1 = this;
  48733. History.call(this, router, base);
  48734. var expectScroll = router.options.scrollBehavior;
  48735. var supportsScroll = supportsPushState && expectScroll;
  48736. if (supportsScroll) {
  48737. setupScroll();
  48738. }
  48739. var initLocation = getLocation(this.base);
  48740. window.addEventListener('popstate', function (e) {
  48741. var current = this$1.current;
  48742. // Avoiding first `popstate` event dispatched in some browsers but first
  48743. // history route not updated since async guard at the same time.
  48744. var location = getLocation(this$1.base);
  48745. if (this$1.current === START && location === initLocation) {
  48746. return
  48747. }
  48748. this$1.transitionTo(location, function (route) {
  48749. if (supportsScroll) {
  48750. handleScroll(router, route, current, true);
  48751. }
  48752. });
  48753. });
  48754. }
  48755. if ( History ) HTML5History.__proto__ = History;
  48756. HTML5History.prototype = Object.create( History && History.prototype );
  48757. HTML5History.prototype.constructor = HTML5History;
  48758. HTML5History.prototype.go = function go (n) {
  48759. window.history.go(n);
  48760. };
  48761. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48762. var this$1 = this;
  48763. var ref = this;
  48764. var fromRoute = ref.current;
  48765. this.transitionTo(location, function (route) {
  48766. pushState(cleanPath(this$1.base + route.fullPath));
  48767. handleScroll(this$1.router, route, fromRoute, false);
  48768. onComplete && onComplete(route);
  48769. }, onAbort);
  48770. };
  48771. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48772. var this$1 = this;
  48773. var ref = this;
  48774. var fromRoute = ref.current;
  48775. this.transitionTo(location, function (route) {
  48776. replaceState(cleanPath(this$1.base + route.fullPath));
  48777. handleScroll(this$1.router, route, fromRoute, false);
  48778. onComplete && onComplete(route);
  48779. }, onAbort);
  48780. };
  48781. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48782. if (getLocation(this.base) !== this.current.fullPath) {
  48783. var current = cleanPath(this.base + this.current.fullPath);
  48784. push ? pushState(current) : replaceState(current);
  48785. }
  48786. };
  48787. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48788. return getLocation(this.base)
  48789. };
  48790. return HTML5History;
  48791. }(History));
  48792. function getLocation (base) {
  48793. var path = decodeURI(window.location.pathname);
  48794. if (base && path.indexOf(base) === 0) {
  48795. path = path.slice(base.length);
  48796. }
  48797. return (path || '/') + window.location.search + window.location.hash
  48798. }
  48799. /* */
  48800. var HashHistory = /*@__PURE__*/(function (History) {
  48801. function HashHistory (router, base, fallback) {
  48802. History.call(this, router, base);
  48803. // check history fallback deeplinking
  48804. if (fallback && checkFallback(this.base)) {
  48805. return
  48806. }
  48807. ensureSlash();
  48808. }
  48809. if ( History ) HashHistory.__proto__ = History;
  48810. HashHistory.prototype = Object.create( History && History.prototype );
  48811. HashHistory.prototype.constructor = HashHistory;
  48812. // this is delayed until the app mounts
  48813. // to avoid the hashchange listener being fired too early
  48814. HashHistory.prototype.setupListeners = function setupListeners () {
  48815. var this$1 = this;
  48816. var router = this.router;
  48817. var expectScroll = router.options.scrollBehavior;
  48818. var supportsScroll = supportsPushState && expectScroll;
  48819. if (supportsScroll) {
  48820. setupScroll();
  48821. }
  48822. window.addEventListener(
  48823. supportsPushState ? 'popstate' : 'hashchange',
  48824. function () {
  48825. var current = this$1.current;
  48826. if (!ensureSlash()) {
  48827. return
  48828. }
  48829. this$1.transitionTo(getHash(), function (route) {
  48830. if (supportsScroll) {
  48831. handleScroll(this$1.router, route, current, true);
  48832. }
  48833. if (!supportsPushState) {
  48834. replaceHash(route.fullPath);
  48835. }
  48836. });
  48837. }
  48838. );
  48839. };
  48840. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48841. var this$1 = this;
  48842. var ref = this;
  48843. var fromRoute = ref.current;
  48844. this.transitionTo(
  48845. location,
  48846. function (route) {
  48847. pushHash(route.fullPath);
  48848. handleScroll(this$1.router, route, fromRoute, false);
  48849. onComplete && onComplete(route);
  48850. },
  48851. onAbort
  48852. );
  48853. };
  48854. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48855. var this$1 = this;
  48856. var ref = this;
  48857. var fromRoute = ref.current;
  48858. this.transitionTo(
  48859. location,
  48860. function (route) {
  48861. replaceHash(route.fullPath);
  48862. handleScroll(this$1.router, route, fromRoute, false);
  48863. onComplete && onComplete(route);
  48864. },
  48865. onAbort
  48866. );
  48867. };
  48868. HashHistory.prototype.go = function go (n) {
  48869. window.history.go(n);
  48870. };
  48871. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48872. var current = this.current.fullPath;
  48873. if (getHash() !== current) {
  48874. push ? pushHash(current) : replaceHash(current);
  48875. }
  48876. };
  48877. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48878. return getHash()
  48879. };
  48880. return HashHistory;
  48881. }(History));
  48882. function checkFallback (base) {
  48883. var location = getLocation(base);
  48884. if (!/^\/#/.test(location)) {
  48885. window.location.replace(cleanPath(base + '/#' + location));
  48886. return true
  48887. }
  48888. }
  48889. function ensureSlash () {
  48890. var path = getHash();
  48891. if (path.charAt(0) === '/') {
  48892. return true
  48893. }
  48894. replaceHash('/' + path);
  48895. return false
  48896. }
  48897. function getHash () {
  48898. // We can't use window.location.hash here because it's not
  48899. // consistent across browsers - Firefox will pre-decode it!
  48900. var href = window.location.href;
  48901. var index = href.indexOf('#');
  48902. // empty path
  48903. if (index < 0) { return '' }
  48904. href = href.slice(index + 1);
  48905. // decode the hash but not the search or hash
  48906. // as search(query) is already decoded
  48907. // https://github.com/vuejs/vue-router/issues/2708
  48908. var searchIndex = href.indexOf('?');
  48909. if (searchIndex < 0) {
  48910. var hashIndex = href.indexOf('#');
  48911. if (hashIndex > -1) {
  48912. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  48913. } else { href = decodeURI(href); }
  48914. } else {
  48915. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  48916. }
  48917. return href
  48918. }
  48919. function getUrl (path) {
  48920. var href = window.location.href;
  48921. var i = href.indexOf('#');
  48922. var base = i >= 0 ? href.slice(0, i) : href;
  48923. return (base + "#" + path)
  48924. }
  48925. function pushHash (path) {
  48926. if (supportsPushState) {
  48927. pushState(getUrl(path));
  48928. } else {
  48929. window.location.hash = path;
  48930. }
  48931. }
  48932. function replaceHash (path) {
  48933. if (supportsPushState) {
  48934. replaceState(getUrl(path));
  48935. } else {
  48936. window.location.replace(getUrl(path));
  48937. }
  48938. }
  48939. /* */
  48940. var AbstractHistory = /*@__PURE__*/(function (History) {
  48941. function AbstractHistory (router, base) {
  48942. History.call(this, router, base);
  48943. this.stack = [];
  48944. this.index = -1;
  48945. }
  48946. if ( History ) AbstractHistory.__proto__ = History;
  48947. AbstractHistory.prototype = Object.create( History && History.prototype );
  48948. AbstractHistory.prototype.constructor = AbstractHistory;
  48949. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  48950. var this$1 = this;
  48951. this.transitionTo(
  48952. location,
  48953. function (route) {
  48954. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  48955. this$1.index++;
  48956. onComplete && onComplete(route);
  48957. },
  48958. onAbort
  48959. );
  48960. };
  48961. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48962. var this$1 = this;
  48963. this.transitionTo(
  48964. location,
  48965. function (route) {
  48966. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  48967. onComplete && onComplete(route);
  48968. },
  48969. onAbort
  48970. );
  48971. };
  48972. AbstractHistory.prototype.go = function go (n) {
  48973. var this$1 = this;
  48974. var targetIndex = this.index + n;
  48975. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  48976. return
  48977. }
  48978. var route = this.stack[targetIndex];
  48979. this.confirmTransition(
  48980. route,
  48981. function () {
  48982. this$1.index = targetIndex;
  48983. this$1.updateRoute(route);
  48984. },
  48985. function (err) {
  48986. if (isExtendedError(NavigationDuplicated, err)) {
  48987. this$1.index = targetIndex;
  48988. }
  48989. }
  48990. );
  48991. };
  48992. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48993. var current = this.stack[this.stack.length - 1];
  48994. return current ? current.fullPath : '/'
  48995. };
  48996. AbstractHistory.prototype.ensureURL = function ensureURL () {
  48997. // noop
  48998. };
  48999. return AbstractHistory;
  49000. }(History));
  49001. /* */
  49002. var VueRouter = function VueRouter (options) {
  49003. if ( options === void 0 ) options = {};
  49004. this.app = null;
  49005. this.apps = [];
  49006. this.options = options;
  49007. this.beforeHooks = [];
  49008. this.resolveHooks = [];
  49009. this.afterHooks = [];
  49010. this.matcher = createMatcher(options.routes || [], this);
  49011. var mode = options.mode || 'hash';
  49012. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49013. if (this.fallback) {
  49014. mode = 'hash';
  49015. }
  49016. if (!inBrowser) {
  49017. mode = 'abstract';
  49018. }
  49019. this.mode = mode;
  49020. switch (mode) {
  49021. case 'history':
  49022. this.history = new HTML5History(this, options.base);
  49023. break
  49024. case 'hash':
  49025. this.history = new HashHistory(this, options.base, this.fallback);
  49026. break
  49027. case 'abstract':
  49028. this.history = new AbstractHistory(this, options.base);
  49029. break
  49030. default:
  49031. if (true) {
  49032. assert(false, ("invalid mode: " + mode));
  49033. }
  49034. }
  49035. };
  49036. var prototypeAccessors = { currentRoute: { configurable: true } };
  49037. VueRouter.prototype.match = function match (
  49038. raw,
  49039. current,
  49040. redirectedFrom
  49041. ) {
  49042. return this.matcher.match(raw, current, redirectedFrom)
  49043. };
  49044. prototypeAccessors.currentRoute.get = function () {
  49045. return this.history && this.history.current
  49046. };
  49047. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49048. var this$1 = this;
  49049. true && assert(
  49050. install.installed,
  49051. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49052. "before creating root instance."
  49053. );
  49054. this.apps.push(app);
  49055. // set up app destroyed handler
  49056. // https://github.com/vuejs/vue-router/issues/2639
  49057. app.$once('hook:destroyed', function () {
  49058. // clean out app from this.apps array once destroyed
  49059. var index = this$1.apps.indexOf(app);
  49060. if (index > -1) { this$1.apps.splice(index, 1); }
  49061. // ensure we still have a main app or null if no apps
  49062. // we do not release the router so it can be reused
  49063. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49064. });
  49065. // main app previously initialized
  49066. // return as we don't need to set up new history listener
  49067. if (this.app) {
  49068. return
  49069. }
  49070. this.app = app;
  49071. var history = this.history;
  49072. if (history instanceof HTML5History) {
  49073. history.transitionTo(history.getCurrentLocation());
  49074. } else if (history instanceof HashHistory) {
  49075. var setupHashListener = function () {
  49076. history.setupListeners();
  49077. };
  49078. history.transitionTo(
  49079. history.getCurrentLocation(),
  49080. setupHashListener,
  49081. setupHashListener
  49082. );
  49083. }
  49084. history.listen(function (route) {
  49085. this$1.apps.forEach(function (app) {
  49086. app._route = route;
  49087. });
  49088. });
  49089. };
  49090. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49091. return registerHook(this.beforeHooks, fn)
  49092. };
  49093. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49094. return registerHook(this.resolveHooks, fn)
  49095. };
  49096. VueRouter.prototype.afterEach = function afterEach (fn) {
  49097. return registerHook(this.afterHooks, fn)
  49098. };
  49099. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49100. this.history.onReady(cb, errorCb);
  49101. };
  49102. VueRouter.prototype.onError = function onError (errorCb) {
  49103. this.history.onError(errorCb);
  49104. };
  49105. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49106. var this$1 = this;
  49107. // $flow-disable-line
  49108. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49109. return new Promise(function (resolve, reject) {
  49110. this$1.history.push(location, resolve, reject);
  49111. })
  49112. } else {
  49113. this.history.push(location, onComplete, onAbort);
  49114. }
  49115. };
  49116. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49117. var this$1 = this;
  49118. // $flow-disable-line
  49119. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49120. return new Promise(function (resolve, reject) {
  49121. this$1.history.replace(location, resolve, reject);
  49122. })
  49123. } else {
  49124. this.history.replace(location, onComplete, onAbort);
  49125. }
  49126. };
  49127. VueRouter.prototype.go = function go (n) {
  49128. this.history.go(n);
  49129. };
  49130. VueRouter.prototype.back = function back () {
  49131. this.go(-1);
  49132. };
  49133. VueRouter.prototype.forward = function forward () {
  49134. this.go(1);
  49135. };
  49136. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49137. var route = to
  49138. ? to.matched
  49139. ? to
  49140. : this.resolve(to).route
  49141. : this.currentRoute;
  49142. if (!route) {
  49143. return []
  49144. }
  49145. return [].concat.apply([], route.matched.map(function (m) {
  49146. return Object.keys(m.components).map(function (key) {
  49147. return m.components[key]
  49148. })
  49149. }))
  49150. };
  49151. VueRouter.prototype.resolve = function resolve (
  49152. to,
  49153. current,
  49154. append
  49155. ) {
  49156. current = current || this.history.current;
  49157. var location = normalizeLocation(
  49158. to,
  49159. current,
  49160. append,
  49161. this
  49162. );
  49163. var route = this.match(location, current);
  49164. var fullPath = route.redirectedFrom || route.fullPath;
  49165. var base = this.history.base;
  49166. var href = createHref(base, fullPath, this.mode);
  49167. return {
  49168. location: location,
  49169. route: route,
  49170. href: href,
  49171. // for backwards compat
  49172. normalizedTo: location,
  49173. resolved: route
  49174. }
  49175. };
  49176. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49177. this.matcher.addRoutes(routes);
  49178. if (this.history.current !== START) {
  49179. this.history.transitionTo(this.history.getCurrentLocation());
  49180. }
  49181. };
  49182. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49183. function registerHook (list, fn) {
  49184. list.push(fn);
  49185. return function () {
  49186. var i = list.indexOf(fn);
  49187. if (i > -1) { list.splice(i, 1); }
  49188. }
  49189. }
  49190. function createHref (base, fullPath, mode) {
  49191. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49192. return base ? cleanPath(base + '/' + path) : path
  49193. }
  49194. VueRouter.install = install;
  49195. VueRouter.version = '3.1.6';
  49196. if (inBrowser && window.Vue) {
  49197. window.Vue.use(VueRouter);
  49198. }
  49199. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49200. /***/ }),
  49201. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49202. /*!*************************************************!*\
  49203. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49204. \*************************************************/
  49205. /*! no static exports found */
  49206. /***/ (function(module, exports, __webpack_require__) {
  49207. "use strict";
  49208. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49209. * Vue.js v2.6.11
  49210. * (c) 2014-2019 Evan You
  49211. * Released under the MIT License.
  49212. */
  49213. /* */
  49214. var emptyObject = Object.freeze({});
  49215. // These helpers produce better VM code in JS engines due to their
  49216. // explicitness and function inlining.
  49217. function isUndef (v) {
  49218. return v === undefined || v === null
  49219. }
  49220. function isDef (v) {
  49221. return v !== undefined && v !== null
  49222. }
  49223. function isTrue (v) {
  49224. return v === true
  49225. }
  49226. function isFalse (v) {
  49227. return v === false
  49228. }
  49229. /**
  49230. * Check if value is primitive.
  49231. */
  49232. function isPrimitive (value) {
  49233. return (
  49234. typeof value === 'string' ||
  49235. typeof value === 'number' ||
  49236. // $flow-disable-line
  49237. typeof value === 'symbol' ||
  49238. typeof value === 'boolean'
  49239. )
  49240. }
  49241. /**
  49242. * Quick object check - this is primarily used to tell
  49243. * Objects from primitive values when we know the value
  49244. * is a JSON-compliant type.
  49245. */
  49246. function isObject (obj) {
  49247. return obj !== null && typeof obj === 'object'
  49248. }
  49249. /**
  49250. * Get the raw type string of a value, e.g., [object Object].
  49251. */
  49252. var _toString = Object.prototype.toString;
  49253. function toRawType (value) {
  49254. return _toString.call(value).slice(8, -1)
  49255. }
  49256. /**
  49257. * Strict object type check. Only returns true
  49258. * for plain JavaScript objects.
  49259. */
  49260. function isPlainObject (obj) {
  49261. return _toString.call(obj) === '[object Object]'
  49262. }
  49263. function isRegExp (v) {
  49264. return _toString.call(v) === '[object RegExp]'
  49265. }
  49266. /**
  49267. * Check if val is a valid array index.
  49268. */
  49269. function isValidArrayIndex (val) {
  49270. var n = parseFloat(String(val));
  49271. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49272. }
  49273. function isPromise (val) {
  49274. return (
  49275. isDef(val) &&
  49276. typeof val.then === 'function' &&
  49277. typeof val.catch === 'function'
  49278. )
  49279. }
  49280. /**
  49281. * Convert a value to a string that is actually rendered.
  49282. */
  49283. function toString (val) {
  49284. return val == null
  49285. ? ''
  49286. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49287. ? JSON.stringify(val, null, 2)
  49288. : String(val)
  49289. }
  49290. /**
  49291. * Convert an input value to a number for persistence.
  49292. * If the conversion fails, return original string.
  49293. */
  49294. function toNumber (val) {
  49295. var n = parseFloat(val);
  49296. return isNaN(n) ? val : n
  49297. }
  49298. /**
  49299. * Make a map and return a function for checking if a key
  49300. * is in that map.
  49301. */
  49302. function makeMap (
  49303. str,
  49304. expectsLowerCase
  49305. ) {
  49306. var map = Object.create(null);
  49307. var list = str.split(',');
  49308. for (var i = 0; i < list.length; i++) {
  49309. map[list[i]] = true;
  49310. }
  49311. return expectsLowerCase
  49312. ? function (val) { return map[val.toLowerCase()]; }
  49313. : function (val) { return map[val]; }
  49314. }
  49315. /**
  49316. * Check if a tag is a built-in tag.
  49317. */
  49318. var isBuiltInTag = makeMap('slot,component', true);
  49319. /**
  49320. * Check if an attribute is a reserved attribute.
  49321. */
  49322. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49323. /**
  49324. * Remove an item from an array.
  49325. */
  49326. function remove (arr, item) {
  49327. if (arr.length) {
  49328. var index = arr.indexOf(item);
  49329. if (index > -1) {
  49330. return arr.splice(index, 1)
  49331. }
  49332. }
  49333. }
  49334. /**
  49335. * Check whether an object has the property.
  49336. */
  49337. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49338. function hasOwn (obj, key) {
  49339. return hasOwnProperty.call(obj, key)
  49340. }
  49341. /**
  49342. * Create a cached version of a pure function.
  49343. */
  49344. function cached (fn) {
  49345. var cache = Object.create(null);
  49346. return (function cachedFn (str) {
  49347. var hit = cache[str];
  49348. return hit || (cache[str] = fn(str))
  49349. })
  49350. }
  49351. /**
  49352. * Camelize a hyphen-delimited string.
  49353. */
  49354. var camelizeRE = /-(\w)/g;
  49355. var camelize = cached(function (str) {
  49356. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49357. });
  49358. /**
  49359. * Capitalize a string.
  49360. */
  49361. var capitalize = cached(function (str) {
  49362. return str.charAt(0).toUpperCase() + str.slice(1)
  49363. });
  49364. /**
  49365. * Hyphenate a camelCase string.
  49366. */
  49367. var hyphenateRE = /\B([A-Z])/g;
  49368. var hyphenate = cached(function (str) {
  49369. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49370. });
  49371. /**
  49372. * Simple bind polyfill for environments that do not support it,
  49373. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49374. * since native bind is now performant enough in most browsers.
  49375. * But removing it would mean breaking code that was able to run in
  49376. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49377. */
  49378. /* istanbul ignore next */
  49379. function polyfillBind (fn, ctx) {
  49380. function boundFn (a) {
  49381. var l = arguments.length;
  49382. return l
  49383. ? l > 1
  49384. ? fn.apply(ctx, arguments)
  49385. : fn.call(ctx, a)
  49386. : fn.call(ctx)
  49387. }
  49388. boundFn._length = fn.length;
  49389. return boundFn
  49390. }
  49391. function nativeBind (fn, ctx) {
  49392. return fn.bind(ctx)
  49393. }
  49394. var bind = Function.prototype.bind
  49395. ? nativeBind
  49396. : polyfillBind;
  49397. /**
  49398. * Convert an Array-like object to a real Array.
  49399. */
  49400. function toArray (list, start) {
  49401. start = start || 0;
  49402. var i = list.length - start;
  49403. var ret = new Array(i);
  49404. while (i--) {
  49405. ret[i] = list[i + start];
  49406. }
  49407. return ret
  49408. }
  49409. /**
  49410. * Mix properties into target object.
  49411. */
  49412. function extend (to, _from) {
  49413. for (var key in _from) {
  49414. to[key] = _from[key];
  49415. }
  49416. return to
  49417. }
  49418. /**
  49419. * Merge an Array of Objects into a single Object.
  49420. */
  49421. function toObject (arr) {
  49422. var res = {};
  49423. for (var i = 0; i < arr.length; i++) {
  49424. if (arr[i]) {
  49425. extend(res, arr[i]);
  49426. }
  49427. }
  49428. return res
  49429. }
  49430. /* eslint-disable no-unused-vars */
  49431. /**
  49432. * Perform no operation.
  49433. * Stubbing args to make Flow happy without leaving useless transpiled code
  49434. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49435. */
  49436. function noop (a, b, c) {}
  49437. /**
  49438. * Always return false.
  49439. */
  49440. var no = function (a, b, c) { return false; };
  49441. /* eslint-enable no-unused-vars */
  49442. /**
  49443. * Return the same value.
  49444. */
  49445. var identity = function (_) { return _; };
  49446. /**
  49447. * Generate a string containing static keys from compiler modules.
  49448. */
  49449. function genStaticKeys (modules) {
  49450. return modules.reduce(function (keys, m) {
  49451. return keys.concat(m.staticKeys || [])
  49452. }, []).join(',')
  49453. }
  49454. /**
  49455. * Check if two values are loosely equal - that is,
  49456. * if they are plain objects, do they have the same shape?
  49457. */
  49458. function looseEqual (a, b) {
  49459. if (a === b) { return true }
  49460. var isObjectA = isObject(a);
  49461. var isObjectB = isObject(b);
  49462. if (isObjectA && isObjectB) {
  49463. try {
  49464. var isArrayA = Array.isArray(a);
  49465. var isArrayB = Array.isArray(b);
  49466. if (isArrayA && isArrayB) {
  49467. return a.length === b.length && a.every(function (e, i) {
  49468. return looseEqual(e, b[i])
  49469. })
  49470. } else if (a instanceof Date && b instanceof Date) {
  49471. return a.getTime() === b.getTime()
  49472. } else if (!isArrayA && !isArrayB) {
  49473. var keysA = Object.keys(a);
  49474. var keysB = Object.keys(b);
  49475. return keysA.length === keysB.length && keysA.every(function (key) {
  49476. return looseEqual(a[key], b[key])
  49477. })
  49478. } else {
  49479. /* istanbul ignore next */
  49480. return false
  49481. }
  49482. } catch (e) {
  49483. /* istanbul ignore next */
  49484. return false
  49485. }
  49486. } else if (!isObjectA && !isObjectB) {
  49487. return String(a) === String(b)
  49488. } else {
  49489. return false
  49490. }
  49491. }
  49492. /**
  49493. * Return the first index at which a loosely equal value can be
  49494. * found in the array (if value is a plain object, the array must
  49495. * contain an object of the same shape), or -1 if it is not present.
  49496. */
  49497. function looseIndexOf (arr, val) {
  49498. for (var i = 0; i < arr.length; i++) {
  49499. if (looseEqual(arr[i], val)) { return i }
  49500. }
  49501. return -1
  49502. }
  49503. /**
  49504. * Ensure a function is called only once.
  49505. */
  49506. function once (fn) {
  49507. var called = false;
  49508. return function () {
  49509. if (!called) {
  49510. called = true;
  49511. fn.apply(this, arguments);
  49512. }
  49513. }
  49514. }
  49515. var SSR_ATTR = 'data-server-rendered';
  49516. var ASSET_TYPES = [
  49517. 'component',
  49518. 'directive',
  49519. 'filter'
  49520. ];
  49521. var LIFECYCLE_HOOKS = [
  49522. 'beforeCreate',
  49523. 'created',
  49524. 'beforeMount',
  49525. 'mounted',
  49526. 'beforeUpdate',
  49527. 'updated',
  49528. 'beforeDestroy',
  49529. 'destroyed',
  49530. 'activated',
  49531. 'deactivated',
  49532. 'errorCaptured',
  49533. 'serverPrefetch'
  49534. ];
  49535. /* */
  49536. var config = ({
  49537. /**
  49538. * Option merge strategies (used in core/util/options)
  49539. */
  49540. // $flow-disable-line
  49541. optionMergeStrategies: Object.create(null),
  49542. /**
  49543. * Whether to suppress warnings.
  49544. */
  49545. silent: false,
  49546. /**
  49547. * Show production mode tip message on boot?
  49548. */
  49549. productionTip: "development" !== 'production',
  49550. /**
  49551. * Whether to enable devtools
  49552. */
  49553. devtools: "development" !== 'production',
  49554. /**
  49555. * Whether to record perf
  49556. */
  49557. performance: false,
  49558. /**
  49559. * Error handler for watcher errors
  49560. */
  49561. errorHandler: null,
  49562. /**
  49563. * Warn handler for watcher warns
  49564. */
  49565. warnHandler: null,
  49566. /**
  49567. * Ignore certain custom elements
  49568. */
  49569. ignoredElements: [],
  49570. /**
  49571. * Custom user key aliases for v-on
  49572. */
  49573. // $flow-disable-line
  49574. keyCodes: Object.create(null),
  49575. /**
  49576. * Check if a tag is reserved so that it cannot be registered as a
  49577. * component. This is platform-dependent and may be overwritten.
  49578. */
  49579. isReservedTag: no,
  49580. /**
  49581. * Check if an attribute is reserved so that it cannot be used as a component
  49582. * prop. This is platform-dependent and may be overwritten.
  49583. */
  49584. isReservedAttr: no,
  49585. /**
  49586. * Check if a tag is an unknown element.
  49587. * Platform-dependent.
  49588. */
  49589. isUnknownElement: no,
  49590. /**
  49591. * Get the namespace of an element
  49592. */
  49593. getTagNamespace: noop,
  49594. /**
  49595. * Parse the real tag name for the specific platform.
  49596. */
  49597. parsePlatformTagName: identity,
  49598. /**
  49599. * Check if an attribute must be bound using property, e.g. value
  49600. * Platform-dependent.
  49601. */
  49602. mustUseProp: no,
  49603. /**
  49604. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49605. * This will significantly reduce performance if set to false.
  49606. */
  49607. async: true,
  49608. /**
  49609. * Exposed for legacy reasons
  49610. */
  49611. _lifecycleHooks: LIFECYCLE_HOOKS
  49612. });
  49613. /* */
  49614. /**
  49615. * unicode letters used for parsing html tags, component names and property paths.
  49616. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49617. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49618. */
  49619. 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/;
  49620. /**
  49621. * Check if a string starts with $ or _
  49622. */
  49623. function isReserved (str) {
  49624. var c = (str + '').charCodeAt(0);
  49625. return c === 0x24 || c === 0x5F
  49626. }
  49627. /**
  49628. * Define a property.
  49629. */
  49630. function def (obj, key, val, enumerable) {
  49631. Object.defineProperty(obj, key, {
  49632. value: val,
  49633. enumerable: !!enumerable,
  49634. writable: true,
  49635. configurable: true
  49636. });
  49637. }
  49638. /**
  49639. * Parse simple path.
  49640. */
  49641. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49642. function parsePath (path) {
  49643. if (bailRE.test(path)) {
  49644. return
  49645. }
  49646. var segments = path.split('.');
  49647. return function (obj) {
  49648. for (var i = 0; i < segments.length; i++) {
  49649. if (!obj) { return }
  49650. obj = obj[segments[i]];
  49651. }
  49652. return obj
  49653. }
  49654. }
  49655. /* */
  49656. // can we use __proto__?
  49657. var hasProto = '__proto__' in {};
  49658. // Browser environment sniffing
  49659. var inBrowser = typeof window !== 'undefined';
  49660. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49661. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49662. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49663. var isIE = UA && /msie|trident/.test(UA);
  49664. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49665. var isEdge = UA && UA.indexOf('edge/') > 0;
  49666. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49667. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49668. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49669. var isPhantomJS = UA && /phantomjs/.test(UA);
  49670. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49671. // Firefox has a "watch" function on Object.prototype...
  49672. var nativeWatch = ({}).watch;
  49673. var supportsPassive = false;
  49674. if (inBrowser) {
  49675. try {
  49676. var opts = {};
  49677. Object.defineProperty(opts, 'passive', ({
  49678. get: function get () {
  49679. /* istanbul ignore next */
  49680. supportsPassive = true;
  49681. }
  49682. })); // https://github.com/facebook/flow/issues/285
  49683. window.addEventListener('test-passive', null, opts);
  49684. } catch (e) {}
  49685. }
  49686. // this needs to be lazy-evaled because vue may be required before
  49687. // vue-server-renderer can set VUE_ENV
  49688. var _isServer;
  49689. var isServerRendering = function () {
  49690. if (_isServer === undefined) {
  49691. /* istanbul ignore if */
  49692. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49693. // detect presence of vue-server-renderer and avoid
  49694. // Webpack shimming the process
  49695. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49696. } else {
  49697. _isServer = false;
  49698. }
  49699. }
  49700. return _isServer
  49701. };
  49702. // detect devtools
  49703. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49704. /* istanbul ignore next */
  49705. function isNative (Ctor) {
  49706. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49707. }
  49708. var hasSymbol =
  49709. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49710. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49711. var _Set;
  49712. /* istanbul ignore if */ // $flow-disable-line
  49713. if (typeof Set !== 'undefined' && isNative(Set)) {
  49714. // use native Set when available.
  49715. _Set = Set;
  49716. } else {
  49717. // a non-standard Set polyfill that only works with primitive keys.
  49718. _Set = /*@__PURE__*/(function () {
  49719. function Set () {
  49720. this.set = Object.create(null);
  49721. }
  49722. Set.prototype.has = function has (key) {
  49723. return this.set[key] === true
  49724. };
  49725. Set.prototype.add = function add (key) {
  49726. this.set[key] = true;
  49727. };
  49728. Set.prototype.clear = function clear () {
  49729. this.set = Object.create(null);
  49730. };
  49731. return Set;
  49732. }());
  49733. }
  49734. /* */
  49735. var warn = noop;
  49736. var tip = noop;
  49737. var generateComponentTrace = (noop); // work around flow check
  49738. var formatComponentName = (noop);
  49739. {
  49740. var hasConsole = typeof console !== 'undefined';
  49741. var classifyRE = /(?:^|[-_])(\w)/g;
  49742. var classify = function (str) { return str
  49743. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49744. .replace(/[-_]/g, ''); };
  49745. warn = function (msg, vm) {
  49746. var trace = vm ? generateComponentTrace(vm) : '';
  49747. if (config.warnHandler) {
  49748. config.warnHandler.call(null, msg, vm, trace);
  49749. } else if (hasConsole && (!config.silent)) {
  49750. console.error(("[Vue warn]: " + msg + trace));
  49751. }
  49752. };
  49753. tip = function (msg, vm) {
  49754. if (hasConsole && (!config.silent)) {
  49755. console.warn("[Vue tip]: " + msg + (
  49756. vm ? generateComponentTrace(vm) : ''
  49757. ));
  49758. }
  49759. };
  49760. formatComponentName = function (vm, includeFile) {
  49761. if (vm.$root === vm) {
  49762. return '<Root>'
  49763. }
  49764. var options = typeof vm === 'function' && vm.cid != null
  49765. ? vm.options
  49766. : vm._isVue
  49767. ? vm.$options || vm.constructor.options
  49768. : vm;
  49769. var name = options.name || options._componentTag;
  49770. var file = options.__file;
  49771. if (!name && file) {
  49772. var match = file.match(/([^/\\]+)\.vue$/);
  49773. name = match && match[1];
  49774. }
  49775. return (
  49776. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49777. (file && includeFile !== false ? (" at " + file) : '')
  49778. )
  49779. };
  49780. var repeat = function (str, n) {
  49781. var res = '';
  49782. while (n) {
  49783. if (n % 2 === 1) { res += str; }
  49784. if (n > 1) { str += str; }
  49785. n >>= 1;
  49786. }
  49787. return res
  49788. };
  49789. generateComponentTrace = function (vm) {
  49790. if (vm._isVue && vm.$parent) {
  49791. var tree = [];
  49792. var currentRecursiveSequence = 0;
  49793. while (vm) {
  49794. if (tree.length > 0) {
  49795. var last = tree[tree.length - 1];
  49796. if (last.constructor === vm.constructor) {
  49797. currentRecursiveSequence++;
  49798. vm = vm.$parent;
  49799. continue
  49800. } else if (currentRecursiveSequence > 0) {
  49801. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49802. currentRecursiveSequence = 0;
  49803. }
  49804. }
  49805. tree.push(vm);
  49806. vm = vm.$parent;
  49807. }
  49808. return '\n\nfound in\n\n' + tree
  49809. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49810. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49811. : formatComponentName(vm))); })
  49812. .join('\n')
  49813. } else {
  49814. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49815. }
  49816. };
  49817. }
  49818. /* */
  49819. var uid = 0;
  49820. /**
  49821. * A dep is an observable that can have multiple
  49822. * directives subscribing to it.
  49823. */
  49824. var Dep = function Dep () {
  49825. this.id = uid++;
  49826. this.subs = [];
  49827. };
  49828. Dep.prototype.addSub = function addSub (sub) {
  49829. this.subs.push(sub);
  49830. };
  49831. Dep.prototype.removeSub = function removeSub (sub) {
  49832. remove(this.subs, sub);
  49833. };
  49834. Dep.prototype.depend = function depend () {
  49835. if (Dep.target) {
  49836. Dep.target.addDep(this);
  49837. }
  49838. };
  49839. Dep.prototype.notify = function notify () {
  49840. // stabilize the subscriber list first
  49841. var subs = this.subs.slice();
  49842. if (!config.async) {
  49843. // subs aren't sorted in scheduler if not running async
  49844. // we need to sort them now to make sure they fire in correct
  49845. // order
  49846. subs.sort(function (a, b) { return a.id - b.id; });
  49847. }
  49848. for (var i = 0, l = subs.length; i < l; i++) {
  49849. subs[i].update();
  49850. }
  49851. };
  49852. // The current target watcher being evaluated.
  49853. // This is globally unique because only one watcher
  49854. // can be evaluated at a time.
  49855. Dep.target = null;
  49856. var targetStack = [];
  49857. function pushTarget (target) {
  49858. targetStack.push(target);
  49859. Dep.target = target;
  49860. }
  49861. function popTarget () {
  49862. targetStack.pop();
  49863. Dep.target = targetStack[targetStack.length - 1];
  49864. }
  49865. /* */
  49866. var VNode = function VNode (
  49867. tag,
  49868. data,
  49869. children,
  49870. text,
  49871. elm,
  49872. context,
  49873. componentOptions,
  49874. asyncFactory
  49875. ) {
  49876. this.tag = tag;
  49877. this.data = data;
  49878. this.children = children;
  49879. this.text = text;
  49880. this.elm = elm;
  49881. this.ns = undefined;
  49882. this.context = context;
  49883. this.fnContext = undefined;
  49884. this.fnOptions = undefined;
  49885. this.fnScopeId = undefined;
  49886. this.key = data && data.key;
  49887. this.componentOptions = componentOptions;
  49888. this.componentInstance = undefined;
  49889. this.parent = undefined;
  49890. this.raw = false;
  49891. this.isStatic = false;
  49892. this.isRootInsert = true;
  49893. this.isComment = false;
  49894. this.isCloned = false;
  49895. this.isOnce = false;
  49896. this.asyncFactory = asyncFactory;
  49897. this.asyncMeta = undefined;
  49898. this.isAsyncPlaceholder = false;
  49899. };
  49900. var prototypeAccessors = { child: { configurable: true } };
  49901. // DEPRECATED: alias for componentInstance for backwards compat.
  49902. /* istanbul ignore next */
  49903. prototypeAccessors.child.get = function () {
  49904. return this.componentInstance
  49905. };
  49906. Object.defineProperties( VNode.prototype, prototypeAccessors );
  49907. var createEmptyVNode = function (text) {
  49908. if ( text === void 0 ) text = '';
  49909. var node = new VNode();
  49910. node.text = text;
  49911. node.isComment = true;
  49912. return node
  49913. };
  49914. function createTextVNode (val) {
  49915. return new VNode(undefined, undefined, undefined, String(val))
  49916. }
  49917. // optimized shallow clone
  49918. // used for static nodes and slot nodes because they may be reused across
  49919. // multiple renders, cloning them avoids errors when DOM manipulations rely
  49920. // on their elm reference.
  49921. function cloneVNode (vnode) {
  49922. var cloned = new VNode(
  49923. vnode.tag,
  49924. vnode.data,
  49925. // #7975
  49926. // clone children array to avoid mutating original in case of cloning
  49927. // a child.
  49928. vnode.children && vnode.children.slice(),
  49929. vnode.text,
  49930. vnode.elm,
  49931. vnode.context,
  49932. vnode.componentOptions,
  49933. vnode.asyncFactory
  49934. );
  49935. cloned.ns = vnode.ns;
  49936. cloned.isStatic = vnode.isStatic;
  49937. cloned.key = vnode.key;
  49938. cloned.isComment = vnode.isComment;
  49939. cloned.fnContext = vnode.fnContext;
  49940. cloned.fnOptions = vnode.fnOptions;
  49941. cloned.fnScopeId = vnode.fnScopeId;
  49942. cloned.asyncMeta = vnode.asyncMeta;
  49943. cloned.isCloned = true;
  49944. return cloned
  49945. }
  49946. /*
  49947. * not type checking this file because flow doesn't play well with
  49948. * dynamically accessing methods on Array prototype
  49949. */
  49950. var arrayProto = Array.prototype;
  49951. var arrayMethods = Object.create(arrayProto);
  49952. var methodsToPatch = [
  49953. 'push',
  49954. 'pop',
  49955. 'shift',
  49956. 'unshift',
  49957. 'splice',
  49958. 'sort',
  49959. 'reverse'
  49960. ];
  49961. /**
  49962. * Intercept mutating methods and emit events
  49963. */
  49964. methodsToPatch.forEach(function (method) {
  49965. // cache original method
  49966. var original = arrayProto[method];
  49967. def(arrayMethods, method, function mutator () {
  49968. var args = [], len = arguments.length;
  49969. while ( len-- ) args[ len ] = arguments[ len ];
  49970. var result = original.apply(this, args);
  49971. var ob = this.__ob__;
  49972. var inserted;
  49973. switch (method) {
  49974. case 'push':
  49975. case 'unshift':
  49976. inserted = args;
  49977. break
  49978. case 'splice':
  49979. inserted = args.slice(2);
  49980. break
  49981. }
  49982. if (inserted) { ob.observeArray(inserted); }
  49983. // notify change
  49984. ob.dep.notify();
  49985. return result
  49986. });
  49987. });
  49988. /* */
  49989. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  49990. /**
  49991. * In some cases we may want to disable observation inside a component's
  49992. * update computation.
  49993. */
  49994. var shouldObserve = true;
  49995. function toggleObserving (value) {
  49996. shouldObserve = value;
  49997. }
  49998. /**
  49999. * Observer class that is attached to each observed
  50000. * object. Once attached, the observer converts the target
  50001. * object's property keys into getter/setters that
  50002. * collect dependencies and dispatch updates.
  50003. */
  50004. var Observer = function Observer (value) {
  50005. this.value = value;
  50006. this.dep = new Dep();
  50007. this.vmCount = 0;
  50008. def(value, '__ob__', this);
  50009. if (Array.isArray(value)) {
  50010. if (hasProto) {
  50011. protoAugment(value, arrayMethods);
  50012. } else {
  50013. copyAugment(value, arrayMethods, arrayKeys);
  50014. }
  50015. this.observeArray(value);
  50016. } else {
  50017. this.walk(value);
  50018. }
  50019. };
  50020. /**
  50021. * Walk through all properties and convert them into
  50022. * getter/setters. This method should only be called when
  50023. * value type is Object.
  50024. */
  50025. Observer.prototype.walk = function walk (obj) {
  50026. var keys = Object.keys(obj);
  50027. for (var i = 0; i < keys.length; i++) {
  50028. defineReactive$$1(obj, keys[i]);
  50029. }
  50030. };
  50031. /**
  50032. * Observe a list of Array items.
  50033. */
  50034. Observer.prototype.observeArray = function observeArray (items) {
  50035. for (var i = 0, l = items.length; i < l; i++) {
  50036. observe(items[i]);
  50037. }
  50038. };
  50039. // helpers
  50040. /**
  50041. * Augment a target Object or Array by intercepting
  50042. * the prototype chain using __proto__
  50043. */
  50044. function protoAugment (target, src) {
  50045. /* eslint-disable no-proto */
  50046. target.__proto__ = src;
  50047. /* eslint-enable no-proto */
  50048. }
  50049. /**
  50050. * Augment a target Object or Array by defining
  50051. * hidden properties.
  50052. */
  50053. /* istanbul ignore next */
  50054. function copyAugment (target, src, keys) {
  50055. for (var i = 0, l = keys.length; i < l; i++) {
  50056. var key = keys[i];
  50057. def(target, key, src[key]);
  50058. }
  50059. }
  50060. /**
  50061. * Attempt to create an observer instance for a value,
  50062. * returns the new observer if successfully observed,
  50063. * or the existing observer if the value already has one.
  50064. */
  50065. function observe (value, asRootData) {
  50066. if (!isObject(value) || value instanceof VNode) {
  50067. return
  50068. }
  50069. var ob;
  50070. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50071. ob = value.__ob__;
  50072. } else if (
  50073. shouldObserve &&
  50074. !isServerRendering() &&
  50075. (Array.isArray(value) || isPlainObject(value)) &&
  50076. Object.isExtensible(value) &&
  50077. !value._isVue
  50078. ) {
  50079. ob = new Observer(value);
  50080. }
  50081. if (asRootData && ob) {
  50082. ob.vmCount++;
  50083. }
  50084. return ob
  50085. }
  50086. /**
  50087. * Define a reactive property on an Object.
  50088. */
  50089. function defineReactive$$1 (
  50090. obj,
  50091. key,
  50092. val,
  50093. customSetter,
  50094. shallow
  50095. ) {
  50096. var dep = new Dep();
  50097. var property = Object.getOwnPropertyDescriptor(obj, key);
  50098. if (property && property.configurable === false) {
  50099. return
  50100. }
  50101. // cater for pre-defined getter/setters
  50102. var getter = property && property.get;
  50103. var setter = property && property.set;
  50104. if ((!getter || setter) && arguments.length === 2) {
  50105. val = obj[key];
  50106. }
  50107. var childOb = !shallow && observe(val);
  50108. Object.defineProperty(obj, key, {
  50109. enumerable: true,
  50110. configurable: true,
  50111. get: function reactiveGetter () {
  50112. var value = getter ? getter.call(obj) : val;
  50113. if (Dep.target) {
  50114. dep.depend();
  50115. if (childOb) {
  50116. childOb.dep.depend();
  50117. if (Array.isArray(value)) {
  50118. dependArray(value);
  50119. }
  50120. }
  50121. }
  50122. return value
  50123. },
  50124. set: function reactiveSetter (newVal) {
  50125. var value = getter ? getter.call(obj) : val;
  50126. /* eslint-disable no-self-compare */
  50127. if (newVal === value || (newVal !== newVal && value !== value)) {
  50128. return
  50129. }
  50130. /* eslint-enable no-self-compare */
  50131. if (customSetter) {
  50132. customSetter();
  50133. }
  50134. // #7981: for accessor properties without setter
  50135. if (getter && !setter) { return }
  50136. if (setter) {
  50137. setter.call(obj, newVal);
  50138. } else {
  50139. val = newVal;
  50140. }
  50141. childOb = !shallow && observe(newVal);
  50142. dep.notify();
  50143. }
  50144. });
  50145. }
  50146. /**
  50147. * Set a property on an object. Adds the new property and
  50148. * triggers change notification if the property doesn't
  50149. * already exist.
  50150. */
  50151. function set (target, key, val) {
  50152. if (isUndef(target) || isPrimitive(target)
  50153. ) {
  50154. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50155. }
  50156. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50157. target.length = Math.max(target.length, key);
  50158. target.splice(key, 1, val);
  50159. return val
  50160. }
  50161. if (key in target && !(key in Object.prototype)) {
  50162. target[key] = val;
  50163. return val
  50164. }
  50165. var ob = (target).__ob__;
  50166. if (target._isVue || (ob && ob.vmCount)) {
  50167. warn(
  50168. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50169. 'at runtime - declare it upfront in the data option.'
  50170. );
  50171. return val
  50172. }
  50173. if (!ob) {
  50174. target[key] = val;
  50175. return val
  50176. }
  50177. defineReactive$$1(ob.value, key, val);
  50178. ob.dep.notify();
  50179. return val
  50180. }
  50181. /**
  50182. * Delete a property and trigger change if necessary.
  50183. */
  50184. function del (target, key) {
  50185. if (isUndef(target) || isPrimitive(target)
  50186. ) {
  50187. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50188. }
  50189. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50190. target.splice(key, 1);
  50191. return
  50192. }
  50193. var ob = (target).__ob__;
  50194. if (target._isVue || (ob && ob.vmCount)) {
  50195. warn(
  50196. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50197. '- just set it to null.'
  50198. );
  50199. return
  50200. }
  50201. if (!hasOwn(target, key)) {
  50202. return
  50203. }
  50204. delete target[key];
  50205. if (!ob) {
  50206. return
  50207. }
  50208. ob.dep.notify();
  50209. }
  50210. /**
  50211. * Collect dependencies on array elements when the array is touched, since
  50212. * we cannot intercept array element access like property getters.
  50213. */
  50214. function dependArray (value) {
  50215. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50216. e = value[i];
  50217. e && e.__ob__ && e.__ob__.dep.depend();
  50218. if (Array.isArray(e)) {
  50219. dependArray(e);
  50220. }
  50221. }
  50222. }
  50223. /* */
  50224. /**
  50225. * Option overwriting strategies are functions that handle
  50226. * how to merge a parent option value and a child option
  50227. * value into the final value.
  50228. */
  50229. var strats = config.optionMergeStrategies;
  50230. /**
  50231. * Options with restrictions
  50232. */
  50233. {
  50234. strats.el = strats.propsData = function (parent, child, vm, key) {
  50235. if (!vm) {
  50236. warn(
  50237. "option \"" + key + "\" can only be used during instance " +
  50238. 'creation with the `new` keyword.'
  50239. );
  50240. }
  50241. return defaultStrat(parent, child)
  50242. };
  50243. }
  50244. /**
  50245. * Helper that recursively merges two data objects together.
  50246. */
  50247. function mergeData (to, from) {
  50248. if (!from) { return to }
  50249. var key, toVal, fromVal;
  50250. var keys = hasSymbol
  50251. ? Reflect.ownKeys(from)
  50252. : Object.keys(from);
  50253. for (var i = 0; i < keys.length; i++) {
  50254. key = keys[i];
  50255. // in case the object is already observed...
  50256. if (key === '__ob__') { continue }
  50257. toVal = to[key];
  50258. fromVal = from[key];
  50259. if (!hasOwn(to, key)) {
  50260. set(to, key, fromVal);
  50261. } else if (
  50262. toVal !== fromVal &&
  50263. isPlainObject(toVal) &&
  50264. isPlainObject(fromVal)
  50265. ) {
  50266. mergeData(toVal, fromVal);
  50267. }
  50268. }
  50269. return to
  50270. }
  50271. /**
  50272. * Data
  50273. */
  50274. function mergeDataOrFn (
  50275. parentVal,
  50276. childVal,
  50277. vm
  50278. ) {
  50279. if (!vm) {
  50280. // in a Vue.extend merge, both should be functions
  50281. if (!childVal) {
  50282. return parentVal
  50283. }
  50284. if (!parentVal) {
  50285. return childVal
  50286. }
  50287. // when parentVal & childVal are both present,
  50288. // we need to return a function that returns the
  50289. // merged result of both functions... no need to
  50290. // check if parentVal is a function here because
  50291. // it has to be a function to pass previous merges.
  50292. return function mergedDataFn () {
  50293. return mergeData(
  50294. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50295. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50296. )
  50297. }
  50298. } else {
  50299. return function mergedInstanceDataFn () {
  50300. // instance merge
  50301. var instanceData = typeof childVal === 'function'
  50302. ? childVal.call(vm, vm)
  50303. : childVal;
  50304. var defaultData = typeof parentVal === 'function'
  50305. ? parentVal.call(vm, vm)
  50306. : parentVal;
  50307. if (instanceData) {
  50308. return mergeData(instanceData, defaultData)
  50309. } else {
  50310. return defaultData
  50311. }
  50312. }
  50313. }
  50314. }
  50315. strats.data = function (
  50316. parentVal,
  50317. childVal,
  50318. vm
  50319. ) {
  50320. if (!vm) {
  50321. if (childVal && typeof childVal !== 'function') {
  50322. warn(
  50323. 'The "data" option should be a function ' +
  50324. 'that returns a per-instance value in component ' +
  50325. 'definitions.',
  50326. vm
  50327. );
  50328. return parentVal
  50329. }
  50330. return mergeDataOrFn(parentVal, childVal)
  50331. }
  50332. return mergeDataOrFn(parentVal, childVal, vm)
  50333. };
  50334. /**
  50335. * Hooks and props are merged as arrays.
  50336. */
  50337. function mergeHook (
  50338. parentVal,
  50339. childVal
  50340. ) {
  50341. var res = childVal
  50342. ? parentVal
  50343. ? parentVal.concat(childVal)
  50344. : Array.isArray(childVal)
  50345. ? childVal
  50346. : [childVal]
  50347. : parentVal;
  50348. return res
  50349. ? dedupeHooks(res)
  50350. : res
  50351. }
  50352. function dedupeHooks (hooks) {
  50353. var res = [];
  50354. for (var i = 0; i < hooks.length; i++) {
  50355. if (res.indexOf(hooks[i]) === -1) {
  50356. res.push(hooks[i]);
  50357. }
  50358. }
  50359. return res
  50360. }
  50361. LIFECYCLE_HOOKS.forEach(function (hook) {
  50362. strats[hook] = mergeHook;
  50363. });
  50364. /**
  50365. * Assets
  50366. *
  50367. * When a vm is present (instance creation), we need to do
  50368. * a three-way merge between constructor options, instance
  50369. * options and parent options.
  50370. */
  50371. function mergeAssets (
  50372. parentVal,
  50373. childVal,
  50374. vm,
  50375. key
  50376. ) {
  50377. var res = Object.create(parentVal || null);
  50378. if (childVal) {
  50379. assertObjectType(key, childVal, vm);
  50380. return extend(res, childVal)
  50381. } else {
  50382. return res
  50383. }
  50384. }
  50385. ASSET_TYPES.forEach(function (type) {
  50386. strats[type + 's'] = mergeAssets;
  50387. });
  50388. /**
  50389. * Watchers.
  50390. *
  50391. * Watchers hashes should not overwrite one
  50392. * another, so we merge them as arrays.
  50393. */
  50394. strats.watch = function (
  50395. parentVal,
  50396. childVal,
  50397. vm,
  50398. key
  50399. ) {
  50400. // work around Firefox's Object.prototype.watch...
  50401. if (parentVal === nativeWatch) { parentVal = undefined; }
  50402. if (childVal === nativeWatch) { childVal = undefined; }
  50403. /* istanbul ignore if */
  50404. if (!childVal) { return Object.create(parentVal || null) }
  50405. {
  50406. assertObjectType(key, childVal, vm);
  50407. }
  50408. if (!parentVal) { return childVal }
  50409. var ret = {};
  50410. extend(ret, parentVal);
  50411. for (var key$1 in childVal) {
  50412. var parent = ret[key$1];
  50413. var child = childVal[key$1];
  50414. if (parent && !Array.isArray(parent)) {
  50415. parent = [parent];
  50416. }
  50417. ret[key$1] = parent
  50418. ? parent.concat(child)
  50419. : Array.isArray(child) ? child : [child];
  50420. }
  50421. return ret
  50422. };
  50423. /**
  50424. * Other object hashes.
  50425. */
  50426. strats.props =
  50427. strats.methods =
  50428. strats.inject =
  50429. strats.computed = function (
  50430. parentVal,
  50431. childVal,
  50432. vm,
  50433. key
  50434. ) {
  50435. if (childVal && "development" !== 'production') {
  50436. assertObjectType(key, childVal, vm);
  50437. }
  50438. if (!parentVal) { return childVal }
  50439. var ret = Object.create(null);
  50440. extend(ret, parentVal);
  50441. if (childVal) { extend(ret, childVal); }
  50442. return ret
  50443. };
  50444. strats.provide = mergeDataOrFn;
  50445. /**
  50446. * Default strategy.
  50447. */
  50448. var defaultStrat = function (parentVal, childVal) {
  50449. return childVal === undefined
  50450. ? parentVal
  50451. : childVal
  50452. };
  50453. /**
  50454. * Validate component names
  50455. */
  50456. function checkComponents (options) {
  50457. for (var key in options.components) {
  50458. validateComponentName(key);
  50459. }
  50460. }
  50461. function validateComponentName (name) {
  50462. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50463. warn(
  50464. 'Invalid component name: "' + name + '". Component names ' +
  50465. 'should conform to valid custom element name in html5 specification.'
  50466. );
  50467. }
  50468. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50469. warn(
  50470. 'Do not use built-in or reserved HTML elements as component ' +
  50471. 'id: ' + name
  50472. );
  50473. }
  50474. }
  50475. /**
  50476. * Ensure all props option syntax are normalized into the
  50477. * Object-based format.
  50478. */
  50479. function normalizeProps (options, vm) {
  50480. var props = options.props;
  50481. if (!props) { return }
  50482. var res = {};
  50483. var i, val, name;
  50484. if (Array.isArray(props)) {
  50485. i = props.length;
  50486. while (i--) {
  50487. val = props[i];
  50488. if (typeof val === 'string') {
  50489. name = camelize(val);
  50490. res[name] = { type: null };
  50491. } else {
  50492. warn('props must be strings when using array syntax.');
  50493. }
  50494. }
  50495. } else if (isPlainObject(props)) {
  50496. for (var key in props) {
  50497. val = props[key];
  50498. name = camelize(key);
  50499. res[name] = isPlainObject(val)
  50500. ? val
  50501. : { type: val };
  50502. }
  50503. } else {
  50504. warn(
  50505. "Invalid value for option \"props\": expected an Array or an Object, " +
  50506. "but got " + (toRawType(props)) + ".",
  50507. vm
  50508. );
  50509. }
  50510. options.props = res;
  50511. }
  50512. /**
  50513. * Normalize all injections into Object-based format
  50514. */
  50515. function normalizeInject (options, vm) {
  50516. var inject = options.inject;
  50517. if (!inject) { return }
  50518. var normalized = options.inject = {};
  50519. if (Array.isArray(inject)) {
  50520. for (var i = 0; i < inject.length; i++) {
  50521. normalized[inject[i]] = { from: inject[i] };
  50522. }
  50523. } else if (isPlainObject(inject)) {
  50524. for (var key in inject) {
  50525. var val = inject[key];
  50526. normalized[key] = isPlainObject(val)
  50527. ? extend({ from: key }, val)
  50528. : { from: val };
  50529. }
  50530. } else {
  50531. warn(
  50532. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50533. "but got " + (toRawType(inject)) + ".",
  50534. vm
  50535. );
  50536. }
  50537. }
  50538. /**
  50539. * Normalize raw function directives into object format.
  50540. */
  50541. function normalizeDirectives (options) {
  50542. var dirs = options.directives;
  50543. if (dirs) {
  50544. for (var key in dirs) {
  50545. var def$$1 = dirs[key];
  50546. if (typeof def$$1 === 'function') {
  50547. dirs[key] = { bind: def$$1, update: def$$1 };
  50548. }
  50549. }
  50550. }
  50551. }
  50552. function assertObjectType (name, value, vm) {
  50553. if (!isPlainObject(value)) {
  50554. warn(
  50555. "Invalid value for option \"" + name + "\": expected an Object, " +
  50556. "but got " + (toRawType(value)) + ".",
  50557. vm
  50558. );
  50559. }
  50560. }
  50561. /**
  50562. * Merge two option objects into a new one.
  50563. * Core utility used in both instantiation and inheritance.
  50564. */
  50565. function mergeOptions (
  50566. parent,
  50567. child,
  50568. vm
  50569. ) {
  50570. {
  50571. checkComponents(child);
  50572. }
  50573. if (typeof child === 'function') {
  50574. child = child.options;
  50575. }
  50576. normalizeProps(child, vm);
  50577. normalizeInject(child, vm);
  50578. normalizeDirectives(child);
  50579. // Apply extends and mixins on the child options,
  50580. // but only if it is a raw options object that isn't
  50581. // the result of another mergeOptions call.
  50582. // Only merged options has the _base property.
  50583. if (!child._base) {
  50584. if (child.extends) {
  50585. parent = mergeOptions(parent, child.extends, vm);
  50586. }
  50587. if (child.mixins) {
  50588. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50589. parent = mergeOptions(parent, child.mixins[i], vm);
  50590. }
  50591. }
  50592. }
  50593. var options = {};
  50594. var key;
  50595. for (key in parent) {
  50596. mergeField(key);
  50597. }
  50598. for (key in child) {
  50599. if (!hasOwn(parent, key)) {
  50600. mergeField(key);
  50601. }
  50602. }
  50603. function mergeField (key) {
  50604. var strat = strats[key] || defaultStrat;
  50605. options[key] = strat(parent[key], child[key], vm, key);
  50606. }
  50607. return options
  50608. }
  50609. /**
  50610. * Resolve an asset.
  50611. * This function is used because child instances need access
  50612. * to assets defined in its ancestor chain.
  50613. */
  50614. function resolveAsset (
  50615. options,
  50616. type,
  50617. id,
  50618. warnMissing
  50619. ) {
  50620. /* istanbul ignore if */
  50621. if (typeof id !== 'string') {
  50622. return
  50623. }
  50624. var assets = options[type];
  50625. // check local registration variations first
  50626. if (hasOwn(assets, id)) { return assets[id] }
  50627. var camelizedId = camelize(id);
  50628. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50629. var PascalCaseId = capitalize(camelizedId);
  50630. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50631. // fallback to prototype chain
  50632. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50633. if (warnMissing && !res) {
  50634. warn(
  50635. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50636. options
  50637. );
  50638. }
  50639. return res
  50640. }
  50641. /* */
  50642. function validateProp (
  50643. key,
  50644. propOptions,
  50645. propsData,
  50646. vm
  50647. ) {
  50648. var prop = propOptions[key];
  50649. var absent = !hasOwn(propsData, key);
  50650. var value = propsData[key];
  50651. // boolean casting
  50652. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50653. if (booleanIndex > -1) {
  50654. if (absent && !hasOwn(prop, 'default')) {
  50655. value = false;
  50656. } else if (value === '' || value === hyphenate(key)) {
  50657. // only cast empty string / same name to boolean if
  50658. // boolean has higher priority
  50659. var stringIndex = getTypeIndex(String, prop.type);
  50660. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50661. value = true;
  50662. }
  50663. }
  50664. }
  50665. // check default value
  50666. if (value === undefined) {
  50667. value = getPropDefaultValue(vm, prop, key);
  50668. // since the default value is a fresh copy,
  50669. // make sure to observe it.
  50670. var prevShouldObserve = shouldObserve;
  50671. toggleObserving(true);
  50672. observe(value);
  50673. toggleObserving(prevShouldObserve);
  50674. }
  50675. {
  50676. assertProp(prop, key, value, vm, absent);
  50677. }
  50678. return value
  50679. }
  50680. /**
  50681. * Get the default value of a prop.
  50682. */
  50683. function getPropDefaultValue (vm, prop, key) {
  50684. // no default, return undefined
  50685. if (!hasOwn(prop, 'default')) {
  50686. return undefined
  50687. }
  50688. var def = prop.default;
  50689. // warn against non-factory defaults for Object & Array
  50690. if (isObject(def)) {
  50691. warn(
  50692. 'Invalid default value for prop "' + key + '": ' +
  50693. 'Props with type Object/Array must use a factory function ' +
  50694. 'to return the default value.',
  50695. vm
  50696. );
  50697. }
  50698. // the raw prop value was also undefined from previous render,
  50699. // return previous default value to avoid unnecessary watcher trigger
  50700. if (vm && vm.$options.propsData &&
  50701. vm.$options.propsData[key] === undefined &&
  50702. vm._props[key] !== undefined
  50703. ) {
  50704. return vm._props[key]
  50705. }
  50706. // call factory function for non-Function types
  50707. // a value is Function if its prototype is function even across different execution context
  50708. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50709. ? def.call(vm)
  50710. : def
  50711. }
  50712. /**
  50713. * Assert whether a prop is valid.
  50714. */
  50715. function assertProp (
  50716. prop,
  50717. name,
  50718. value,
  50719. vm,
  50720. absent
  50721. ) {
  50722. if (prop.required && absent) {
  50723. warn(
  50724. 'Missing required prop: "' + name + '"',
  50725. vm
  50726. );
  50727. return
  50728. }
  50729. if (value == null && !prop.required) {
  50730. return
  50731. }
  50732. var type = prop.type;
  50733. var valid = !type || type === true;
  50734. var expectedTypes = [];
  50735. if (type) {
  50736. if (!Array.isArray(type)) {
  50737. type = [type];
  50738. }
  50739. for (var i = 0; i < type.length && !valid; i++) {
  50740. var assertedType = assertType(value, type[i]);
  50741. expectedTypes.push(assertedType.expectedType || '');
  50742. valid = assertedType.valid;
  50743. }
  50744. }
  50745. if (!valid) {
  50746. warn(
  50747. getInvalidTypeMessage(name, value, expectedTypes),
  50748. vm
  50749. );
  50750. return
  50751. }
  50752. var validator = prop.validator;
  50753. if (validator) {
  50754. if (!validator(value)) {
  50755. warn(
  50756. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50757. vm
  50758. );
  50759. }
  50760. }
  50761. }
  50762. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50763. function assertType (value, type) {
  50764. var valid;
  50765. var expectedType = getType(type);
  50766. if (simpleCheckRE.test(expectedType)) {
  50767. var t = typeof value;
  50768. valid = t === expectedType.toLowerCase();
  50769. // for primitive wrapper objects
  50770. if (!valid && t === 'object') {
  50771. valid = value instanceof type;
  50772. }
  50773. } else if (expectedType === 'Object') {
  50774. valid = isPlainObject(value);
  50775. } else if (expectedType === 'Array') {
  50776. valid = Array.isArray(value);
  50777. } else {
  50778. valid = value instanceof type;
  50779. }
  50780. return {
  50781. valid: valid,
  50782. expectedType: expectedType
  50783. }
  50784. }
  50785. /**
  50786. * Use function string name to check built-in types,
  50787. * because a simple equality check will fail when running
  50788. * across different vms / iframes.
  50789. */
  50790. function getType (fn) {
  50791. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50792. return match ? match[1] : ''
  50793. }
  50794. function isSameType (a, b) {
  50795. return getType(a) === getType(b)
  50796. }
  50797. function getTypeIndex (type, expectedTypes) {
  50798. if (!Array.isArray(expectedTypes)) {
  50799. return isSameType(expectedTypes, type) ? 0 : -1
  50800. }
  50801. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50802. if (isSameType(expectedTypes[i], type)) {
  50803. return i
  50804. }
  50805. }
  50806. return -1
  50807. }
  50808. function getInvalidTypeMessage (name, value, expectedTypes) {
  50809. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50810. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50811. var expectedType = expectedTypes[0];
  50812. var receivedType = toRawType(value);
  50813. var expectedValue = styleValue(value, expectedType);
  50814. var receivedValue = styleValue(value, receivedType);
  50815. // check if we need to specify expected value
  50816. if (expectedTypes.length === 1 &&
  50817. isExplicable(expectedType) &&
  50818. !isBoolean(expectedType, receivedType)) {
  50819. message += " with value " + expectedValue;
  50820. }
  50821. message += ", got " + receivedType + " ";
  50822. // check if we need to specify received value
  50823. if (isExplicable(receivedType)) {
  50824. message += "with value " + receivedValue + ".";
  50825. }
  50826. return message
  50827. }
  50828. function styleValue (value, type) {
  50829. if (type === 'String') {
  50830. return ("\"" + value + "\"")
  50831. } else if (type === 'Number') {
  50832. return ("" + (Number(value)))
  50833. } else {
  50834. return ("" + value)
  50835. }
  50836. }
  50837. function isExplicable (value) {
  50838. var explicitTypes = ['string', 'number', 'boolean'];
  50839. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50840. }
  50841. function isBoolean () {
  50842. var args = [], len = arguments.length;
  50843. while ( len-- ) args[ len ] = arguments[ len ];
  50844. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50845. }
  50846. /* */
  50847. function handleError (err, vm, info) {
  50848. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50849. // See: https://github.com/vuejs/vuex/issues/1505
  50850. pushTarget();
  50851. try {
  50852. if (vm) {
  50853. var cur = vm;
  50854. while ((cur = cur.$parent)) {
  50855. var hooks = cur.$options.errorCaptured;
  50856. if (hooks) {
  50857. for (var i = 0; i < hooks.length; i++) {
  50858. try {
  50859. var capture = hooks[i].call(cur, err, vm, info) === false;
  50860. if (capture) { return }
  50861. } catch (e) {
  50862. globalHandleError(e, cur, 'errorCaptured hook');
  50863. }
  50864. }
  50865. }
  50866. }
  50867. }
  50868. globalHandleError(err, vm, info);
  50869. } finally {
  50870. popTarget();
  50871. }
  50872. }
  50873. function invokeWithErrorHandling (
  50874. handler,
  50875. context,
  50876. args,
  50877. vm,
  50878. info
  50879. ) {
  50880. var res;
  50881. try {
  50882. res = args ? handler.apply(context, args) : handler.call(context);
  50883. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50884. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50885. // issue #9511
  50886. // avoid catch triggering multiple times when nested calls
  50887. res._handled = true;
  50888. }
  50889. } catch (e) {
  50890. handleError(e, vm, info);
  50891. }
  50892. return res
  50893. }
  50894. function globalHandleError (err, vm, info) {
  50895. if (config.errorHandler) {
  50896. try {
  50897. return config.errorHandler.call(null, err, vm, info)
  50898. } catch (e) {
  50899. // if the user intentionally throws the original error in the handler,
  50900. // do not log it twice
  50901. if (e !== err) {
  50902. logError(e, null, 'config.errorHandler');
  50903. }
  50904. }
  50905. }
  50906. logError(err, vm, info);
  50907. }
  50908. function logError (err, vm, info) {
  50909. {
  50910. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  50911. }
  50912. /* istanbul ignore else */
  50913. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  50914. console.error(err);
  50915. } else {
  50916. throw err
  50917. }
  50918. }
  50919. /* */
  50920. var isUsingMicroTask = false;
  50921. var callbacks = [];
  50922. var pending = false;
  50923. function flushCallbacks () {
  50924. pending = false;
  50925. var copies = callbacks.slice(0);
  50926. callbacks.length = 0;
  50927. for (var i = 0; i < copies.length; i++) {
  50928. copies[i]();
  50929. }
  50930. }
  50931. // Here we have async deferring wrappers using microtasks.
  50932. // In 2.5 we used (macro) tasks (in combination with microtasks).
  50933. // However, it has subtle problems when state is changed right before repaint
  50934. // (e.g. #6813, out-in transitions).
  50935. // Also, using (macro) tasks in event handler would cause some weird behaviors
  50936. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  50937. // So we now use microtasks everywhere, again.
  50938. // A major drawback of this tradeoff is that there are some scenarios
  50939. // where microtasks have too high a priority and fire in between supposedly
  50940. // sequential events (e.g. #4521, #6690, which have workarounds)
  50941. // or even between bubbling of the same event (#6566).
  50942. var timerFunc;
  50943. // The nextTick behavior leverages the microtask queue, which can be accessed
  50944. // via either native Promise.then or MutationObserver.
  50945. // MutationObserver has wider support, however it is seriously bugged in
  50946. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  50947. // completely stops working after triggering a few times... so, if native
  50948. // Promise is available, we will use it:
  50949. /* istanbul ignore next, $flow-disable-line */
  50950. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  50951. var p = Promise.resolve();
  50952. timerFunc = function () {
  50953. p.then(flushCallbacks);
  50954. // In problematic UIWebViews, Promise.then doesn't completely break, but
  50955. // it can get stuck in a weird state where callbacks are pushed into the
  50956. // microtask queue but the queue isn't being flushed, until the browser
  50957. // needs to do some other work, e.g. handle a timer. Therefore we can
  50958. // "force" the microtask queue to be flushed by adding an empty timer.
  50959. if (isIOS) { setTimeout(noop); }
  50960. };
  50961. isUsingMicroTask = true;
  50962. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  50963. isNative(MutationObserver) ||
  50964. // PhantomJS and iOS 7.x
  50965. MutationObserver.toString() === '[object MutationObserverConstructor]'
  50966. )) {
  50967. // Use MutationObserver where native Promise is not available,
  50968. // e.g. PhantomJS, iOS7, Android 4.4
  50969. // (#6466 MutationObserver is unreliable in IE11)
  50970. var counter = 1;
  50971. var observer = new MutationObserver(flushCallbacks);
  50972. var textNode = document.createTextNode(String(counter));
  50973. observer.observe(textNode, {
  50974. characterData: true
  50975. });
  50976. timerFunc = function () {
  50977. counter = (counter + 1) % 2;
  50978. textNode.data = String(counter);
  50979. };
  50980. isUsingMicroTask = true;
  50981. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  50982. // Fallback to setImmediate.
  50983. // Technically it leverages the (macro) task queue,
  50984. // but it is still a better choice than setTimeout.
  50985. timerFunc = function () {
  50986. setImmediate(flushCallbacks);
  50987. };
  50988. } else {
  50989. // Fallback to setTimeout.
  50990. timerFunc = function () {
  50991. setTimeout(flushCallbacks, 0);
  50992. };
  50993. }
  50994. function nextTick (cb, ctx) {
  50995. var _resolve;
  50996. callbacks.push(function () {
  50997. if (cb) {
  50998. try {
  50999. cb.call(ctx);
  51000. } catch (e) {
  51001. handleError(e, ctx, 'nextTick');
  51002. }
  51003. } else if (_resolve) {
  51004. _resolve(ctx);
  51005. }
  51006. });
  51007. if (!pending) {
  51008. pending = true;
  51009. timerFunc();
  51010. }
  51011. // $flow-disable-line
  51012. if (!cb && typeof Promise !== 'undefined') {
  51013. return new Promise(function (resolve) {
  51014. _resolve = resolve;
  51015. })
  51016. }
  51017. }
  51018. /* */
  51019. var mark;
  51020. var measure;
  51021. {
  51022. var perf = inBrowser && window.performance;
  51023. /* istanbul ignore if */
  51024. if (
  51025. perf &&
  51026. perf.mark &&
  51027. perf.measure &&
  51028. perf.clearMarks &&
  51029. perf.clearMeasures
  51030. ) {
  51031. mark = function (tag) { return perf.mark(tag); };
  51032. measure = function (name, startTag, endTag) {
  51033. perf.measure(name, startTag, endTag);
  51034. perf.clearMarks(startTag);
  51035. perf.clearMarks(endTag);
  51036. // perf.clearMeasures(name)
  51037. };
  51038. }
  51039. }
  51040. /* not type checking this file because flow doesn't play well with Proxy */
  51041. var initProxy;
  51042. {
  51043. var allowedGlobals = makeMap(
  51044. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51045. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51046. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51047. 'require' // for Webpack/Browserify
  51048. );
  51049. var warnNonPresent = function (target, key) {
  51050. warn(
  51051. "Property or method \"" + key + "\" is not defined on the instance but " +
  51052. 'referenced during render. Make sure that this property is reactive, ' +
  51053. 'either in the data option, or for class-based components, by ' +
  51054. 'initializing the property. ' +
  51055. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51056. target
  51057. );
  51058. };
  51059. var warnReservedPrefix = function (target, key) {
  51060. warn(
  51061. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51062. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51063. 'prevent conflicts with Vue internals. ' +
  51064. 'See: https://vuejs.org/v2/api/#data',
  51065. target
  51066. );
  51067. };
  51068. var hasProxy =
  51069. typeof Proxy !== 'undefined' && isNative(Proxy);
  51070. if (hasProxy) {
  51071. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51072. config.keyCodes = new Proxy(config.keyCodes, {
  51073. set: function set (target, key, value) {
  51074. if (isBuiltInModifier(key)) {
  51075. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51076. return false
  51077. } else {
  51078. target[key] = value;
  51079. return true
  51080. }
  51081. }
  51082. });
  51083. }
  51084. var hasHandler = {
  51085. has: function has (target, key) {
  51086. var has = key in target;
  51087. var isAllowed = allowedGlobals(key) ||
  51088. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51089. if (!has && !isAllowed) {
  51090. if (key in target.$data) { warnReservedPrefix(target, key); }
  51091. else { warnNonPresent(target, key); }
  51092. }
  51093. return has || !isAllowed
  51094. }
  51095. };
  51096. var getHandler = {
  51097. get: function get (target, key) {
  51098. if (typeof key === 'string' && !(key in target)) {
  51099. if (key in target.$data) { warnReservedPrefix(target, key); }
  51100. else { warnNonPresent(target, key); }
  51101. }
  51102. return target[key]
  51103. }
  51104. };
  51105. initProxy = function initProxy (vm) {
  51106. if (hasProxy) {
  51107. // determine which proxy handler to use
  51108. var options = vm.$options;
  51109. var handlers = options.render && options.render._withStripped
  51110. ? getHandler
  51111. : hasHandler;
  51112. vm._renderProxy = new Proxy(vm, handlers);
  51113. } else {
  51114. vm._renderProxy = vm;
  51115. }
  51116. };
  51117. }
  51118. /* */
  51119. var seenObjects = new _Set();
  51120. /**
  51121. * Recursively traverse an object to evoke all converted
  51122. * getters, so that every nested property inside the object
  51123. * is collected as a "deep" dependency.
  51124. */
  51125. function traverse (val) {
  51126. _traverse(val, seenObjects);
  51127. seenObjects.clear();
  51128. }
  51129. function _traverse (val, seen) {
  51130. var i, keys;
  51131. var isA = Array.isArray(val);
  51132. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51133. return
  51134. }
  51135. if (val.__ob__) {
  51136. var depId = val.__ob__.dep.id;
  51137. if (seen.has(depId)) {
  51138. return
  51139. }
  51140. seen.add(depId);
  51141. }
  51142. if (isA) {
  51143. i = val.length;
  51144. while (i--) { _traverse(val[i], seen); }
  51145. } else {
  51146. keys = Object.keys(val);
  51147. i = keys.length;
  51148. while (i--) { _traverse(val[keys[i]], seen); }
  51149. }
  51150. }
  51151. /* */
  51152. var normalizeEvent = cached(function (name) {
  51153. var passive = name.charAt(0) === '&';
  51154. name = passive ? name.slice(1) : name;
  51155. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51156. name = once$$1 ? name.slice(1) : name;
  51157. var capture = name.charAt(0) === '!';
  51158. name = capture ? name.slice(1) : name;
  51159. return {
  51160. name: name,
  51161. once: once$$1,
  51162. capture: capture,
  51163. passive: passive
  51164. }
  51165. });
  51166. function createFnInvoker (fns, vm) {
  51167. function invoker () {
  51168. var arguments$1 = arguments;
  51169. var fns = invoker.fns;
  51170. if (Array.isArray(fns)) {
  51171. var cloned = fns.slice();
  51172. for (var i = 0; i < cloned.length; i++) {
  51173. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51174. }
  51175. } else {
  51176. // return handler return value for single handlers
  51177. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51178. }
  51179. }
  51180. invoker.fns = fns;
  51181. return invoker
  51182. }
  51183. function updateListeners (
  51184. on,
  51185. oldOn,
  51186. add,
  51187. remove$$1,
  51188. createOnceHandler,
  51189. vm
  51190. ) {
  51191. var name, def$$1, cur, old, event;
  51192. for (name in on) {
  51193. def$$1 = cur = on[name];
  51194. old = oldOn[name];
  51195. event = normalizeEvent(name);
  51196. if (isUndef(cur)) {
  51197. warn(
  51198. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51199. vm
  51200. );
  51201. } else if (isUndef(old)) {
  51202. if (isUndef(cur.fns)) {
  51203. cur = on[name] = createFnInvoker(cur, vm);
  51204. }
  51205. if (isTrue(event.once)) {
  51206. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51207. }
  51208. add(event.name, cur, event.capture, event.passive, event.params);
  51209. } else if (cur !== old) {
  51210. old.fns = cur;
  51211. on[name] = old;
  51212. }
  51213. }
  51214. for (name in oldOn) {
  51215. if (isUndef(on[name])) {
  51216. event = normalizeEvent(name);
  51217. remove$$1(event.name, oldOn[name], event.capture);
  51218. }
  51219. }
  51220. }
  51221. /* */
  51222. function mergeVNodeHook (def, hookKey, hook) {
  51223. if (def instanceof VNode) {
  51224. def = def.data.hook || (def.data.hook = {});
  51225. }
  51226. var invoker;
  51227. var oldHook = def[hookKey];
  51228. function wrappedHook () {
  51229. hook.apply(this, arguments);
  51230. // important: remove merged hook to ensure it's called only once
  51231. // and prevent memory leak
  51232. remove(invoker.fns, wrappedHook);
  51233. }
  51234. if (isUndef(oldHook)) {
  51235. // no existing hook
  51236. invoker = createFnInvoker([wrappedHook]);
  51237. } else {
  51238. /* istanbul ignore if */
  51239. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51240. // already a merged invoker
  51241. invoker = oldHook;
  51242. invoker.fns.push(wrappedHook);
  51243. } else {
  51244. // existing plain hook
  51245. invoker = createFnInvoker([oldHook, wrappedHook]);
  51246. }
  51247. }
  51248. invoker.merged = true;
  51249. def[hookKey] = invoker;
  51250. }
  51251. /* */
  51252. function extractPropsFromVNodeData (
  51253. data,
  51254. Ctor,
  51255. tag
  51256. ) {
  51257. // we are only extracting raw values here.
  51258. // validation and default values are handled in the child
  51259. // component itself.
  51260. var propOptions = Ctor.options.props;
  51261. if (isUndef(propOptions)) {
  51262. return
  51263. }
  51264. var res = {};
  51265. var attrs = data.attrs;
  51266. var props = data.props;
  51267. if (isDef(attrs) || isDef(props)) {
  51268. for (var key in propOptions) {
  51269. var altKey = hyphenate(key);
  51270. {
  51271. var keyInLowerCase = key.toLowerCase();
  51272. if (
  51273. key !== keyInLowerCase &&
  51274. attrs && hasOwn(attrs, keyInLowerCase)
  51275. ) {
  51276. tip(
  51277. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51278. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51279. " \"" + key + "\". " +
  51280. "Note that HTML attributes are case-insensitive and camelCased " +
  51281. "props need to use their kebab-case equivalents when using in-DOM " +
  51282. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51283. );
  51284. }
  51285. }
  51286. checkProp(res, props, key, altKey, true) ||
  51287. checkProp(res, attrs, key, altKey, false);
  51288. }
  51289. }
  51290. return res
  51291. }
  51292. function checkProp (
  51293. res,
  51294. hash,
  51295. key,
  51296. altKey,
  51297. preserve
  51298. ) {
  51299. if (isDef(hash)) {
  51300. if (hasOwn(hash, key)) {
  51301. res[key] = hash[key];
  51302. if (!preserve) {
  51303. delete hash[key];
  51304. }
  51305. return true
  51306. } else if (hasOwn(hash, altKey)) {
  51307. res[key] = hash[altKey];
  51308. if (!preserve) {
  51309. delete hash[altKey];
  51310. }
  51311. return true
  51312. }
  51313. }
  51314. return false
  51315. }
  51316. /* */
  51317. // The template compiler attempts to minimize the need for normalization by
  51318. // statically analyzing the template at compile time.
  51319. //
  51320. // For plain HTML markup, normalization can be completely skipped because the
  51321. // generated render function is guaranteed to return Array<VNode>. There are
  51322. // two cases where extra normalization is needed:
  51323. // 1. When the children contains components - because a functional component
  51324. // may return an Array instead of a single root. In this case, just a simple
  51325. // normalization is needed - if any child is an Array, we flatten the whole
  51326. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51327. // because functional components already normalize their own children.
  51328. function simpleNormalizeChildren (children) {
  51329. for (var i = 0; i < children.length; i++) {
  51330. if (Array.isArray(children[i])) {
  51331. return Array.prototype.concat.apply([], children)
  51332. }
  51333. }
  51334. return children
  51335. }
  51336. // 2. When the children contains constructs that always generated nested Arrays,
  51337. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51338. // with hand-written render functions / JSX. In such cases a full normalization
  51339. // is needed to cater to all possible types of children values.
  51340. function normalizeChildren (children) {
  51341. return isPrimitive(children)
  51342. ? [createTextVNode(children)]
  51343. : Array.isArray(children)
  51344. ? normalizeArrayChildren(children)
  51345. : undefined
  51346. }
  51347. function isTextNode (node) {
  51348. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51349. }
  51350. function normalizeArrayChildren (children, nestedIndex) {
  51351. var res = [];
  51352. var i, c, lastIndex, last;
  51353. for (i = 0; i < children.length; i++) {
  51354. c = children[i];
  51355. if (isUndef(c) || typeof c === 'boolean') { continue }
  51356. lastIndex = res.length - 1;
  51357. last = res[lastIndex];
  51358. // nested
  51359. if (Array.isArray(c)) {
  51360. if (c.length > 0) {
  51361. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51362. // merge adjacent text nodes
  51363. if (isTextNode(c[0]) && isTextNode(last)) {
  51364. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51365. c.shift();
  51366. }
  51367. res.push.apply(res, c);
  51368. }
  51369. } else if (isPrimitive(c)) {
  51370. if (isTextNode(last)) {
  51371. // merge adjacent text nodes
  51372. // this is necessary for SSR hydration because text nodes are
  51373. // essentially merged when rendered to HTML strings
  51374. res[lastIndex] = createTextVNode(last.text + c);
  51375. } else if (c !== '') {
  51376. // convert primitive to vnode
  51377. res.push(createTextVNode(c));
  51378. }
  51379. } else {
  51380. if (isTextNode(c) && isTextNode(last)) {
  51381. // merge adjacent text nodes
  51382. res[lastIndex] = createTextVNode(last.text + c.text);
  51383. } else {
  51384. // default key for nested array children (likely generated by v-for)
  51385. if (isTrue(children._isVList) &&
  51386. isDef(c.tag) &&
  51387. isUndef(c.key) &&
  51388. isDef(nestedIndex)) {
  51389. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51390. }
  51391. res.push(c);
  51392. }
  51393. }
  51394. }
  51395. return res
  51396. }
  51397. /* */
  51398. function initProvide (vm) {
  51399. var provide = vm.$options.provide;
  51400. if (provide) {
  51401. vm._provided = typeof provide === 'function'
  51402. ? provide.call(vm)
  51403. : provide;
  51404. }
  51405. }
  51406. function initInjections (vm) {
  51407. var result = resolveInject(vm.$options.inject, vm);
  51408. if (result) {
  51409. toggleObserving(false);
  51410. Object.keys(result).forEach(function (key) {
  51411. /* istanbul ignore else */
  51412. {
  51413. defineReactive$$1(vm, key, result[key], function () {
  51414. warn(
  51415. "Avoid mutating an injected value directly since the changes will be " +
  51416. "overwritten whenever the provided component re-renders. " +
  51417. "injection being mutated: \"" + key + "\"",
  51418. vm
  51419. );
  51420. });
  51421. }
  51422. });
  51423. toggleObserving(true);
  51424. }
  51425. }
  51426. function resolveInject (inject, vm) {
  51427. if (inject) {
  51428. // inject is :any because flow is not smart enough to figure out cached
  51429. var result = Object.create(null);
  51430. var keys = hasSymbol
  51431. ? Reflect.ownKeys(inject)
  51432. : Object.keys(inject);
  51433. for (var i = 0; i < keys.length; i++) {
  51434. var key = keys[i];
  51435. // #6574 in case the inject object is observed...
  51436. if (key === '__ob__') { continue }
  51437. var provideKey = inject[key].from;
  51438. var source = vm;
  51439. while (source) {
  51440. if (source._provided && hasOwn(source._provided, provideKey)) {
  51441. result[key] = source._provided[provideKey];
  51442. break
  51443. }
  51444. source = source.$parent;
  51445. }
  51446. if (!source) {
  51447. if ('default' in inject[key]) {
  51448. var provideDefault = inject[key].default;
  51449. result[key] = typeof provideDefault === 'function'
  51450. ? provideDefault.call(vm)
  51451. : provideDefault;
  51452. } else {
  51453. warn(("Injection \"" + key + "\" not found"), vm);
  51454. }
  51455. }
  51456. }
  51457. return result
  51458. }
  51459. }
  51460. /* */
  51461. /**
  51462. * Runtime helper for resolving raw children VNodes into a slot object.
  51463. */
  51464. function resolveSlots (
  51465. children,
  51466. context
  51467. ) {
  51468. if (!children || !children.length) {
  51469. return {}
  51470. }
  51471. var slots = {};
  51472. for (var i = 0, l = children.length; i < l; i++) {
  51473. var child = children[i];
  51474. var data = child.data;
  51475. // remove slot attribute if the node is resolved as a Vue slot node
  51476. if (data && data.attrs && data.attrs.slot) {
  51477. delete data.attrs.slot;
  51478. }
  51479. // named slots should only be respected if the vnode was rendered in the
  51480. // same context.
  51481. if ((child.context === context || child.fnContext === context) &&
  51482. data && data.slot != null
  51483. ) {
  51484. var name = data.slot;
  51485. var slot = (slots[name] || (slots[name] = []));
  51486. if (child.tag === 'template') {
  51487. slot.push.apply(slot, child.children || []);
  51488. } else {
  51489. slot.push(child);
  51490. }
  51491. } else {
  51492. (slots.default || (slots.default = [])).push(child);
  51493. }
  51494. }
  51495. // ignore slots that contains only whitespace
  51496. for (var name$1 in slots) {
  51497. if (slots[name$1].every(isWhitespace)) {
  51498. delete slots[name$1];
  51499. }
  51500. }
  51501. return slots
  51502. }
  51503. function isWhitespace (node) {
  51504. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51505. }
  51506. /* */
  51507. function normalizeScopedSlots (
  51508. slots,
  51509. normalSlots,
  51510. prevSlots
  51511. ) {
  51512. var res;
  51513. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51514. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51515. var key = slots && slots.$key;
  51516. if (!slots) {
  51517. res = {};
  51518. } else if (slots._normalized) {
  51519. // fast path 1: child component re-render only, parent did not change
  51520. return slots._normalized
  51521. } else if (
  51522. isStable &&
  51523. prevSlots &&
  51524. prevSlots !== emptyObject &&
  51525. key === prevSlots.$key &&
  51526. !hasNormalSlots &&
  51527. !prevSlots.$hasNormal
  51528. ) {
  51529. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51530. // only need to normalize once
  51531. return prevSlots
  51532. } else {
  51533. res = {};
  51534. for (var key$1 in slots) {
  51535. if (slots[key$1] && key$1[0] !== '$') {
  51536. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51537. }
  51538. }
  51539. }
  51540. // expose normal slots on scopedSlots
  51541. for (var key$2 in normalSlots) {
  51542. if (!(key$2 in res)) {
  51543. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51544. }
  51545. }
  51546. // avoriaz seems to mock a non-extensible $scopedSlots object
  51547. // and when that is passed down this would cause an error
  51548. if (slots && Object.isExtensible(slots)) {
  51549. (slots)._normalized = res;
  51550. }
  51551. def(res, '$stable', isStable);
  51552. def(res, '$key', key);
  51553. def(res, '$hasNormal', hasNormalSlots);
  51554. return res
  51555. }
  51556. function normalizeScopedSlot(normalSlots, key, fn) {
  51557. var normalized = function () {
  51558. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51559. res = res && typeof res === 'object' && !Array.isArray(res)
  51560. ? [res] // single vnode
  51561. : normalizeChildren(res);
  51562. return res && (
  51563. res.length === 0 ||
  51564. (res.length === 1 && res[0].isComment) // #9658
  51565. ) ? undefined
  51566. : res
  51567. };
  51568. // this is a slot using the new v-slot syntax without scope. although it is
  51569. // compiled as a scoped slot, render fn users would expect it to be present
  51570. // on this.$slots because the usage is semantically a normal slot.
  51571. if (fn.proxy) {
  51572. Object.defineProperty(normalSlots, key, {
  51573. get: normalized,
  51574. enumerable: true,
  51575. configurable: true
  51576. });
  51577. }
  51578. return normalized
  51579. }
  51580. function proxyNormalSlot(slots, key) {
  51581. return function () { return slots[key]; }
  51582. }
  51583. /* */
  51584. /**
  51585. * Runtime helper for rendering v-for lists.
  51586. */
  51587. function renderList (
  51588. val,
  51589. render
  51590. ) {
  51591. var ret, i, l, keys, key;
  51592. if (Array.isArray(val) || typeof val === 'string') {
  51593. ret = new Array(val.length);
  51594. for (i = 0, l = val.length; i < l; i++) {
  51595. ret[i] = render(val[i], i);
  51596. }
  51597. } else if (typeof val === 'number') {
  51598. ret = new Array(val);
  51599. for (i = 0; i < val; i++) {
  51600. ret[i] = render(i + 1, i);
  51601. }
  51602. } else if (isObject(val)) {
  51603. if (hasSymbol && val[Symbol.iterator]) {
  51604. ret = [];
  51605. var iterator = val[Symbol.iterator]();
  51606. var result = iterator.next();
  51607. while (!result.done) {
  51608. ret.push(render(result.value, ret.length));
  51609. result = iterator.next();
  51610. }
  51611. } else {
  51612. keys = Object.keys(val);
  51613. ret = new Array(keys.length);
  51614. for (i = 0, l = keys.length; i < l; i++) {
  51615. key = keys[i];
  51616. ret[i] = render(val[key], key, i);
  51617. }
  51618. }
  51619. }
  51620. if (!isDef(ret)) {
  51621. ret = [];
  51622. }
  51623. (ret)._isVList = true;
  51624. return ret
  51625. }
  51626. /* */
  51627. /**
  51628. * Runtime helper for rendering <slot>
  51629. */
  51630. function renderSlot (
  51631. name,
  51632. fallback,
  51633. props,
  51634. bindObject
  51635. ) {
  51636. var scopedSlotFn = this.$scopedSlots[name];
  51637. var nodes;
  51638. if (scopedSlotFn) { // scoped slot
  51639. props = props || {};
  51640. if (bindObject) {
  51641. if (!isObject(bindObject)) {
  51642. warn(
  51643. 'slot v-bind without argument expects an Object',
  51644. this
  51645. );
  51646. }
  51647. props = extend(extend({}, bindObject), props);
  51648. }
  51649. nodes = scopedSlotFn(props) || fallback;
  51650. } else {
  51651. nodes = this.$slots[name] || fallback;
  51652. }
  51653. var target = props && props.slot;
  51654. if (target) {
  51655. return this.$createElement('template', { slot: target }, nodes)
  51656. } else {
  51657. return nodes
  51658. }
  51659. }
  51660. /* */
  51661. /**
  51662. * Runtime helper for resolving filters
  51663. */
  51664. function resolveFilter (id) {
  51665. return resolveAsset(this.$options, 'filters', id, true) || identity
  51666. }
  51667. /* */
  51668. function isKeyNotMatch (expect, actual) {
  51669. if (Array.isArray(expect)) {
  51670. return expect.indexOf(actual) === -1
  51671. } else {
  51672. return expect !== actual
  51673. }
  51674. }
  51675. /**
  51676. * Runtime helper for checking keyCodes from config.
  51677. * exposed as Vue.prototype._k
  51678. * passing in eventKeyName as last argument separately for backwards compat
  51679. */
  51680. function checkKeyCodes (
  51681. eventKeyCode,
  51682. key,
  51683. builtInKeyCode,
  51684. eventKeyName,
  51685. builtInKeyName
  51686. ) {
  51687. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51688. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51689. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51690. } else if (mappedKeyCode) {
  51691. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51692. } else if (eventKeyName) {
  51693. return hyphenate(eventKeyName) !== key
  51694. }
  51695. }
  51696. /* */
  51697. /**
  51698. * Runtime helper for merging v-bind="object" into a VNode's data.
  51699. */
  51700. function bindObjectProps (
  51701. data,
  51702. tag,
  51703. value,
  51704. asProp,
  51705. isSync
  51706. ) {
  51707. if (value) {
  51708. if (!isObject(value)) {
  51709. warn(
  51710. 'v-bind without argument expects an Object or Array value',
  51711. this
  51712. );
  51713. } else {
  51714. if (Array.isArray(value)) {
  51715. value = toObject(value);
  51716. }
  51717. var hash;
  51718. var loop = function ( key ) {
  51719. if (
  51720. key === 'class' ||
  51721. key === 'style' ||
  51722. isReservedAttribute(key)
  51723. ) {
  51724. hash = data;
  51725. } else {
  51726. var type = data.attrs && data.attrs.type;
  51727. hash = asProp || config.mustUseProp(tag, type, key)
  51728. ? data.domProps || (data.domProps = {})
  51729. : data.attrs || (data.attrs = {});
  51730. }
  51731. var camelizedKey = camelize(key);
  51732. var hyphenatedKey = hyphenate(key);
  51733. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51734. hash[key] = value[key];
  51735. if (isSync) {
  51736. var on = data.on || (data.on = {});
  51737. on[("update:" + key)] = function ($event) {
  51738. value[key] = $event;
  51739. };
  51740. }
  51741. }
  51742. };
  51743. for (var key in value) loop( key );
  51744. }
  51745. }
  51746. return data
  51747. }
  51748. /* */
  51749. /**
  51750. * Runtime helper for rendering static trees.
  51751. */
  51752. function renderStatic (
  51753. index,
  51754. isInFor
  51755. ) {
  51756. var cached = this._staticTrees || (this._staticTrees = []);
  51757. var tree = cached[index];
  51758. // if has already-rendered static tree and not inside v-for,
  51759. // we can reuse the same tree.
  51760. if (tree && !isInFor) {
  51761. return tree
  51762. }
  51763. // otherwise, render a fresh tree.
  51764. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51765. this._renderProxy,
  51766. null,
  51767. this // for render fns generated for functional component templates
  51768. );
  51769. markStatic(tree, ("__static__" + index), false);
  51770. return tree
  51771. }
  51772. /**
  51773. * Runtime helper for v-once.
  51774. * Effectively it means marking the node as static with a unique key.
  51775. */
  51776. function markOnce (
  51777. tree,
  51778. index,
  51779. key
  51780. ) {
  51781. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51782. return tree
  51783. }
  51784. function markStatic (
  51785. tree,
  51786. key,
  51787. isOnce
  51788. ) {
  51789. if (Array.isArray(tree)) {
  51790. for (var i = 0; i < tree.length; i++) {
  51791. if (tree[i] && typeof tree[i] !== 'string') {
  51792. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51793. }
  51794. }
  51795. } else {
  51796. markStaticNode(tree, key, isOnce);
  51797. }
  51798. }
  51799. function markStaticNode (node, key, isOnce) {
  51800. node.isStatic = true;
  51801. node.key = key;
  51802. node.isOnce = isOnce;
  51803. }
  51804. /* */
  51805. function bindObjectListeners (data, value) {
  51806. if (value) {
  51807. if (!isPlainObject(value)) {
  51808. warn(
  51809. 'v-on without argument expects an Object value',
  51810. this
  51811. );
  51812. } else {
  51813. var on = data.on = data.on ? extend({}, data.on) : {};
  51814. for (var key in value) {
  51815. var existing = on[key];
  51816. var ours = value[key];
  51817. on[key] = existing ? [].concat(existing, ours) : ours;
  51818. }
  51819. }
  51820. }
  51821. return data
  51822. }
  51823. /* */
  51824. function resolveScopedSlots (
  51825. fns, // see flow/vnode
  51826. res,
  51827. // the following are added in 2.6
  51828. hasDynamicKeys,
  51829. contentHashKey
  51830. ) {
  51831. res = res || { $stable: !hasDynamicKeys };
  51832. for (var i = 0; i < fns.length; i++) {
  51833. var slot = fns[i];
  51834. if (Array.isArray(slot)) {
  51835. resolveScopedSlots(slot, res, hasDynamicKeys);
  51836. } else if (slot) {
  51837. // marker for reverse proxying v-slot without scope on this.$slots
  51838. if (slot.proxy) {
  51839. slot.fn.proxy = true;
  51840. }
  51841. res[slot.key] = slot.fn;
  51842. }
  51843. }
  51844. if (contentHashKey) {
  51845. (res).$key = contentHashKey;
  51846. }
  51847. return res
  51848. }
  51849. /* */
  51850. function bindDynamicKeys (baseObj, values) {
  51851. for (var i = 0; i < values.length; i += 2) {
  51852. var key = values[i];
  51853. if (typeof key === 'string' && key) {
  51854. baseObj[values[i]] = values[i + 1];
  51855. } else if (key !== '' && key !== null) {
  51856. // null is a special value for explicitly removing a binding
  51857. warn(
  51858. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51859. this
  51860. );
  51861. }
  51862. }
  51863. return baseObj
  51864. }
  51865. // helper to dynamically append modifier runtime markers to event names.
  51866. // ensure only append when value is already string, otherwise it will be cast
  51867. // to string and cause the type check to miss.
  51868. function prependModifier (value, symbol) {
  51869. return typeof value === 'string' ? symbol + value : value
  51870. }
  51871. /* */
  51872. function installRenderHelpers (target) {
  51873. target._o = markOnce;
  51874. target._n = toNumber;
  51875. target._s = toString;
  51876. target._l = renderList;
  51877. target._t = renderSlot;
  51878. target._q = looseEqual;
  51879. target._i = looseIndexOf;
  51880. target._m = renderStatic;
  51881. target._f = resolveFilter;
  51882. target._k = checkKeyCodes;
  51883. target._b = bindObjectProps;
  51884. target._v = createTextVNode;
  51885. target._e = createEmptyVNode;
  51886. target._u = resolveScopedSlots;
  51887. target._g = bindObjectListeners;
  51888. target._d = bindDynamicKeys;
  51889. target._p = prependModifier;
  51890. }
  51891. /* */
  51892. function FunctionalRenderContext (
  51893. data,
  51894. props,
  51895. children,
  51896. parent,
  51897. Ctor
  51898. ) {
  51899. var this$1 = this;
  51900. var options = Ctor.options;
  51901. // ensure the createElement function in functional components
  51902. // gets a unique context - this is necessary for correct named slot check
  51903. var contextVm;
  51904. if (hasOwn(parent, '_uid')) {
  51905. contextVm = Object.create(parent);
  51906. // $flow-disable-line
  51907. contextVm._original = parent;
  51908. } else {
  51909. // the context vm passed in is a functional context as well.
  51910. // in this case we want to make sure we are able to get a hold to the
  51911. // real context instance.
  51912. contextVm = parent;
  51913. // $flow-disable-line
  51914. parent = parent._original;
  51915. }
  51916. var isCompiled = isTrue(options._compiled);
  51917. var needNormalization = !isCompiled;
  51918. this.data = data;
  51919. this.props = props;
  51920. this.children = children;
  51921. this.parent = parent;
  51922. this.listeners = data.on || emptyObject;
  51923. this.injections = resolveInject(options.inject, parent);
  51924. this.slots = function () {
  51925. if (!this$1.$slots) {
  51926. normalizeScopedSlots(
  51927. data.scopedSlots,
  51928. this$1.$slots = resolveSlots(children, parent)
  51929. );
  51930. }
  51931. return this$1.$slots
  51932. };
  51933. Object.defineProperty(this, 'scopedSlots', ({
  51934. enumerable: true,
  51935. get: function get () {
  51936. return normalizeScopedSlots(data.scopedSlots, this.slots())
  51937. }
  51938. }));
  51939. // support for compiled functional template
  51940. if (isCompiled) {
  51941. // exposing $options for renderStatic()
  51942. this.$options = options;
  51943. // pre-resolve slots for renderSlot()
  51944. this.$slots = this.slots();
  51945. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  51946. }
  51947. if (options._scopeId) {
  51948. this._c = function (a, b, c, d) {
  51949. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  51950. if (vnode && !Array.isArray(vnode)) {
  51951. vnode.fnScopeId = options._scopeId;
  51952. vnode.fnContext = parent;
  51953. }
  51954. return vnode
  51955. };
  51956. } else {
  51957. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  51958. }
  51959. }
  51960. installRenderHelpers(FunctionalRenderContext.prototype);
  51961. function createFunctionalComponent (
  51962. Ctor,
  51963. propsData,
  51964. data,
  51965. contextVm,
  51966. children
  51967. ) {
  51968. var options = Ctor.options;
  51969. var props = {};
  51970. var propOptions = options.props;
  51971. if (isDef(propOptions)) {
  51972. for (var key in propOptions) {
  51973. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  51974. }
  51975. } else {
  51976. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  51977. if (isDef(data.props)) { mergeProps(props, data.props); }
  51978. }
  51979. var renderContext = new FunctionalRenderContext(
  51980. data,
  51981. props,
  51982. children,
  51983. contextVm,
  51984. Ctor
  51985. );
  51986. var vnode = options.render.call(null, renderContext._c, renderContext);
  51987. if (vnode instanceof VNode) {
  51988. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  51989. } else if (Array.isArray(vnode)) {
  51990. var vnodes = normalizeChildren(vnode) || [];
  51991. var res = new Array(vnodes.length);
  51992. for (var i = 0; i < vnodes.length; i++) {
  51993. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  51994. }
  51995. return res
  51996. }
  51997. }
  51998. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  51999. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52000. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52001. // that should not be matched to match.
  52002. var clone = cloneVNode(vnode);
  52003. clone.fnContext = contextVm;
  52004. clone.fnOptions = options;
  52005. {
  52006. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52007. }
  52008. if (data.slot) {
  52009. (clone.data || (clone.data = {})).slot = data.slot;
  52010. }
  52011. return clone
  52012. }
  52013. function mergeProps (to, from) {
  52014. for (var key in from) {
  52015. to[camelize(key)] = from[key];
  52016. }
  52017. }
  52018. /* */
  52019. /* */
  52020. /* */
  52021. /* */
  52022. // inline hooks to be invoked on component VNodes during patch
  52023. var componentVNodeHooks = {
  52024. init: function init (vnode, hydrating) {
  52025. if (
  52026. vnode.componentInstance &&
  52027. !vnode.componentInstance._isDestroyed &&
  52028. vnode.data.keepAlive
  52029. ) {
  52030. // kept-alive components, treat as a patch
  52031. var mountedNode = vnode; // work around flow
  52032. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52033. } else {
  52034. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52035. vnode,
  52036. activeInstance
  52037. );
  52038. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52039. }
  52040. },
  52041. prepatch: function prepatch (oldVnode, vnode) {
  52042. var options = vnode.componentOptions;
  52043. var child = vnode.componentInstance = oldVnode.componentInstance;
  52044. updateChildComponent(
  52045. child,
  52046. options.propsData, // updated props
  52047. options.listeners, // updated listeners
  52048. vnode, // new parent vnode
  52049. options.children // new children
  52050. );
  52051. },
  52052. insert: function insert (vnode) {
  52053. var context = vnode.context;
  52054. var componentInstance = vnode.componentInstance;
  52055. if (!componentInstance._isMounted) {
  52056. componentInstance._isMounted = true;
  52057. callHook(componentInstance, 'mounted');
  52058. }
  52059. if (vnode.data.keepAlive) {
  52060. if (context._isMounted) {
  52061. // vue-router#1212
  52062. // During updates, a kept-alive component's child components may
  52063. // change, so directly walking the tree here may call activated hooks
  52064. // on incorrect children. Instead we push them into a queue which will
  52065. // be processed after the whole patch process ended.
  52066. queueActivatedComponent(componentInstance);
  52067. } else {
  52068. activateChildComponent(componentInstance, true /* direct */);
  52069. }
  52070. }
  52071. },
  52072. destroy: function destroy (vnode) {
  52073. var componentInstance = vnode.componentInstance;
  52074. if (!componentInstance._isDestroyed) {
  52075. if (!vnode.data.keepAlive) {
  52076. componentInstance.$destroy();
  52077. } else {
  52078. deactivateChildComponent(componentInstance, true /* direct */);
  52079. }
  52080. }
  52081. }
  52082. };
  52083. var hooksToMerge = Object.keys(componentVNodeHooks);
  52084. function createComponent (
  52085. Ctor,
  52086. data,
  52087. context,
  52088. children,
  52089. tag
  52090. ) {
  52091. if (isUndef(Ctor)) {
  52092. return
  52093. }
  52094. var baseCtor = context.$options._base;
  52095. // plain options object: turn it into a constructor
  52096. if (isObject(Ctor)) {
  52097. Ctor = baseCtor.extend(Ctor);
  52098. }
  52099. // if at this stage it's not a constructor or an async component factory,
  52100. // reject.
  52101. if (typeof Ctor !== 'function') {
  52102. {
  52103. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52104. }
  52105. return
  52106. }
  52107. // async component
  52108. var asyncFactory;
  52109. if (isUndef(Ctor.cid)) {
  52110. asyncFactory = Ctor;
  52111. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52112. if (Ctor === undefined) {
  52113. // return a placeholder node for async component, which is rendered
  52114. // as a comment node but preserves all the raw information for the node.
  52115. // the information will be used for async server-rendering and hydration.
  52116. return createAsyncPlaceholder(
  52117. asyncFactory,
  52118. data,
  52119. context,
  52120. children,
  52121. tag
  52122. )
  52123. }
  52124. }
  52125. data = data || {};
  52126. // resolve constructor options in case global mixins are applied after
  52127. // component constructor creation
  52128. resolveConstructorOptions(Ctor);
  52129. // transform component v-model data into props & events
  52130. if (isDef(data.model)) {
  52131. transformModel(Ctor.options, data);
  52132. }
  52133. // extract props
  52134. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52135. // functional component
  52136. if (isTrue(Ctor.options.functional)) {
  52137. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52138. }
  52139. // extract listeners, since these needs to be treated as
  52140. // child component listeners instead of DOM listeners
  52141. var listeners = data.on;
  52142. // replace with listeners with .native modifier
  52143. // so it gets processed during parent component patch.
  52144. data.on = data.nativeOn;
  52145. if (isTrue(Ctor.options.abstract)) {
  52146. // abstract components do not keep anything
  52147. // other than props & listeners & slot
  52148. // work around flow
  52149. var slot = data.slot;
  52150. data = {};
  52151. if (slot) {
  52152. data.slot = slot;
  52153. }
  52154. }
  52155. // install component management hooks onto the placeholder node
  52156. installComponentHooks(data);
  52157. // return a placeholder vnode
  52158. var name = Ctor.options.name || tag;
  52159. var vnode = new VNode(
  52160. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52161. data, undefined, undefined, undefined, context,
  52162. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52163. asyncFactory
  52164. );
  52165. return vnode
  52166. }
  52167. function createComponentInstanceForVnode (
  52168. vnode, // we know it's MountedComponentVNode but flow doesn't
  52169. parent // activeInstance in lifecycle state
  52170. ) {
  52171. var options = {
  52172. _isComponent: true,
  52173. _parentVnode: vnode,
  52174. parent: parent
  52175. };
  52176. // check inline-template render functions
  52177. var inlineTemplate = vnode.data.inlineTemplate;
  52178. if (isDef(inlineTemplate)) {
  52179. options.render = inlineTemplate.render;
  52180. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52181. }
  52182. return new vnode.componentOptions.Ctor(options)
  52183. }
  52184. function installComponentHooks (data) {
  52185. var hooks = data.hook || (data.hook = {});
  52186. for (var i = 0; i < hooksToMerge.length; i++) {
  52187. var key = hooksToMerge[i];
  52188. var existing = hooks[key];
  52189. var toMerge = componentVNodeHooks[key];
  52190. if (existing !== toMerge && !(existing && existing._merged)) {
  52191. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52192. }
  52193. }
  52194. }
  52195. function mergeHook$1 (f1, f2) {
  52196. var merged = function (a, b) {
  52197. // flow complains about extra args which is why we use any
  52198. f1(a, b);
  52199. f2(a, b);
  52200. };
  52201. merged._merged = true;
  52202. return merged
  52203. }
  52204. // transform component v-model info (value and callback) into
  52205. // prop and event handler respectively.
  52206. function transformModel (options, data) {
  52207. var prop = (options.model && options.model.prop) || 'value';
  52208. var event = (options.model && options.model.event) || 'input'
  52209. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52210. var on = data.on || (data.on = {});
  52211. var existing = on[event];
  52212. var callback = data.model.callback;
  52213. if (isDef(existing)) {
  52214. if (
  52215. Array.isArray(existing)
  52216. ? existing.indexOf(callback) === -1
  52217. : existing !== callback
  52218. ) {
  52219. on[event] = [callback].concat(existing);
  52220. }
  52221. } else {
  52222. on[event] = callback;
  52223. }
  52224. }
  52225. /* */
  52226. var SIMPLE_NORMALIZE = 1;
  52227. var ALWAYS_NORMALIZE = 2;
  52228. // wrapper function for providing a more flexible interface
  52229. // without getting yelled at by flow
  52230. function createElement (
  52231. context,
  52232. tag,
  52233. data,
  52234. children,
  52235. normalizationType,
  52236. alwaysNormalize
  52237. ) {
  52238. if (Array.isArray(data) || isPrimitive(data)) {
  52239. normalizationType = children;
  52240. children = data;
  52241. data = undefined;
  52242. }
  52243. if (isTrue(alwaysNormalize)) {
  52244. normalizationType = ALWAYS_NORMALIZE;
  52245. }
  52246. return _createElement(context, tag, data, children, normalizationType)
  52247. }
  52248. function _createElement (
  52249. context,
  52250. tag,
  52251. data,
  52252. children,
  52253. normalizationType
  52254. ) {
  52255. if (isDef(data) && isDef((data).__ob__)) {
  52256. warn(
  52257. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52258. 'Always create fresh vnode data objects in each render!',
  52259. context
  52260. );
  52261. return createEmptyVNode()
  52262. }
  52263. // object syntax in v-bind
  52264. if (isDef(data) && isDef(data.is)) {
  52265. tag = data.is;
  52266. }
  52267. if (!tag) {
  52268. // in case of component :is set to falsy value
  52269. return createEmptyVNode()
  52270. }
  52271. // warn against non-primitive key
  52272. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52273. ) {
  52274. {
  52275. warn(
  52276. 'Avoid using non-primitive value as key, ' +
  52277. 'use string/number value instead.',
  52278. context
  52279. );
  52280. }
  52281. }
  52282. // support single function children as default scoped slot
  52283. if (Array.isArray(children) &&
  52284. typeof children[0] === 'function'
  52285. ) {
  52286. data = data || {};
  52287. data.scopedSlots = { default: children[0] };
  52288. children.length = 0;
  52289. }
  52290. if (normalizationType === ALWAYS_NORMALIZE) {
  52291. children = normalizeChildren(children);
  52292. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52293. children = simpleNormalizeChildren(children);
  52294. }
  52295. var vnode, ns;
  52296. if (typeof tag === 'string') {
  52297. var Ctor;
  52298. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52299. if (config.isReservedTag(tag)) {
  52300. // platform built-in elements
  52301. if (isDef(data) && isDef(data.nativeOn)) {
  52302. warn(
  52303. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52304. context
  52305. );
  52306. }
  52307. vnode = new VNode(
  52308. config.parsePlatformTagName(tag), data, children,
  52309. undefined, undefined, context
  52310. );
  52311. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52312. // component
  52313. vnode = createComponent(Ctor, data, context, children, tag);
  52314. } else {
  52315. // unknown or unlisted namespaced elements
  52316. // check at runtime because it may get assigned a namespace when its
  52317. // parent normalizes children
  52318. vnode = new VNode(
  52319. tag, data, children,
  52320. undefined, undefined, context
  52321. );
  52322. }
  52323. } else {
  52324. // direct component options / constructor
  52325. vnode = createComponent(tag, data, context, children);
  52326. }
  52327. if (Array.isArray(vnode)) {
  52328. return vnode
  52329. } else if (isDef(vnode)) {
  52330. if (isDef(ns)) { applyNS(vnode, ns); }
  52331. if (isDef(data)) { registerDeepBindings(data); }
  52332. return vnode
  52333. } else {
  52334. return createEmptyVNode()
  52335. }
  52336. }
  52337. function applyNS (vnode, ns, force) {
  52338. vnode.ns = ns;
  52339. if (vnode.tag === 'foreignObject') {
  52340. // use default namespace inside foreignObject
  52341. ns = undefined;
  52342. force = true;
  52343. }
  52344. if (isDef(vnode.children)) {
  52345. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52346. var child = vnode.children[i];
  52347. if (isDef(child.tag) && (
  52348. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52349. applyNS(child, ns, force);
  52350. }
  52351. }
  52352. }
  52353. }
  52354. // ref #5318
  52355. // necessary to ensure parent re-render when deep bindings like :style and
  52356. // :class are used on slot nodes
  52357. function registerDeepBindings (data) {
  52358. if (isObject(data.style)) {
  52359. traverse(data.style);
  52360. }
  52361. if (isObject(data.class)) {
  52362. traverse(data.class);
  52363. }
  52364. }
  52365. /* */
  52366. function initRender (vm) {
  52367. vm._vnode = null; // the root of the child tree
  52368. vm._staticTrees = null; // v-once cached trees
  52369. var options = vm.$options;
  52370. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52371. var renderContext = parentVnode && parentVnode.context;
  52372. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52373. vm.$scopedSlots = emptyObject;
  52374. // bind the createElement fn to this instance
  52375. // so that we get proper render context inside it.
  52376. // args order: tag, data, children, normalizationType, alwaysNormalize
  52377. // internal version is used by render functions compiled from templates
  52378. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52379. // normalization is always applied for the public version, used in
  52380. // user-written render functions.
  52381. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52382. // $attrs & $listeners are exposed for easier HOC creation.
  52383. // they need to be reactive so that HOCs using them are always updated
  52384. var parentData = parentVnode && parentVnode.data;
  52385. /* istanbul ignore else */
  52386. {
  52387. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52388. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52389. }, true);
  52390. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52391. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52392. }, true);
  52393. }
  52394. }
  52395. var currentRenderingInstance = null;
  52396. function renderMixin (Vue) {
  52397. // install runtime convenience helpers
  52398. installRenderHelpers(Vue.prototype);
  52399. Vue.prototype.$nextTick = function (fn) {
  52400. return nextTick(fn, this)
  52401. };
  52402. Vue.prototype._render = function () {
  52403. var vm = this;
  52404. var ref = vm.$options;
  52405. var render = ref.render;
  52406. var _parentVnode = ref._parentVnode;
  52407. if (_parentVnode) {
  52408. vm.$scopedSlots = normalizeScopedSlots(
  52409. _parentVnode.data.scopedSlots,
  52410. vm.$slots,
  52411. vm.$scopedSlots
  52412. );
  52413. }
  52414. // set parent vnode. this allows render functions to have access
  52415. // to the data on the placeholder node.
  52416. vm.$vnode = _parentVnode;
  52417. // render self
  52418. var vnode;
  52419. try {
  52420. // There's no need to maintain a stack because all render fns are called
  52421. // separately from one another. Nested component's render fns are called
  52422. // when parent component is patched.
  52423. currentRenderingInstance = vm;
  52424. vnode = render.call(vm._renderProxy, vm.$createElement);
  52425. } catch (e) {
  52426. handleError(e, vm, "render");
  52427. // return error render result,
  52428. // or previous vnode to prevent render error causing blank component
  52429. /* istanbul ignore else */
  52430. if (vm.$options.renderError) {
  52431. try {
  52432. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52433. } catch (e) {
  52434. handleError(e, vm, "renderError");
  52435. vnode = vm._vnode;
  52436. }
  52437. } else {
  52438. vnode = vm._vnode;
  52439. }
  52440. } finally {
  52441. currentRenderingInstance = null;
  52442. }
  52443. // if the returned array contains only a single node, allow it
  52444. if (Array.isArray(vnode) && vnode.length === 1) {
  52445. vnode = vnode[0];
  52446. }
  52447. // return empty vnode in case the render function errored out
  52448. if (!(vnode instanceof VNode)) {
  52449. if (Array.isArray(vnode)) {
  52450. warn(
  52451. 'Multiple root nodes returned from render function. Render function ' +
  52452. 'should return a single root node.',
  52453. vm
  52454. );
  52455. }
  52456. vnode = createEmptyVNode();
  52457. }
  52458. // set parent
  52459. vnode.parent = _parentVnode;
  52460. return vnode
  52461. };
  52462. }
  52463. /* */
  52464. function ensureCtor (comp, base) {
  52465. if (
  52466. comp.__esModule ||
  52467. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52468. ) {
  52469. comp = comp.default;
  52470. }
  52471. return isObject(comp)
  52472. ? base.extend(comp)
  52473. : comp
  52474. }
  52475. function createAsyncPlaceholder (
  52476. factory,
  52477. data,
  52478. context,
  52479. children,
  52480. tag
  52481. ) {
  52482. var node = createEmptyVNode();
  52483. node.asyncFactory = factory;
  52484. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52485. return node
  52486. }
  52487. function resolveAsyncComponent (
  52488. factory,
  52489. baseCtor
  52490. ) {
  52491. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52492. return factory.errorComp
  52493. }
  52494. if (isDef(factory.resolved)) {
  52495. return factory.resolved
  52496. }
  52497. var owner = currentRenderingInstance;
  52498. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52499. // already pending
  52500. factory.owners.push(owner);
  52501. }
  52502. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52503. return factory.loadingComp
  52504. }
  52505. if (owner && !isDef(factory.owners)) {
  52506. var owners = factory.owners = [owner];
  52507. var sync = true;
  52508. var timerLoading = null;
  52509. var timerTimeout = null
  52510. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52511. var forceRender = function (renderCompleted) {
  52512. for (var i = 0, l = owners.length; i < l; i++) {
  52513. (owners[i]).$forceUpdate();
  52514. }
  52515. if (renderCompleted) {
  52516. owners.length = 0;
  52517. if (timerLoading !== null) {
  52518. clearTimeout(timerLoading);
  52519. timerLoading = null;
  52520. }
  52521. if (timerTimeout !== null) {
  52522. clearTimeout(timerTimeout);
  52523. timerTimeout = null;
  52524. }
  52525. }
  52526. };
  52527. var resolve = once(function (res) {
  52528. // cache resolved
  52529. factory.resolved = ensureCtor(res, baseCtor);
  52530. // invoke callbacks only if this is not a synchronous resolve
  52531. // (async resolves are shimmed as synchronous during SSR)
  52532. if (!sync) {
  52533. forceRender(true);
  52534. } else {
  52535. owners.length = 0;
  52536. }
  52537. });
  52538. var reject = once(function (reason) {
  52539. warn(
  52540. "Failed to resolve async component: " + (String(factory)) +
  52541. (reason ? ("\nReason: " + reason) : '')
  52542. );
  52543. if (isDef(factory.errorComp)) {
  52544. factory.error = true;
  52545. forceRender(true);
  52546. }
  52547. });
  52548. var res = factory(resolve, reject);
  52549. if (isObject(res)) {
  52550. if (isPromise(res)) {
  52551. // () => Promise
  52552. if (isUndef(factory.resolved)) {
  52553. res.then(resolve, reject);
  52554. }
  52555. } else if (isPromise(res.component)) {
  52556. res.component.then(resolve, reject);
  52557. if (isDef(res.error)) {
  52558. factory.errorComp = ensureCtor(res.error, baseCtor);
  52559. }
  52560. if (isDef(res.loading)) {
  52561. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52562. if (res.delay === 0) {
  52563. factory.loading = true;
  52564. } else {
  52565. timerLoading = setTimeout(function () {
  52566. timerLoading = null;
  52567. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52568. factory.loading = true;
  52569. forceRender(false);
  52570. }
  52571. }, res.delay || 200);
  52572. }
  52573. }
  52574. if (isDef(res.timeout)) {
  52575. timerTimeout = setTimeout(function () {
  52576. timerTimeout = null;
  52577. if (isUndef(factory.resolved)) {
  52578. reject(
  52579. "timeout (" + (res.timeout) + "ms)"
  52580. );
  52581. }
  52582. }, res.timeout);
  52583. }
  52584. }
  52585. }
  52586. sync = false;
  52587. // return in case resolved synchronously
  52588. return factory.loading
  52589. ? factory.loadingComp
  52590. : factory.resolved
  52591. }
  52592. }
  52593. /* */
  52594. function isAsyncPlaceholder (node) {
  52595. return node.isComment && node.asyncFactory
  52596. }
  52597. /* */
  52598. function getFirstComponentChild (children) {
  52599. if (Array.isArray(children)) {
  52600. for (var i = 0; i < children.length; i++) {
  52601. var c = children[i];
  52602. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52603. return c
  52604. }
  52605. }
  52606. }
  52607. }
  52608. /* */
  52609. /* */
  52610. function initEvents (vm) {
  52611. vm._events = Object.create(null);
  52612. vm._hasHookEvent = false;
  52613. // init parent attached events
  52614. var listeners = vm.$options._parentListeners;
  52615. if (listeners) {
  52616. updateComponentListeners(vm, listeners);
  52617. }
  52618. }
  52619. var target;
  52620. function add (event, fn) {
  52621. target.$on(event, fn);
  52622. }
  52623. function remove$1 (event, fn) {
  52624. target.$off(event, fn);
  52625. }
  52626. function createOnceHandler (event, fn) {
  52627. var _target = target;
  52628. return function onceHandler () {
  52629. var res = fn.apply(null, arguments);
  52630. if (res !== null) {
  52631. _target.$off(event, onceHandler);
  52632. }
  52633. }
  52634. }
  52635. function updateComponentListeners (
  52636. vm,
  52637. listeners,
  52638. oldListeners
  52639. ) {
  52640. target = vm;
  52641. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52642. target = undefined;
  52643. }
  52644. function eventsMixin (Vue) {
  52645. var hookRE = /^hook:/;
  52646. Vue.prototype.$on = function (event, fn) {
  52647. var vm = this;
  52648. if (Array.isArray(event)) {
  52649. for (var i = 0, l = event.length; i < l; i++) {
  52650. vm.$on(event[i], fn);
  52651. }
  52652. } else {
  52653. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52654. // optimize hook:event cost by using a boolean flag marked at registration
  52655. // instead of a hash lookup
  52656. if (hookRE.test(event)) {
  52657. vm._hasHookEvent = true;
  52658. }
  52659. }
  52660. return vm
  52661. };
  52662. Vue.prototype.$once = function (event, fn) {
  52663. var vm = this;
  52664. function on () {
  52665. vm.$off(event, on);
  52666. fn.apply(vm, arguments);
  52667. }
  52668. on.fn = fn;
  52669. vm.$on(event, on);
  52670. return vm
  52671. };
  52672. Vue.prototype.$off = function (event, fn) {
  52673. var vm = this;
  52674. // all
  52675. if (!arguments.length) {
  52676. vm._events = Object.create(null);
  52677. return vm
  52678. }
  52679. // array of events
  52680. if (Array.isArray(event)) {
  52681. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52682. vm.$off(event[i$1], fn);
  52683. }
  52684. return vm
  52685. }
  52686. // specific event
  52687. var cbs = vm._events[event];
  52688. if (!cbs) {
  52689. return vm
  52690. }
  52691. if (!fn) {
  52692. vm._events[event] = null;
  52693. return vm
  52694. }
  52695. // specific handler
  52696. var cb;
  52697. var i = cbs.length;
  52698. while (i--) {
  52699. cb = cbs[i];
  52700. if (cb === fn || cb.fn === fn) {
  52701. cbs.splice(i, 1);
  52702. break
  52703. }
  52704. }
  52705. return vm
  52706. };
  52707. Vue.prototype.$emit = function (event) {
  52708. var vm = this;
  52709. {
  52710. var lowerCaseEvent = event.toLowerCase();
  52711. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52712. tip(
  52713. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52714. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52715. "Note that HTML attributes are case-insensitive and you cannot use " +
  52716. "v-on to listen to camelCase events when using in-DOM templates. " +
  52717. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52718. );
  52719. }
  52720. }
  52721. var cbs = vm._events[event];
  52722. if (cbs) {
  52723. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52724. var args = toArray(arguments, 1);
  52725. var info = "event handler for \"" + event + "\"";
  52726. for (var i = 0, l = cbs.length; i < l; i++) {
  52727. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52728. }
  52729. }
  52730. return vm
  52731. };
  52732. }
  52733. /* */
  52734. var activeInstance = null;
  52735. var isUpdatingChildComponent = false;
  52736. function setActiveInstance(vm) {
  52737. var prevActiveInstance = activeInstance;
  52738. activeInstance = vm;
  52739. return function () {
  52740. activeInstance = prevActiveInstance;
  52741. }
  52742. }
  52743. function initLifecycle (vm) {
  52744. var options = vm.$options;
  52745. // locate first non-abstract parent
  52746. var parent = options.parent;
  52747. if (parent && !options.abstract) {
  52748. while (parent.$options.abstract && parent.$parent) {
  52749. parent = parent.$parent;
  52750. }
  52751. parent.$children.push(vm);
  52752. }
  52753. vm.$parent = parent;
  52754. vm.$root = parent ? parent.$root : vm;
  52755. vm.$children = [];
  52756. vm.$refs = {};
  52757. vm._watcher = null;
  52758. vm._inactive = null;
  52759. vm._directInactive = false;
  52760. vm._isMounted = false;
  52761. vm._isDestroyed = false;
  52762. vm._isBeingDestroyed = false;
  52763. }
  52764. function lifecycleMixin (Vue) {
  52765. Vue.prototype._update = function (vnode, hydrating) {
  52766. var vm = this;
  52767. var prevEl = vm.$el;
  52768. var prevVnode = vm._vnode;
  52769. var restoreActiveInstance = setActiveInstance(vm);
  52770. vm._vnode = vnode;
  52771. // Vue.prototype.__patch__ is injected in entry points
  52772. // based on the rendering backend used.
  52773. if (!prevVnode) {
  52774. // initial render
  52775. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52776. } else {
  52777. // updates
  52778. vm.$el = vm.__patch__(prevVnode, vnode);
  52779. }
  52780. restoreActiveInstance();
  52781. // update __vue__ reference
  52782. if (prevEl) {
  52783. prevEl.__vue__ = null;
  52784. }
  52785. if (vm.$el) {
  52786. vm.$el.__vue__ = vm;
  52787. }
  52788. // if parent is an HOC, update its $el as well
  52789. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52790. vm.$parent.$el = vm.$el;
  52791. }
  52792. // updated hook is called by the scheduler to ensure that children are
  52793. // updated in a parent's updated hook.
  52794. };
  52795. Vue.prototype.$forceUpdate = function () {
  52796. var vm = this;
  52797. if (vm._watcher) {
  52798. vm._watcher.update();
  52799. }
  52800. };
  52801. Vue.prototype.$destroy = function () {
  52802. var vm = this;
  52803. if (vm._isBeingDestroyed) {
  52804. return
  52805. }
  52806. callHook(vm, 'beforeDestroy');
  52807. vm._isBeingDestroyed = true;
  52808. // remove self from parent
  52809. var parent = vm.$parent;
  52810. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52811. remove(parent.$children, vm);
  52812. }
  52813. // teardown watchers
  52814. if (vm._watcher) {
  52815. vm._watcher.teardown();
  52816. }
  52817. var i = vm._watchers.length;
  52818. while (i--) {
  52819. vm._watchers[i].teardown();
  52820. }
  52821. // remove reference from data ob
  52822. // frozen object may not have observer.
  52823. if (vm._data.__ob__) {
  52824. vm._data.__ob__.vmCount--;
  52825. }
  52826. // call the last hook...
  52827. vm._isDestroyed = true;
  52828. // invoke destroy hooks on current rendered tree
  52829. vm.__patch__(vm._vnode, null);
  52830. // fire destroyed hook
  52831. callHook(vm, 'destroyed');
  52832. // turn off all instance listeners.
  52833. vm.$off();
  52834. // remove __vue__ reference
  52835. if (vm.$el) {
  52836. vm.$el.__vue__ = null;
  52837. }
  52838. // release circular reference (#6759)
  52839. if (vm.$vnode) {
  52840. vm.$vnode.parent = null;
  52841. }
  52842. };
  52843. }
  52844. function mountComponent (
  52845. vm,
  52846. el,
  52847. hydrating
  52848. ) {
  52849. vm.$el = el;
  52850. if (!vm.$options.render) {
  52851. vm.$options.render = createEmptyVNode;
  52852. {
  52853. /* istanbul ignore if */
  52854. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52855. vm.$options.el || el) {
  52856. warn(
  52857. 'You are using the runtime-only build of Vue where the template ' +
  52858. 'compiler is not available. Either pre-compile the templates into ' +
  52859. 'render functions, or use the compiler-included build.',
  52860. vm
  52861. );
  52862. } else {
  52863. warn(
  52864. 'Failed to mount component: template or render function not defined.',
  52865. vm
  52866. );
  52867. }
  52868. }
  52869. }
  52870. callHook(vm, 'beforeMount');
  52871. var updateComponent;
  52872. /* istanbul ignore if */
  52873. if (config.performance && mark) {
  52874. updateComponent = function () {
  52875. var name = vm._name;
  52876. var id = vm._uid;
  52877. var startTag = "vue-perf-start:" + id;
  52878. var endTag = "vue-perf-end:" + id;
  52879. mark(startTag);
  52880. var vnode = vm._render();
  52881. mark(endTag);
  52882. measure(("vue " + name + " render"), startTag, endTag);
  52883. mark(startTag);
  52884. vm._update(vnode, hydrating);
  52885. mark(endTag);
  52886. measure(("vue " + name + " patch"), startTag, endTag);
  52887. };
  52888. } else {
  52889. updateComponent = function () {
  52890. vm._update(vm._render(), hydrating);
  52891. };
  52892. }
  52893. // we set this to vm._watcher inside the watcher's constructor
  52894. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52895. // component's mounted hook), which relies on vm._watcher being already defined
  52896. new Watcher(vm, updateComponent, noop, {
  52897. before: function before () {
  52898. if (vm._isMounted && !vm._isDestroyed) {
  52899. callHook(vm, 'beforeUpdate');
  52900. }
  52901. }
  52902. }, true /* isRenderWatcher */);
  52903. hydrating = false;
  52904. // manually mounted instance, call mounted on self
  52905. // mounted is called for render-created child components in its inserted hook
  52906. if (vm.$vnode == null) {
  52907. vm._isMounted = true;
  52908. callHook(vm, 'mounted');
  52909. }
  52910. return vm
  52911. }
  52912. function updateChildComponent (
  52913. vm,
  52914. propsData,
  52915. listeners,
  52916. parentVnode,
  52917. renderChildren
  52918. ) {
  52919. {
  52920. isUpdatingChildComponent = true;
  52921. }
  52922. // determine whether component has slot children
  52923. // we need to do this before overwriting $options._renderChildren.
  52924. // check if there are dynamic scopedSlots (hand-written or compiled but with
  52925. // dynamic slot names). Static scoped slots compiled from template has the
  52926. // "$stable" marker.
  52927. var newScopedSlots = parentVnode.data.scopedSlots;
  52928. var oldScopedSlots = vm.$scopedSlots;
  52929. var hasDynamicScopedSlot = !!(
  52930. (newScopedSlots && !newScopedSlots.$stable) ||
  52931. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  52932. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  52933. );
  52934. // Any static slot children from the parent may have changed during parent's
  52935. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  52936. // update is necessary to ensure correctness.
  52937. var needsForceUpdate = !!(
  52938. renderChildren || // has new static slots
  52939. vm.$options._renderChildren || // has old static slots
  52940. hasDynamicScopedSlot
  52941. );
  52942. vm.$options._parentVnode = parentVnode;
  52943. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  52944. if (vm._vnode) { // update child tree's parent
  52945. vm._vnode.parent = parentVnode;
  52946. }
  52947. vm.$options._renderChildren = renderChildren;
  52948. // update $attrs and $listeners hash
  52949. // these are also reactive so they may trigger child update if the child
  52950. // used them during render
  52951. vm.$attrs = parentVnode.data.attrs || emptyObject;
  52952. vm.$listeners = listeners || emptyObject;
  52953. // update props
  52954. if (propsData && vm.$options.props) {
  52955. toggleObserving(false);
  52956. var props = vm._props;
  52957. var propKeys = vm.$options._propKeys || [];
  52958. for (var i = 0; i < propKeys.length; i++) {
  52959. var key = propKeys[i];
  52960. var propOptions = vm.$options.props; // wtf flow?
  52961. props[key] = validateProp(key, propOptions, propsData, vm);
  52962. }
  52963. toggleObserving(true);
  52964. // keep a copy of raw propsData
  52965. vm.$options.propsData = propsData;
  52966. }
  52967. // update listeners
  52968. listeners = listeners || emptyObject;
  52969. var oldListeners = vm.$options._parentListeners;
  52970. vm.$options._parentListeners = listeners;
  52971. updateComponentListeners(vm, listeners, oldListeners);
  52972. // resolve slots + force update if has children
  52973. if (needsForceUpdate) {
  52974. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  52975. vm.$forceUpdate();
  52976. }
  52977. {
  52978. isUpdatingChildComponent = false;
  52979. }
  52980. }
  52981. function isInInactiveTree (vm) {
  52982. while (vm && (vm = vm.$parent)) {
  52983. if (vm._inactive) { return true }
  52984. }
  52985. return false
  52986. }
  52987. function activateChildComponent (vm, direct) {
  52988. if (direct) {
  52989. vm._directInactive = false;
  52990. if (isInInactiveTree(vm)) {
  52991. return
  52992. }
  52993. } else if (vm._directInactive) {
  52994. return
  52995. }
  52996. if (vm._inactive || vm._inactive === null) {
  52997. vm._inactive = false;
  52998. for (var i = 0; i < vm.$children.length; i++) {
  52999. activateChildComponent(vm.$children[i]);
  53000. }
  53001. callHook(vm, 'activated');
  53002. }
  53003. }
  53004. function deactivateChildComponent (vm, direct) {
  53005. if (direct) {
  53006. vm._directInactive = true;
  53007. if (isInInactiveTree(vm)) {
  53008. return
  53009. }
  53010. }
  53011. if (!vm._inactive) {
  53012. vm._inactive = true;
  53013. for (var i = 0; i < vm.$children.length; i++) {
  53014. deactivateChildComponent(vm.$children[i]);
  53015. }
  53016. callHook(vm, 'deactivated');
  53017. }
  53018. }
  53019. function callHook (vm, hook) {
  53020. // #7573 disable dep collection when invoking lifecycle hooks
  53021. pushTarget();
  53022. var handlers = vm.$options[hook];
  53023. var info = hook + " hook";
  53024. if (handlers) {
  53025. for (var i = 0, j = handlers.length; i < j; i++) {
  53026. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53027. }
  53028. }
  53029. if (vm._hasHookEvent) {
  53030. vm.$emit('hook:' + hook);
  53031. }
  53032. popTarget();
  53033. }
  53034. /* */
  53035. var MAX_UPDATE_COUNT = 100;
  53036. var queue = [];
  53037. var activatedChildren = [];
  53038. var has = {};
  53039. var circular = {};
  53040. var waiting = false;
  53041. var flushing = false;
  53042. var index = 0;
  53043. /**
  53044. * Reset the scheduler's state.
  53045. */
  53046. function resetSchedulerState () {
  53047. index = queue.length = activatedChildren.length = 0;
  53048. has = {};
  53049. {
  53050. circular = {};
  53051. }
  53052. waiting = flushing = false;
  53053. }
  53054. // Async edge case #6566 requires saving the timestamp when event listeners are
  53055. // attached. However, calling performance.now() has a perf overhead especially
  53056. // if the page has thousands of event listeners. Instead, we take a timestamp
  53057. // every time the scheduler flushes and use that for all event listeners
  53058. // attached during that flush.
  53059. var currentFlushTimestamp = 0;
  53060. // Async edge case fix requires storing an event listener's attach timestamp.
  53061. var getNow = Date.now;
  53062. // Determine what event timestamp the browser is using. Annoyingly, the
  53063. // timestamp can either be hi-res (relative to page load) or low-res
  53064. // (relative to UNIX epoch), so in order to compare time we have to use the
  53065. // same timestamp type when saving the flush timestamp.
  53066. // All IE versions use low-res event timestamps, and have problematic clock
  53067. // implementations (#9632)
  53068. if (inBrowser && !isIE) {
  53069. var performance = window.performance;
  53070. if (
  53071. performance &&
  53072. typeof performance.now === 'function' &&
  53073. getNow() > document.createEvent('Event').timeStamp
  53074. ) {
  53075. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53076. // smaller than it, it means the event is using a hi-res timestamp,
  53077. // and we need to use the hi-res version for event listener timestamps as
  53078. // well.
  53079. getNow = function () { return performance.now(); };
  53080. }
  53081. }
  53082. /**
  53083. * Flush both queues and run the watchers.
  53084. */
  53085. function flushSchedulerQueue () {
  53086. currentFlushTimestamp = getNow();
  53087. flushing = true;
  53088. var watcher, id;
  53089. // Sort queue before flush.
  53090. // This ensures that:
  53091. // 1. Components are updated from parent to child. (because parent is always
  53092. // created before the child)
  53093. // 2. A component's user watchers are run before its render watcher (because
  53094. // user watchers are created before the render watcher)
  53095. // 3. If a component is destroyed during a parent component's watcher run,
  53096. // its watchers can be skipped.
  53097. queue.sort(function (a, b) { return a.id - b.id; });
  53098. // do not cache length because more watchers might be pushed
  53099. // as we run existing watchers
  53100. for (index = 0; index < queue.length; index++) {
  53101. watcher = queue[index];
  53102. if (watcher.before) {
  53103. watcher.before();
  53104. }
  53105. id = watcher.id;
  53106. has[id] = null;
  53107. watcher.run();
  53108. // in dev build, check and stop circular updates.
  53109. if (has[id] != null) {
  53110. circular[id] = (circular[id] || 0) + 1;
  53111. if (circular[id] > MAX_UPDATE_COUNT) {
  53112. warn(
  53113. 'You may have an infinite update loop ' + (
  53114. watcher.user
  53115. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53116. : "in a component render function."
  53117. ),
  53118. watcher.vm
  53119. );
  53120. break
  53121. }
  53122. }
  53123. }
  53124. // keep copies of post queues before resetting state
  53125. var activatedQueue = activatedChildren.slice();
  53126. var updatedQueue = queue.slice();
  53127. resetSchedulerState();
  53128. // call component updated and activated hooks
  53129. callActivatedHooks(activatedQueue);
  53130. callUpdatedHooks(updatedQueue);
  53131. // devtool hook
  53132. /* istanbul ignore if */
  53133. if (devtools && config.devtools) {
  53134. devtools.emit('flush');
  53135. }
  53136. }
  53137. function callUpdatedHooks (queue) {
  53138. var i = queue.length;
  53139. while (i--) {
  53140. var watcher = queue[i];
  53141. var vm = watcher.vm;
  53142. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53143. callHook(vm, 'updated');
  53144. }
  53145. }
  53146. }
  53147. /**
  53148. * Queue a kept-alive component that was activated during patch.
  53149. * The queue will be processed after the entire tree has been patched.
  53150. */
  53151. function queueActivatedComponent (vm) {
  53152. // setting _inactive to false here so that a render function can
  53153. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53154. vm._inactive = false;
  53155. activatedChildren.push(vm);
  53156. }
  53157. function callActivatedHooks (queue) {
  53158. for (var i = 0; i < queue.length; i++) {
  53159. queue[i]._inactive = true;
  53160. activateChildComponent(queue[i], true /* true */);
  53161. }
  53162. }
  53163. /**
  53164. * Push a watcher into the watcher queue.
  53165. * Jobs with duplicate IDs will be skipped unless it's
  53166. * pushed when the queue is being flushed.
  53167. */
  53168. function queueWatcher (watcher) {
  53169. var id = watcher.id;
  53170. if (has[id] == null) {
  53171. has[id] = true;
  53172. if (!flushing) {
  53173. queue.push(watcher);
  53174. } else {
  53175. // if already flushing, splice the watcher based on its id
  53176. // if already past its id, it will be run next immediately.
  53177. var i = queue.length - 1;
  53178. while (i > index && queue[i].id > watcher.id) {
  53179. i--;
  53180. }
  53181. queue.splice(i + 1, 0, watcher);
  53182. }
  53183. // queue the flush
  53184. if (!waiting) {
  53185. waiting = true;
  53186. if (!config.async) {
  53187. flushSchedulerQueue();
  53188. return
  53189. }
  53190. nextTick(flushSchedulerQueue);
  53191. }
  53192. }
  53193. }
  53194. /* */
  53195. var uid$2 = 0;
  53196. /**
  53197. * A watcher parses an expression, collects dependencies,
  53198. * and fires callback when the expression value changes.
  53199. * This is used for both the $watch() api and directives.
  53200. */
  53201. var Watcher = function Watcher (
  53202. vm,
  53203. expOrFn,
  53204. cb,
  53205. options,
  53206. isRenderWatcher
  53207. ) {
  53208. this.vm = vm;
  53209. if (isRenderWatcher) {
  53210. vm._watcher = this;
  53211. }
  53212. vm._watchers.push(this);
  53213. // options
  53214. if (options) {
  53215. this.deep = !!options.deep;
  53216. this.user = !!options.user;
  53217. this.lazy = !!options.lazy;
  53218. this.sync = !!options.sync;
  53219. this.before = options.before;
  53220. } else {
  53221. this.deep = this.user = this.lazy = this.sync = false;
  53222. }
  53223. this.cb = cb;
  53224. this.id = ++uid$2; // uid for batching
  53225. this.active = true;
  53226. this.dirty = this.lazy; // for lazy watchers
  53227. this.deps = [];
  53228. this.newDeps = [];
  53229. this.depIds = new _Set();
  53230. this.newDepIds = new _Set();
  53231. this.expression = expOrFn.toString();
  53232. // parse expression for getter
  53233. if (typeof expOrFn === 'function') {
  53234. this.getter = expOrFn;
  53235. } else {
  53236. this.getter = parsePath(expOrFn);
  53237. if (!this.getter) {
  53238. this.getter = noop;
  53239. warn(
  53240. "Failed watching path: \"" + expOrFn + "\" " +
  53241. 'Watcher only accepts simple dot-delimited paths. ' +
  53242. 'For full control, use a function instead.',
  53243. vm
  53244. );
  53245. }
  53246. }
  53247. this.value = this.lazy
  53248. ? undefined
  53249. : this.get();
  53250. };
  53251. /**
  53252. * Evaluate the getter, and re-collect dependencies.
  53253. */
  53254. Watcher.prototype.get = function get () {
  53255. pushTarget(this);
  53256. var value;
  53257. var vm = this.vm;
  53258. try {
  53259. value = this.getter.call(vm, vm);
  53260. } catch (e) {
  53261. if (this.user) {
  53262. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53263. } else {
  53264. throw e
  53265. }
  53266. } finally {
  53267. // "touch" every property so they are all tracked as
  53268. // dependencies for deep watching
  53269. if (this.deep) {
  53270. traverse(value);
  53271. }
  53272. popTarget();
  53273. this.cleanupDeps();
  53274. }
  53275. return value
  53276. };
  53277. /**
  53278. * Add a dependency to this directive.
  53279. */
  53280. Watcher.prototype.addDep = function addDep (dep) {
  53281. var id = dep.id;
  53282. if (!this.newDepIds.has(id)) {
  53283. this.newDepIds.add(id);
  53284. this.newDeps.push(dep);
  53285. if (!this.depIds.has(id)) {
  53286. dep.addSub(this);
  53287. }
  53288. }
  53289. };
  53290. /**
  53291. * Clean up for dependency collection.
  53292. */
  53293. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53294. var i = this.deps.length;
  53295. while (i--) {
  53296. var dep = this.deps[i];
  53297. if (!this.newDepIds.has(dep.id)) {
  53298. dep.removeSub(this);
  53299. }
  53300. }
  53301. var tmp = this.depIds;
  53302. this.depIds = this.newDepIds;
  53303. this.newDepIds = tmp;
  53304. this.newDepIds.clear();
  53305. tmp = this.deps;
  53306. this.deps = this.newDeps;
  53307. this.newDeps = tmp;
  53308. this.newDeps.length = 0;
  53309. };
  53310. /**
  53311. * Subscriber interface.
  53312. * Will be called when a dependency changes.
  53313. */
  53314. Watcher.prototype.update = function update () {
  53315. /* istanbul ignore else */
  53316. if (this.lazy) {
  53317. this.dirty = true;
  53318. } else if (this.sync) {
  53319. this.run();
  53320. } else {
  53321. queueWatcher(this);
  53322. }
  53323. };
  53324. /**
  53325. * Scheduler job interface.
  53326. * Will be called by the scheduler.
  53327. */
  53328. Watcher.prototype.run = function run () {
  53329. if (this.active) {
  53330. var value = this.get();
  53331. if (
  53332. value !== this.value ||
  53333. // Deep watchers and watchers on Object/Arrays should fire even
  53334. // when the value is the same, because the value may
  53335. // have mutated.
  53336. isObject(value) ||
  53337. this.deep
  53338. ) {
  53339. // set new value
  53340. var oldValue = this.value;
  53341. this.value = value;
  53342. if (this.user) {
  53343. try {
  53344. this.cb.call(this.vm, value, oldValue);
  53345. } catch (e) {
  53346. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53347. }
  53348. } else {
  53349. this.cb.call(this.vm, value, oldValue);
  53350. }
  53351. }
  53352. }
  53353. };
  53354. /**
  53355. * Evaluate the value of the watcher.
  53356. * This only gets called for lazy watchers.
  53357. */
  53358. Watcher.prototype.evaluate = function evaluate () {
  53359. this.value = this.get();
  53360. this.dirty = false;
  53361. };
  53362. /**
  53363. * Depend on all deps collected by this watcher.
  53364. */
  53365. Watcher.prototype.depend = function depend () {
  53366. var i = this.deps.length;
  53367. while (i--) {
  53368. this.deps[i].depend();
  53369. }
  53370. };
  53371. /**
  53372. * Remove self from all dependencies' subscriber list.
  53373. */
  53374. Watcher.prototype.teardown = function teardown () {
  53375. if (this.active) {
  53376. // remove self from vm's watcher list
  53377. // this is a somewhat expensive operation so we skip it
  53378. // if the vm is being destroyed.
  53379. if (!this.vm._isBeingDestroyed) {
  53380. remove(this.vm._watchers, this);
  53381. }
  53382. var i = this.deps.length;
  53383. while (i--) {
  53384. this.deps[i].removeSub(this);
  53385. }
  53386. this.active = false;
  53387. }
  53388. };
  53389. /* */
  53390. var sharedPropertyDefinition = {
  53391. enumerable: true,
  53392. configurable: true,
  53393. get: noop,
  53394. set: noop
  53395. };
  53396. function proxy (target, sourceKey, key) {
  53397. sharedPropertyDefinition.get = function proxyGetter () {
  53398. return this[sourceKey][key]
  53399. };
  53400. sharedPropertyDefinition.set = function proxySetter (val) {
  53401. this[sourceKey][key] = val;
  53402. };
  53403. Object.defineProperty(target, key, sharedPropertyDefinition);
  53404. }
  53405. function initState (vm) {
  53406. vm._watchers = [];
  53407. var opts = vm.$options;
  53408. if (opts.props) { initProps(vm, opts.props); }
  53409. if (opts.methods) { initMethods(vm, opts.methods); }
  53410. if (opts.data) {
  53411. initData(vm);
  53412. } else {
  53413. observe(vm._data = {}, true /* asRootData */);
  53414. }
  53415. if (opts.computed) { initComputed(vm, opts.computed); }
  53416. if (opts.watch && opts.watch !== nativeWatch) {
  53417. initWatch(vm, opts.watch);
  53418. }
  53419. }
  53420. function initProps (vm, propsOptions) {
  53421. var propsData = vm.$options.propsData || {};
  53422. var props = vm._props = {};
  53423. // cache prop keys so that future props updates can iterate using Array
  53424. // instead of dynamic object key enumeration.
  53425. var keys = vm.$options._propKeys = [];
  53426. var isRoot = !vm.$parent;
  53427. // root instance props should be converted
  53428. if (!isRoot) {
  53429. toggleObserving(false);
  53430. }
  53431. var loop = function ( key ) {
  53432. keys.push(key);
  53433. var value = validateProp(key, propsOptions, propsData, vm);
  53434. /* istanbul ignore else */
  53435. {
  53436. var hyphenatedKey = hyphenate(key);
  53437. if (isReservedAttribute(hyphenatedKey) ||
  53438. config.isReservedAttr(hyphenatedKey)) {
  53439. warn(
  53440. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53441. vm
  53442. );
  53443. }
  53444. defineReactive$$1(props, key, value, function () {
  53445. if (!isRoot && !isUpdatingChildComponent) {
  53446. warn(
  53447. "Avoid mutating a prop directly since the value will be " +
  53448. "overwritten whenever the parent component re-renders. " +
  53449. "Instead, use a data or computed property based on the prop's " +
  53450. "value. Prop being mutated: \"" + key + "\"",
  53451. vm
  53452. );
  53453. }
  53454. });
  53455. }
  53456. // static props are already proxied on the component's prototype
  53457. // during Vue.extend(). We only need to proxy props defined at
  53458. // instantiation here.
  53459. if (!(key in vm)) {
  53460. proxy(vm, "_props", key);
  53461. }
  53462. };
  53463. for (var key in propsOptions) loop( key );
  53464. toggleObserving(true);
  53465. }
  53466. function initData (vm) {
  53467. var data = vm.$options.data;
  53468. data = vm._data = typeof data === 'function'
  53469. ? getData(data, vm)
  53470. : data || {};
  53471. if (!isPlainObject(data)) {
  53472. data = {};
  53473. warn(
  53474. 'data functions should return an object:\n' +
  53475. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53476. vm
  53477. );
  53478. }
  53479. // proxy data on instance
  53480. var keys = Object.keys(data);
  53481. var props = vm.$options.props;
  53482. var methods = vm.$options.methods;
  53483. var i = keys.length;
  53484. while (i--) {
  53485. var key = keys[i];
  53486. {
  53487. if (methods && hasOwn(methods, key)) {
  53488. warn(
  53489. ("Method \"" + key + "\" has already been defined as a data property."),
  53490. vm
  53491. );
  53492. }
  53493. }
  53494. if (props && hasOwn(props, key)) {
  53495. warn(
  53496. "The data property \"" + key + "\" is already declared as a prop. " +
  53497. "Use prop default value instead.",
  53498. vm
  53499. );
  53500. } else if (!isReserved(key)) {
  53501. proxy(vm, "_data", key);
  53502. }
  53503. }
  53504. // observe data
  53505. observe(data, true /* asRootData */);
  53506. }
  53507. function getData (data, vm) {
  53508. // #7573 disable dep collection when invoking data getters
  53509. pushTarget();
  53510. try {
  53511. return data.call(vm, vm)
  53512. } catch (e) {
  53513. handleError(e, vm, "data()");
  53514. return {}
  53515. } finally {
  53516. popTarget();
  53517. }
  53518. }
  53519. var computedWatcherOptions = { lazy: true };
  53520. function initComputed (vm, computed) {
  53521. // $flow-disable-line
  53522. var watchers = vm._computedWatchers = Object.create(null);
  53523. // computed properties are just getters during SSR
  53524. var isSSR = isServerRendering();
  53525. for (var key in computed) {
  53526. var userDef = computed[key];
  53527. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53528. if (getter == null) {
  53529. warn(
  53530. ("Getter is missing for computed property \"" + key + "\"."),
  53531. vm
  53532. );
  53533. }
  53534. if (!isSSR) {
  53535. // create internal watcher for the computed property.
  53536. watchers[key] = new Watcher(
  53537. vm,
  53538. getter || noop,
  53539. noop,
  53540. computedWatcherOptions
  53541. );
  53542. }
  53543. // component-defined computed properties are already defined on the
  53544. // component prototype. We only need to define computed properties defined
  53545. // at instantiation here.
  53546. if (!(key in vm)) {
  53547. defineComputed(vm, key, userDef);
  53548. } else {
  53549. if (key in vm.$data) {
  53550. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53551. } else if (vm.$options.props && key in vm.$options.props) {
  53552. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53553. }
  53554. }
  53555. }
  53556. }
  53557. function defineComputed (
  53558. target,
  53559. key,
  53560. userDef
  53561. ) {
  53562. var shouldCache = !isServerRendering();
  53563. if (typeof userDef === 'function') {
  53564. sharedPropertyDefinition.get = shouldCache
  53565. ? createComputedGetter(key)
  53566. : createGetterInvoker(userDef);
  53567. sharedPropertyDefinition.set = noop;
  53568. } else {
  53569. sharedPropertyDefinition.get = userDef.get
  53570. ? shouldCache && userDef.cache !== false
  53571. ? createComputedGetter(key)
  53572. : createGetterInvoker(userDef.get)
  53573. : noop;
  53574. sharedPropertyDefinition.set = userDef.set || noop;
  53575. }
  53576. if (sharedPropertyDefinition.set === noop) {
  53577. sharedPropertyDefinition.set = function () {
  53578. warn(
  53579. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53580. this
  53581. );
  53582. };
  53583. }
  53584. Object.defineProperty(target, key, sharedPropertyDefinition);
  53585. }
  53586. function createComputedGetter (key) {
  53587. return function computedGetter () {
  53588. var watcher = this._computedWatchers && this._computedWatchers[key];
  53589. if (watcher) {
  53590. if (watcher.dirty) {
  53591. watcher.evaluate();
  53592. }
  53593. if (Dep.target) {
  53594. watcher.depend();
  53595. }
  53596. return watcher.value
  53597. }
  53598. }
  53599. }
  53600. function createGetterInvoker(fn) {
  53601. return function computedGetter () {
  53602. return fn.call(this, this)
  53603. }
  53604. }
  53605. function initMethods (vm, methods) {
  53606. var props = vm.$options.props;
  53607. for (var key in methods) {
  53608. {
  53609. if (typeof methods[key] !== 'function') {
  53610. warn(
  53611. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53612. "Did you reference the function correctly?",
  53613. vm
  53614. );
  53615. }
  53616. if (props && hasOwn(props, key)) {
  53617. warn(
  53618. ("Method \"" + key + "\" has already been defined as a prop."),
  53619. vm
  53620. );
  53621. }
  53622. if ((key in vm) && isReserved(key)) {
  53623. warn(
  53624. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53625. "Avoid defining component methods that start with _ or $."
  53626. );
  53627. }
  53628. }
  53629. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53630. }
  53631. }
  53632. function initWatch (vm, watch) {
  53633. for (var key in watch) {
  53634. var handler = watch[key];
  53635. if (Array.isArray(handler)) {
  53636. for (var i = 0; i < handler.length; i++) {
  53637. createWatcher(vm, key, handler[i]);
  53638. }
  53639. } else {
  53640. createWatcher(vm, key, handler);
  53641. }
  53642. }
  53643. }
  53644. function createWatcher (
  53645. vm,
  53646. expOrFn,
  53647. handler,
  53648. options
  53649. ) {
  53650. if (isPlainObject(handler)) {
  53651. options = handler;
  53652. handler = handler.handler;
  53653. }
  53654. if (typeof handler === 'string') {
  53655. handler = vm[handler];
  53656. }
  53657. return vm.$watch(expOrFn, handler, options)
  53658. }
  53659. function stateMixin (Vue) {
  53660. // flow somehow has problems with directly declared definition object
  53661. // when using Object.defineProperty, so we have to procedurally build up
  53662. // the object here.
  53663. var dataDef = {};
  53664. dataDef.get = function () { return this._data };
  53665. var propsDef = {};
  53666. propsDef.get = function () { return this._props };
  53667. {
  53668. dataDef.set = function () {
  53669. warn(
  53670. 'Avoid replacing instance root $data. ' +
  53671. 'Use nested data properties instead.',
  53672. this
  53673. );
  53674. };
  53675. propsDef.set = function () {
  53676. warn("$props is readonly.", this);
  53677. };
  53678. }
  53679. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53680. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53681. Vue.prototype.$set = set;
  53682. Vue.prototype.$delete = del;
  53683. Vue.prototype.$watch = function (
  53684. expOrFn,
  53685. cb,
  53686. options
  53687. ) {
  53688. var vm = this;
  53689. if (isPlainObject(cb)) {
  53690. return createWatcher(vm, expOrFn, cb, options)
  53691. }
  53692. options = options || {};
  53693. options.user = true;
  53694. var watcher = new Watcher(vm, expOrFn, cb, options);
  53695. if (options.immediate) {
  53696. try {
  53697. cb.call(vm, watcher.value);
  53698. } catch (error) {
  53699. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53700. }
  53701. }
  53702. return function unwatchFn () {
  53703. watcher.teardown();
  53704. }
  53705. };
  53706. }
  53707. /* */
  53708. var uid$3 = 0;
  53709. function initMixin (Vue) {
  53710. Vue.prototype._init = function (options) {
  53711. var vm = this;
  53712. // a uid
  53713. vm._uid = uid$3++;
  53714. var startTag, endTag;
  53715. /* istanbul ignore if */
  53716. if (config.performance && mark) {
  53717. startTag = "vue-perf-start:" + (vm._uid);
  53718. endTag = "vue-perf-end:" + (vm._uid);
  53719. mark(startTag);
  53720. }
  53721. // a flag to avoid this being observed
  53722. vm._isVue = true;
  53723. // merge options
  53724. if (options && options._isComponent) {
  53725. // optimize internal component instantiation
  53726. // since dynamic options merging is pretty slow, and none of the
  53727. // internal component options needs special treatment.
  53728. initInternalComponent(vm, options);
  53729. } else {
  53730. vm.$options = mergeOptions(
  53731. resolveConstructorOptions(vm.constructor),
  53732. options || {},
  53733. vm
  53734. );
  53735. }
  53736. /* istanbul ignore else */
  53737. {
  53738. initProxy(vm);
  53739. }
  53740. // expose real self
  53741. vm._self = vm;
  53742. initLifecycle(vm);
  53743. initEvents(vm);
  53744. initRender(vm);
  53745. callHook(vm, 'beforeCreate');
  53746. initInjections(vm); // resolve injections before data/props
  53747. initState(vm);
  53748. initProvide(vm); // resolve provide after data/props
  53749. callHook(vm, 'created');
  53750. /* istanbul ignore if */
  53751. if (config.performance && mark) {
  53752. vm._name = formatComponentName(vm, false);
  53753. mark(endTag);
  53754. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53755. }
  53756. if (vm.$options.el) {
  53757. vm.$mount(vm.$options.el);
  53758. }
  53759. };
  53760. }
  53761. function initInternalComponent (vm, options) {
  53762. var opts = vm.$options = Object.create(vm.constructor.options);
  53763. // doing this because it's faster than dynamic enumeration.
  53764. var parentVnode = options._parentVnode;
  53765. opts.parent = options.parent;
  53766. opts._parentVnode = parentVnode;
  53767. var vnodeComponentOptions = parentVnode.componentOptions;
  53768. opts.propsData = vnodeComponentOptions.propsData;
  53769. opts._parentListeners = vnodeComponentOptions.listeners;
  53770. opts._renderChildren = vnodeComponentOptions.children;
  53771. opts._componentTag = vnodeComponentOptions.tag;
  53772. if (options.render) {
  53773. opts.render = options.render;
  53774. opts.staticRenderFns = options.staticRenderFns;
  53775. }
  53776. }
  53777. function resolveConstructorOptions (Ctor) {
  53778. var options = Ctor.options;
  53779. if (Ctor.super) {
  53780. var superOptions = resolveConstructorOptions(Ctor.super);
  53781. var cachedSuperOptions = Ctor.superOptions;
  53782. if (superOptions !== cachedSuperOptions) {
  53783. // super option changed,
  53784. // need to resolve new options.
  53785. Ctor.superOptions = superOptions;
  53786. // check if there are any late-modified/attached options (#4976)
  53787. var modifiedOptions = resolveModifiedOptions(Ctor);
  53788. // update base extend options
  53789. if (modifiedOptions) {
  53790. extend(Ctor.extendOptions, modifiedOptions);
  53791. }
  53792. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53793. if (options.name) {
  53794. options.components[options.name] = Ctor;
  53795. }
  53796. }
  53797. }
  53798. return options
  53799. }
  53800. function resolveModifiedOptions (Ctor) {
  53801. var modified;
  53802. var latest = Ctor.options;
  53803. var sealed = Ctor.sealedOptions;
  53804. for (var key in latest) {
  53805. if (latest[key] !== sealed[key]) {
  53806. if (!modified) { modified = {}; }
  53807. modified[key] = latest[key];
  53808. }
  53809. }
  53810. return modified
  53811. }
  53812. function Vue (options) {
  53813. if (!(this instanceof Vue)
  53814. ) {
  53815. warn('Vue is a constructor and should be called with the `new` keyword');
  53816. }
  53817. this._init(options);
  53818. }
  53819. initMixin(Vue);
  53820. stateMixin(Vue);
  53821. eventsMixin(Vue);
  53822. lifecycleMixin(Vue);
  53823. renderMixin(Vue);
  53824. /* */
  53825. function initUse (Vue) {
  53826. Vue.use = function (plugin) {
  53827. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53828. if (installedPlugins.indexOf(plugin) > -1) {
  53829. return this
  53830. }
  53831. // additional parameters
  53832. var args = toArray(arguments, 1);
  53833. args.unshift(this);
  53834. if (typeof plugin.install === 'function') {
  53835. plugin.install.apply(plugin, args);
  53836. } else if (typeof plugin === 'function') {
  53837. plugin.apply(null, args);
  53838. }
  53839. installedPlugins.push(plugin);
  53840. return this
  53841. };
  53842. }
  53843. /* */
  53844. function initMixin$1 (Vue) {
  53845. Vue.mixin = function (mixin) {
  53846. this.options = mergeOptions(this.options, mixin);
  53847. return this
  53848. };
  53849. }
  53850. /* */
  53851. function initExtend (Vue) {
  53852. /**
  53853. * Each instance constructor, including Vue, has a unique
  53854. * cid. This enables us to create wrapped "child
  53855. * constructors" for prototypal inheritance and cache them.
  53856. */
  53857. Vue.cid = 0;
  53858. var cid = 1;
  53859. /**
  53860. * Class inheritance
  53861. */
  53862. Vue.extend = function (extendOptions) {
  53863. extendOptions = extendOptions || {};
  53864. var Super = this;
  53865. var SuperId = Super.cid;
  53866. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53867. if (cachedCtors[SuperId]) {
  53868. return cachedCtors[SuperId]
  53869. }
  53870. var name = extendOptions.name || Super.options.name;
  53871. if (name) {
  53872. validateComponentName(name);
  53873. }
  53874. var Sub = function VueComponent (options) {
  53875. this._init(options);
  53876. };
  53877. Sub.prototype = Object.create(Super.prototype);
  53878. Sub.prototype.constructor = Sub;
  53879. Sub.cid = cid++;
  53880. Sub.options = mergeOptions(
  53881. Super.options,
  53882. extendOptions
  53883. );
  53884. Sub['super'] = Super;
  53885. // For props and computed properties, we define the proxy getters on
  53886. // the Vue instances at extension time, on the extended prototype. This
  53887. // avoids Object.defineProperty calls for each instance created.
  53888. if (Sub.options.props) {
  53889. initProps$1(Sub);
  53890. }
  53891. if (Sub.options.computed) {
  53892. initComputed$1(Sub);
  53893. }
  53894. // allow further extension/mixin/plugin usage
  53895. Sub.extend = Super.extend;
  53896. Sub.mixin = Super.mixin;
  53897. Sub.use = Super.use;
  53898. // create asset registers, so extended classes
  53899. // can have their private assets too.
  53900. ASSET_TYPES.forEach(function (type) {
  53901. Sub[type] = Super[type];
  53902. });
  53903. // enable recursive self-lookup
  53904. if (name) {
  53905. Sub.options.components[name] = Sub;
  53906. }
  53907. // keep a reference to the super options at extension time.
  53908. // later at instantiation we can check if Super's options have
  53909. // been updated.
  53910. Sub.superOptions = Super.options;
  53911. Sub.extendOptions = extendOptions;
  53912. Sub.sealedOptions = extend({}, Sub.options);
  53913. // cache constructor
  53914. cachedCtors[SuperId] = Sub;
  53915. return Sub
  53916. };
  53917. }
  53918. function initProps$1 (Comp) {
  53919. var props = Comp.options.props;
  53920. for (var key in props) {
  53921. proxy(Comp.prototype, "_props", key);
  53922. }
  53923. }
  53924. function initComputed$1 (Comp) {
  53925. var computed = Comp.options.computed;
  53926. for (var key in computed) {
  53927. defineComputed(Comp.prototype, key, computed[key]);
  53928. }
  53929. }
  53930. /* */
  53931. function initAssetRegisters (Vue) {
  53932. /**
  53933. * Create asset registration methods.
  53934. */
  53935. ASSET_TYPES.forEach(function (type) {
  53936. Vue[type] = function (
  53937. id,
  53938. definition
  53939. ) {
  53940. if (!definition) {
  53941. return this.options[type + 's'][id]
  53942. } else {
  53943. /* istanbul ignore if */
  53944. if (type === 'component') {
  53945. validateComponentName(id);
  53946. }
  53947. if (type === 'component' && isPlainObject(definition)) {
  53948. definition.name = definition.name || id;
  53949. definition = this.options._base.extend(definition);
  53950. }
  53951. if (type === 'directive' && typeof definition === 'function') {
  53952. definition = { bind: definition, update: definition };
  53953. }
  53954. this.options[type + 's'][id] = definition;
  53955. return definition
  53956. }
  53957. };
  53958. });
  53959. }
  53960. /* */
  53961. function getComponentName (opts) {
  53962. return opts && (opts.Ctor.options.name || opts.tag)
  53963. }
  53964. function matches (pattern, name) {
  53965. if (Array.isArray(pattern)) {
  53966. return pattern.indexOf(name) > -1
  53967. } else if (typeof pattern === 'string') {
  53968. return pattern.split(',').indexOf(name) > -1
  53969. } else if (isRegExp(pattern)) {
  53970. return pattern.test(name)
  53971. }
  53972. /* istanbul ignore next */
  53973. return false
  53974. }
  53975. function pruneCache (keepAliveInstance, filter) {
  53976. var cache = keepAliveInstance.cache;
  53977. var keys = keepAliveInstance.keys;
  53978. var _vnode = keepAliveInstance._vnode;
  53979. for (var key in cache) {
  53980. var cachedNode = cache[key];
  53981. if (cachedNode) {
  53982. var name = getComponentName(cachedNode.componentOptions);
  53983. if (name && !filter(name)) {
  53984. pruneCacheEntry(cache, key, keys, _vnode);
  53985. }
  53986. }
  53987. }
  53988. }
  53989. function pruneCacheEntry (
  53990. cache,
  53991. key,
  53992. keys,
  53993. current
  53994. ) {
  53995. var cached$$1 = cache[key];
  53996. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  53997. cached$$1.componentInstance.$destroy();
  53998. }
  53999. cache[key] = null;
  54000. remove(keys, key);
  54001. }
  54002. var patternTypes = [String, RegExp, Array];
  54003. var KeepAlive = {
  54004. name: 'keep-alive',
  54005. abstract: true,
  54006. props: {
  54007. include: patternTypes,
  54008. exclude: patternTypes,
  54009. max: [String, Number]
  54010. },
  54011. created: function created () {
  54012. this.cache = Object.create(null);
  54013. this.keys = [];
  54014. },
  54015. destroyed: function destroyed () {
  54016. for (var key in this.cache) {
  54017. pruneCacheEntry(this.cache, key, this.keys);
  54018. }
  54019. },
  54020. mounted: function mounted () {
  54021. var this$1 = this;
  54022. this.$watch('include', function (val) {
  54023. pruneCache(this$1, function (name) { return matches(val, name); });
  54024. });
  54025. this.$watch('exclude', function (val) {
  54026. pruneCache(this$1, function (name) { return !matches(val, name); });
  54027. });
  54028. },
  54029. render: function render () {
  54030. var slot = this.$slots.default;
  54031. var vnode = getFirstComponentChild(slot);
  54032. var componentOptions = vnode && vnode.componentOptions;
  54033. if (componentOptions) {
  54034. // check pattern
  54035. var name = getComponentName(componentOptions);
  54036. var ref = this;
  54037. var include = ref.include;
  54038. var exclude = ref.exclude;
  54039. if (
  54040. // not included
  54041. (include && (!name || !matches(include, name))) ||
  54042. // excluded
  54043. (exclude && name && matches(exclude, name))
  54044. ) {
  54045. return vnode
  54046. }
  54047. var ref$1 = this;
  54048. var cache = ref$1.cache;
  54049. var keys = ref$1.keys;
  54050. var key = vnode.key == null
  54051. // same constructor may get registered as different local components
  54052. // so cid alone is not enough (#3269)
  54053. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54054. : vnode.key;
  54055. if (cache[key]) {
  54056. vnode.componentInstance = cache[key].componentInstance;
  54057. // make current key freshest
  54058. remove(keys, key);
  54059. keys.push(key);
  54060. } else {
  54061. cache[key] = vnode;
  54062. keys.push(key);
  54063. // prune oldest entry
  54064. if (this.max && keys.length > parseInt(this.max)) {
  54065. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54066. }
  54067. }
  54068. vnode.data.keepAlive = true;
  54069. }
  54070. return vnode || (slot && slot[0])
  54071. }
  54072. };
  54073. var builtInComponents = {
  54074. KeepAlive: KeepAlive
  54075. };
  54076. /* */
  54077. function initGlobalAPI (Vue) {
  54078. // config
  54079. var configDef = {};
  54080. configDef.get = function () { return config; };
  54081. {
  54082. configDef.set = function () {
  54083. warn(
  54084. 'Do not replace the Vue.config object, set individual fields instead.'
  54085. );
  54086. };
  54087. }
  54088. Object.defineProperty(Vue, 'config', configDef);
  54089. // exposed util methods.
  54090. // NOTE: these are not considered part of the public API - avoid relying on
  54091. // them unless you are aware of the risk.
  54092. Vue.util = {
  54093. warn: warn,
  54094. extend: extend,
  54095. mergeOptions: mergeOptions,
  54096. defineReactive: defineReactive$$1
  54097. };
  54098. Vue.set = set;
  54099. Vue.delete = del;
  54100. Vue.nextTick = nextTick;
  54101. // 2.6 explicit observable API
  54102. Vue.observable = function (obj) {
  54103. observe(obj);
  54104. return obj
  54105. };
  54106. Vue.options = Object.create(null);
  54107. ASSET_TYPES.forEach(function (type) {
  54108. Vue.options[type + 's'] = Object.create(null);
  54109. });
  54110. // this is used to identify the "base" constructor to extend all plain-object
  54111. // components with in Weex's multi-instance scenarios.
  54112. Vue.options._base = Vue;
  54113. extend(Vue.options.components, builtInComponents);
  54114. initUse(Vue);
  54115. initMixin$1(Vue);
  54116. initExtend(Vue);
  54117. initAssetRegisters(Vue);
  54118. }
  54119. initGlobalAPI(Vue);
  54120. Object.defineProperty(Vue.prototype, '$isServer', {
  54121. get: isServerRendering
  54122. });
  54123. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54124. get: function get () {
  54125. /* istanbul ignore next */
  54126. return this.$vnode && this.$vnode.ssrContext
  54127. }
  54128. });
  54129. // expose FunctionalRenderContext for ssr runtime helper installation
  54130. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54131. value: FunctionalRenderContext
  54132. });
  54133. Vue.version = '2.6.11';
  54134. /* */
  54135. // these are reserved for web because they are directly compiled away
  54136. // during template compilation
  54137. var isReservedAttr = makeMap('style,class');
  54138. // attributes that should be using props for binding
  54139. var acceptValue = makeMap('input,textarea,option,select,progress');
  54140. var mustUseProp = function (tag, type, attr) {
  54141. return (
  54142. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54143. (attr === 'selected' && tag === 'option') ||
  54144. (attr === 'checked' && tag === 'input') ||
  54145. (attr === 'muted' && tag === 'video')
  54146. )
  54147. };
  54148. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54149. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54150. var convertEnumeratedValue = function (key, value) {
  54151. return isFalsyAttrValue(value) || value === 'false'
  54152. ? 'false'
  54153. // allow arbitrary string value for contenteditable
  54154. : key === 'contenteditable' && isValidContentEditableValue(value)
  54155. ? value
  54156. : 'true'
  54157. };
  54158. var isBooleanAttr = makeMap(
  54159. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54160. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54161. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54162. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54163. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54164. 'truespeed,typemustmatch,visible'
  54165. );
  54166. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54167. var isXlink = function (name) {
  54168. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54169. };
  54170. var getXlinkProp = function (name) {
  54171. return isXlink(name) ? name.slice(6, name.length) : ''
  54172. };
  54173. var isFalsyAttrValue = function (val) {
  54174. return val == null || val === false
  54175. };
  54176. /* */
  54177. function genClassForVnode (vnode) {
  54178. var data = vnode.data;
  54179. var parentNode = vnode;
  54180. var childNode = vnode;
  54181. while (isDef(childNode.componentInstance)) {
  54182. childNode = childNode.componentInstance._vnode;
  54183. if (childNode && childNode.data) {
  54184. data = mergeClassData(childNode.data, data);
  54185. }
  54186. }
  54187. while (isDef(parentNode = parentNode.parent)) {
  54188. if (parentNode && parentNode.data) {
  54189. data = mergeClassData(data, parentNode.data);
  54190. }
  54191. }
  54192. return renderClass(data.staticClass, data.class)
  54193. }
  54194. function mergeClassData (child, parent) {
  54195. return {
  54196. staticClass: concat(child.staticClass, parent.staticClass),
  54197. class: isDef(child.class)
  54198. ? [child.class, parent.class]
  54199. : parent.class
  54200. }
  54201. }
  54202. function renderClass (
  54203. staticClass,
  54204. dynamicClass
  54205. ) {
  54206. if (isDef(staticClass) || isDef(dynamicClass)) {
  54207. return concat(staticClass, stringifyClass(dynamicClass))
  54208. }
  54209. /* istanbul ignore next */
  54210. return ''
  54211. }
  54212. function concat (a, b) {
  54213. return a ? b ? (a + ' ' + b) : a : (b || '')
  54214. }
  54215. function stringifyClass (value) {
  54216. if (Array.isArray(value)) {
  54217. return stringifyArray(value)
  54218. }
  54219. if (isObject(value)) {
  54220. return stringifyObject(value)
  54221. }
  54222. if (typeof value === 'string') {
  54223. return value
  54224. }
  54225. /* istanbul ignore next */
  54226. return ''
  54227. }
  54228. function stringifyArray (value) {
  54229. var res = '';
  54230. var stringified;
  54231. for (var i = 0, l = value.length; i < l; i++) {
  54232. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54233. if (res) { res += ' '; }
  54234. res += stringified;
  54235. }
  54236. }
  54237. return res
  54238. }
  54239. function stringifyObject (value) {
  54240. var res = '';
  54241. for (var key in value) {
  54242. if (value[key]) {
  54243. if (res) { res += ' '; }
  54244. res += key;
  54245. }
  54246. }
  54247. return res
  54248. }
  54249. /* */
  54250. var namespaceMap = {
  54251. svg: 'http://www.w3.org/2000/svg',
  54252. math: 'http://www.w3.org/1998/Math/MathML'
  54253. };
  54254. var isHTMLTag = makeMap(
  54255. 'html,body,base,head,link,meta,style,title,' +
  54256. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54257. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54258. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54259. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54260. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54261. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54262. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54263. 'output,progress,select,textarea,' +
  54264. 'details,dialog,menu,menuitem,summary,' +
  54265. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54266. );
  54267. // this map is intentionally selective, only covering SVG elements that may
  54268. // contain child elements.
  54269. var isSVG = makeMap(
  54270. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54271. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54272. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54273. true
  54274. );
  54275. var isPreTag = function (tag) { return tag === 'pre'; };
  54276. var isReservedTag = function (tag) {
  54277. return isHTMLTag(tag) || isSVG(tag)
  54278. };
  54279. function getTagNamespace (tag) {
  54280. if (isSVG(tag)) {
  54281. return 'svg'
  54282. }
  54283. // basic support for MathML
  54284. // note it doesn't support other MathML elements being component roots
  54285. if (tag === 'math') {
  54286. return 'math'
  54287. }
  54288. }
  54289. var unknownElementCache = Object.create(null);
  54290. function isUnknownElement (tag) {
  54291. /* istanbul ignore if */
  54292. if (!inBrowser) {
  54293. return true
  54294. }
  54295. if (isReservedTag(tag)) {
  54296. return false
  54297. }
  54298. tag = tag.toLowerCase();
  54299. /* istanbul ignore if */
  54300. if (unknownElementCache[tag] != null) {
  54301. return unknownElementCache[tag]
  54302. }
  54303. var el = document.createElement(tag);
  54304. if (tag.indexOf('-') > -1) {
  54305. // http://stackoverflow.com/a/28210364/1070244
  54306. return (unknownElementCache[tag] = (
  54307. el.constructor === window.HTMLUnknownElement ||
  54308. el.constructor === window.HTMLElement
  54309. ))
  54310. } else {
  54311. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54312. }
  54313. }
  54314. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54315. /* */
  54316. /**
  54317. * Query an element selector if it's not an element already.
  54318. */
  54319. function query (el) {
  54320. if (typeof el === 'string') {
  54321. var selected = document.querySelector(el);
  54322. if (!selected) {
  54323. warn(
  54324. 'Cannot find element: ' + el
  54325. );
  54326. return document.createElement('div')
  54327. }
  54328. return selected
  54329. } else {
  54330. return el
  54331. }
  54332. }
  54333. /* */
  54334. function createElement$1 (tagName, vnode) {
  54335. var elm = document.createElement(tagName);
  54336. if (tagName !== 'select') {
  54337. return elm
  54338. }
  54339. // false or null will remove the attribute but undefined will not
  54340. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54341. elm.setAttribute('multiple', 'multiple');
  54342. }
  54343. return elm
  54344. }
  54345. function createElementNS (namespace, tagName) {
  54346. return document.createElementNS(namespaceMap[namespace], tagName)
  54347. }
  54348. function createTextNode (text) {
  54349. return document.createTextNode(text)
  54350. }
  54351. function createComment (text) {
  54352. return document.createComment(text)
  54353. }
  54354. function insertBefore (parentNode, newNode, referenceNode) {
  54355. parentNode.insertBefore(newNode, referenceNode);
  54356. }
  54357. function removeChild (node, child) {
  54358. node.removeChild(child);
  54359. }
  54360. function appendChild (node, child) {
  54361. node.appendChild(child);
  54362. }
  54363. function parentNode (node) {
  54364. return node.parentNode
  54365. }
  54366. function nextSibling (node) {
  54367. return node.nextSibling
  54368. }
  54369. function tagName (node) {
  54370. return node.tagName
  54371. }
  54372. function setTextContent (node, text) {
  54373. node.textContent = text;
  54374. }
  54375. function setStyleScope (node, scopeId) {
  54376. node.setAttribute(scopeId, '');
  54377. }
  54378. var nodeOps = /*#__PURE__*/Object.freeze({
  54379. createElement: createElement$1,
  54380. createElementNS: createElementNS,
  54381. createTextNode: createTextNode,
  54382. createComment: createComment,
  54383. insertBefore: insertBefore,
  54384. removeChild: removeChild,
  54385. appendChild: appendChild,
  54386. parentNode: parentNode,
  54387. nextSibling: nextSibling,
  54388. tagName: tagName,
  54389. setTextContent: setTextContent,
  54390. setStyleScope: setStyleScope
  54391. });
  54392. /* */
  54393. var ref = {
  54394. create: function create (_, vnode) {
  54395. registerRef(vnode);
  54396. },
  54397. update: function update (oldVnode, vnode) {
  54398. if (oldVnode.data.ref !== vnode.data.ref) {
  54399. registerRef(oldVnode, true);
  54400. registerRef(vnode);
  54401. }
  54402. },
  54403. destroy: function destroy (vnode) {
  54404. registerRef(vnode, true);
  54405. }
  54406. };
  54407. function registerRef (vnode, isRemoval) {
  54408. var key = vnode.data.ref;
  54409. if (!isDef(key)) { return }
  54410. var vm = vnode.context;
  54411. var ref = vnode.componentInstance || vnode.elm;
  54412. var refs = vm.$refs;
  54413. if (isRemoval) {
  54414. if (Array.isArray(refs[key])) {
  54415. remove(refs[key], ref);
  54416. } else if (refs[key] === ref) {
  54417. refs[key] = undefined;
  54418. }
  54419. } else {
  54420. if (vnode.data.refInFor) {
  54421. if (!Array.isArray(refs[key])) {
  54422. refs[key] = [ref];
  54423. } else if (refs[key].indexOf(ref) < 0) {
  54424. // $flow-disable-line
  54425. refs[key].push(ref);
  54426. }
  54427. } else {
  54428. refs[key] = ref;
  54429. }
  54430. }
  54431. }
  54432. /**
  54433. * Virtual DOM patching algorithm based on Snabbdom by
  54434. * Simon Friis Vindum (@paldepind)
  54435. * Licensed under the MIT License
  54436. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54437. *
  54438. * modified by Evan You (@yyx990803)
  54439. *
  54440. * Not type-checking this because this file is perf-critical and the cost
  54441. * of making flow understand it is not worth it.
  54442. */
  54443. var emptyNode = new VNode('', {}, []);
  54444. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54445. function sameVnode (a, b) {
  54446. return (
  54447. a.key === b.key && (
  54448. (
  54449. a.tag === b.tag &&
  54450. a.isComment === b.isComment &&
  54451. isDef(a.data) === isDef(b.data) &&
  54452. sameInputType(a, b)
  54453. ) || (
  54454. isTrue(a.isAsyncPlaceholder) &&
  54455. a.asyncFactory === b.asyncFactory &&
  54456. isUndef(b.asyncFactory.error)
  54457. )
  54458. )
  54459. )
  54460. }
  54461. function sameInputType (a, b) {
  54462. if (a.tag !== 'input') { return true }
  54463. var i;
  54464. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54465. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54466. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54467. }
  54468. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54469. var i, key;
  54470. var map = {};
  54471. for (i = beginIdx; i <= endIdx; ++i) {
  54472. key = children[i].key;
  54473. if (isDef(key)) { map[key] = i; }
  54474. }
  54475. return map
  54476. }
  54477. function createPatchFunction (backend) {
  54478. var i, j;
  54479. var cbs = {};
  54480. var modules = backend.modules;
  54481. var nodeOps = backend.nodeOps;
  54482. for (i = 0; i < hooks.length; ++i) {
  54483. cbs[hooks[i]] = [];
  54484. for (j = 0; j < modules.length; ++j) {
  54485. if (isDef(modules[j][hooks[i]])) {
  54486. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54487. }
  54488. }
  54489. }
  54490. function emptyNodeAt (elm) {
  54491. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54492. }
  54493. function createRmCb (childElm, listeners) {
  54494. function remove$$1 () {
  54495. if (--remove$$1.listeners === 0) {
  54496. removeNode(childElm);
  54497. }
  54498. }
  54499. remove$$1.listeners = listeners;
  54500. return remove$$1
  54501. }
  54502. function removeNode (el) {
  54503. var parent = nodeOps.parentNode(el);
  54504. // element may have already been removed due to v-html / v-text
  54505. if (isDef(parent)) {
  54506. nodeOps.removeChild(parent, el);
  54507. }
  54508. }
  54509. function isUnknownElement$$1 (vnode, inVPre) {
  54510. return (
  54511. !inVPre &&
  54512. !vnode.ns &&
  54513. !(
  54514. config.ignoredElements.length &&
  54515. config.ignoredElements.some(function (ignore) {
  54516. return isRegExp(ignore)
  54517. ? ignore.test(vnode.tag)
  54518. : ignore === vnode.tag
  54519. })
  54520. ) &&
  54521. config.isUnknownElement(vnode.tag)
  54522. )
  54523. }
  54524. var creatingElmInVPre = 0;
  54525. function createElm (
  54526. vnode,
  54527. insertedVnodeQueue,
  54528. parentElm,
  54529. refElm,
  54530. nested,
  54531. ownerArray,
  54532. index
  54533. ) {
  54534. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54535. // This vnode was used in a previous render!
  54536. // now it's used as a new node, overwriting its elm would cause
  54537. // potential patch errors down the road when it's used as an insertion
  54538. // reference node. Instead, we clone the node on-demand before creating
  54539. // associated DOM element for it.
  54540. vnode = ownerArray[index] = cloneVNode(vnode);
  54541. }
  54542. vnode.isRootInsert = !nested; // for transition enter check
  54543. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54544. return
  54545. }
  54546. var data = vnode.data;
  54547. var children = vnode.children;
  54548. var tag = vnode.tag;
  54549. if (isDef(tag)) {
  54550. {
  54551. if (data && data.pre) {
  54552. creatingElmInVPre++;
  54553. }
  54554. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54555. warn(
  54556. 'Unknown custom element: <' + tag + '> - did you ' +
  54557. 'register the component correctly? For recursive components, ' +
  54558. 'make sure to provide the "name" option.',
  54559. vnode.context
  54560. );
  54561. }
  54562. }
  54563. vnode.elm = vnode.ns
  54564. ? nodeOps.createElementNS(vnode.ns, tag)
  54565. : nodeOps.createElement(tag, vnode);
  54566. setScope(vnode);
  54567. /* istanbul ignore if */
  54568. {
  54569. createChildren(vnode, children, insertedVnodeQueue);
  54570. if (isDef(data)) {
  54571. invokeCreateHooks(vnode, insertedVnodeQueue);
  54572. }
  54573. insert(parentElm, vnode.elm, refElm);
  54574. }
  54575. if (data && data.pre) {
  54576. creatingElmInVPre--;
  54577. }
  54578. } else if (isTrue(vnode.isComment)) {
  54579. vnode.elm = nodeOps.createComment(vnode.text);
  54580. insert(parentElm, vnode.elm, refElm);
  54581. } else {
  54582. vnode.elm = nodeOps.createTextNode(vnode.text);
  54583. insert(parentElm, vnode.elm, refElm);
  54584. }
  54585. }
  54586. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54587. var i = vnode.data;
  54588. if (isDef(i)) {
  54589. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54590. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54591. i(vnode, false /* hydrating */);
  54592. }
  54593. // after calling the init hook, if the vnode is a child component
  54594. // it should've created a child instance and mounted it. the child
  54595. // component also has set the placeholder vnode's elm.
  54596. // in that case we can just return the element and be done.
  54597. if (isDef(vnode.componentInstance)) {
  54598. initComponent(vnode, insertedVnodeQueue);
  54599. insert(parentElm, vnode.elm, refElm);
  54600. if (isTrue(isReactivated)) {
  54601. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54602. }
  54603. return true
  54604. }
  54605. }
  54606. }
  54607. function initComponent (vnode, insertedVnodeQueue) {
  54608. if (isDef(vnode.data.pendingInsert)) {
  54609. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54610. vnode.data.pendingInsert = null;
  54611. }
  54612. vnode.elm = vnode.componentInstance.$el;
  54613. if (isPatchable(vnode)) {
  54614. invokeCreateHooks(vnode, insertedVnodeQueue);
  54615. setScope(vnode);
  54616. } else {
  54617. // empty component root.
  54618. // skip all element-related modules except for ref (#3455)
  54619. registerRef(vnode);
  54620. // make sure to invoke the insert hook
  54621. insertedVnodeQueue.push(vnode);
  54622. }
  54623. }
  54624. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54625. var i;
  54626. // hack for #4339: a reactivated component with inner transition
  54627. // does not trigger because the inner node's created hooks are not called
  54628. // again. It's not ideal to involve module-specific logic in here but
  54629. // there doesn't seem to be a better way to do it.
  54630. var innerNode = vnode;
  54631. while (innerNode.componentInstance) {
  54632. innerNode = innerNode.componentInstance._vnode;
  54633. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54634. for (i = 0; i < cbs.activate.length; ++i) {
  54635. cbs.activate[i](emptyNode, innerNode);
  54636. }
  54637. insertedVnodeQueue.push(innerNode);
  54638. break
  54639. }
  54640. }
  54641. // unlike a newly created component,
  54642. // a reactivated keep-alive component doesn't insert itself
  54643. insert(parentElm, vnode.elm, refElm);
  54644. }
  54645. function insert (parent, elm, ref$$1) {
  54646. if (isDef(parent)) {
  54647. if (isDef(ref$$1)) {
  54648. if (nodeOps.parentNode(ref$$1) === parent) {
  54649. nodeOps.insertBefore(parent, elm, ref$$1);
  54650. }
  54651. } else {
  54652. nodeOps.appendChild(parent, elm);
  54653. }
  54654. }
  54655. }
  54656. function createChildren (vnode, children, insertedVnodeQueue) {
  54657. if (Array.isArray(children)) {
  54658. {
  54659. checkDuplicateKeys(children);
  54660. }
  54661. for (var i = 0; i < children.length; ++i) {
  54662. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54663. }
  54664. } else if (isPrimitive(vnode.text)) {
  54665. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54666. }
  54667. }
  54668. function isPatchable (vnode) {
  54669. while (vnode.componentInstance) {
  54670. vnode = vnode.componentInstance._vnode;
  54671. }
  54672. return isDef(vnode.tag)
  54673. }
  54674. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54675. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54676. cbs.create[i$1](emptyNode, vnode);
  54677. }
  54678. i = vnode.data.hook; // Reuse variable
  54679. if (isDef(i)) {
  54680. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54681. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54682. }
  54683. }
  54684. // set scope id attribute for scoped CSS.
  54685. // this is implemented as a special case to avoid the overhead
  54686. // of going through the normal attribute patching process.
  54687. function setScope (vnode) {
  54688. var i;
  54689. if (isDef(i = vnode.fnScopeId)) {
  54690. nodeOps.setStyleScope(vnode.elm, i);
  54691. } else {
  54692. var ancestor = vnode;
  54693. while (ancestor) {
  54694. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54695. nodeOps.setStyleScope(vnode.elm, i);
  54696. }
  54697. ancestor = ancestor.parent;
  54698. }
  54699. }
  54700. // for slot content they should also get the scopeId from the host instance.
  54701. if (isDef(i = activeInstance) &&
  54702. i !== vnode.context &&
  54703. i !== vnode.fnContext &&
  54704. isDef(i = i.$options._scopeId)
  54705. ) {
  54706. nodeOps.setStyleScope(vnode.elm, i);
  54707. }
  54708. }
  54709. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54710. for (; startIdx <= endIdx; ++startIdx) {
  54711. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54712. }
  54713. }
  54714. function invokeDestroyHook (vnode) {
  54715. var i, j;
  54716. var data = vnode.data;
  54717. if (isDef(data)) {
  54718. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54719. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54720. }
  54721. if (isDef(i = vnode.children)) {
  54722. for (j = 0; j < vnode.children.length; ++j) {
  54723. invokeDestroyHook(vnode.children[j]);
  54724. }
  54725. }
  54726. }
  54727. function removeVnodes (vnodes, startIdx, endIdx) {
  54728. for (; startIdx <= endIdx; ++startIdx) {
  54729. var ch = vnodes[startIdx];
  54730. if (isDef(ch)) {
  54731. if (isDef(ch.tag)) {
  54732. removeAndInvokeRemoveHook(ch);
  54733. invokeDestroyHook(ch);
  54734. } else { // Text node
  54735. removeNode(ch.elm);
  54736. }
  54737. }
  54738. }
  54739. }
  54740. function removeAndInvokeRemoveHook (vnode, rm) {
  54741. if (isDef(rm) || isDef(vnode.data)) {
  54742. var i;
  54743. var listeners = cbs.remove.length + 1;
  54744. if (isDef(rm)) {
  54745. // we have a recursively passed down rm callback
  54746. // increase the listeners count
  54747. rm.listeners += listeners;
  54748. } else {
  54749. // directly removing
  54750. rm = createRmCb(vnode.elm, listeners);
  54751. }
  54752. // recursively invoke hooks on child component root node
  54753. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54754. removeAndInvokeRemoveHook(i, rm);
  54755. }
  54756. for (i = 0; i < cbs.remove.length; ++i) {
  54757. cbs.remove[i](vnode, rm);
  54758. }
  54759. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54760. i(vnode, rm);
  54761. } else {
  54762. rm();
  54763. }
  54764. } else {
  54765. removeNode(vnode.elm);
  54766. }
  54767. }
  54768. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54769. var oldStartIdx = 0;
  54770. var newStartIdx = 0;
  54771. var oldEndIdx = oldCh.length - 1;
  54772. var oldStartVnode = oldCh[0];
  54773. var oldEndVnode = oldCh[oldEndIdx];
  54774. var newEndIdx = newCh.length - 1;
  54775. var newStartVnode = newCh[0];
  54776. var newEndVnode = newCh[newEndIdx];
  54777. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54778. // removeOnly is a special flag used only by <transition-group>
  54779. // to ensure removed elements stay in correct relative positions
  54780. // during leaving transitions
  54781. var canMove = !removeOnly;
  54782. {
  54783. checkDuplicateKeys(newCh);
  54784. }
  54785. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54786. if (isUndef(oldStartVnode)) {
  54787. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54788. } else if (isUndef(oldEndVnode)) {
  54789. oldEndVnode = oldCh[--oldEndIdx];
  54790. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54791. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54792. oldStartVnode = oldCh[++oldStartIdx];
  54793. newStartVnode = newCh[++newStartIdx];
  54794. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54795. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54796. oldEndVnode = oldCh[--oldEndIdx];
  54797. newEndVnode = newCh[--newEndIdx];
  54798. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54799. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54800. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54801. oldStartVnode = oldCh[++oldStartIdx];
  54802. newEndVnode = newCh[--newEndIdx];
  54803. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54804. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54805. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54806. oldEndVnode = oldCh[--oldEndIdx];
  54807. newStartVnode = newCh[++newStartIdx];
  54808. } else {
  54809. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54810. idxInOld = isDef(newStartVnode.key)
  54811. ? oldKeyToIdx[newStartVnode.key]
  54812. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54813. if (isUndef(idxInOld)) { // New element
  54814. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54815. } else {
  54816. vnodeToMove = oldCh[idxInOld];
  54817. if (sameVnode(vnodeToMove, newStartVnode)) {
  54818. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54819. oldCh[idxInOld] = undefined;
  54820. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54821. } else {
  54822. // same key but different element. treat as new element
  54823. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54824. }
  54825. }
  54826. newStartVnode = newCh[++newStartIdx];
  54827. }
  54828. }
  54829. if (oldStartIdx > oldEndIdx) {
  54830. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54831. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54832. } else if (newStartIdx > newEndIdx) {
  54833. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54834. }
  54835. }
  54836. function checkDuplicateKeys (children) {
  54837. var seenKeys = {};
  54838. for (var i = 0; i < children.length; i++) {
  54839. var vnode = children[i];
  54840. var key = vnode.key;
  54841. if (isDef(key)) {
  54842. if (seenKeys[key]) {
  54843. warn(
  54844. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54845. vnode.context
  54846. );
  54847. } else {
  54848. seenKeys[key] = true;
  54849. }
  54850. }
  54851. }
  54852. }
  54853. function findIdxInOld (node, oldCh, start, end) {
  54854. for (var i = start; i < end; i++) {
  54855. var c = oldCh[i];
  54856. if (isDef(c) && sameVnode(node, c)) { return i }
  54857. }
  54858. }
  54859. function patchVnode (
  54860. oldVnode,
  54861. vnode,
  54862. insertedVnodeQueue,
  54863. ownerArray,
  54864. index,
  54865. removeOnly
  54866. ) {
  54867. if (oldVnode === vnode) {
  54868. return
  54869. }
  54870. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54871. // clone reused vnode
  54872. vnode = ownerArray[index] = cloneVNode(vnode);
  54873. }
  54874. var elm = vnode.elm = oldVnode.elm;
  54875. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54876. if (isDef(vnode.asyncFactory.resolved)) {
  54877. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54878. } else {
  54879. vnode.isAsyncPlaceholder = true;
  54880. }
  54881. return
  54882. }
  54883. // reuse element for static trees.
  54884. // note we only do this if the vnode is cloned -
  54885. // if the new node is not cloned it means the render functions have been
  54886. // reset by the hot-reload-api and we need to do a proper re-render.
  54887. if (isTrue(vnode.isStatic) &&
  54888. isTrue(oldVnode.isStatic) &&
  54889. vnode.key === oldVnode.key &&
  54890. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54891. ) {
  54892. vnode.componentInstance = oldVnode.componentInstance;
  54893. return
  54894. }
  54895. var i;
  54896. var data = vnode.data;
  54897. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  54898. i(oldVnode, vnode);
  54899. }
  54900. var oldCh = oldVnode.children;
  54901. var ch = vnode.children;
  54902. if (isDef(data) && isPatchable(vnode)) {
  54903. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  54904. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  54905. }
  54906. if (isUndef(vnode.text)) {
  54907. if (isDef(oldCh) && isDef(ch)) {
  54908. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  54909. } else if (isDef(ch)) {
  54910. {
  54911. checkDuplicateKeys(ch);
  54912. }
  54913. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  54914. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  54915. } else if (isDef(oldCh)) {
  54916. removeVnodes(oldCh, 0, oldCh.length - 1);
  54917. } else if (isDef(oldVnode.text)) {
  54918. nodeOps.setTextContent(elm, '');
  54919. }
  54920. } else if (oldVnode.text !== vnode.text) {
  54921. nodeOps.setTextContent(elm, vnode.text);
  54922. }
  54923. if (isDef(data)) {
  54924. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  54925. }
  54926. }
  54927. function invokeInsertHook (vnode, queue, initial) {
  54928. // delay insert hooks for component root nodes, invoke them after the
  54929. // element is really inserted
  54930. if (isTrue(initial) && isDef(vnode.parent)) {
  54931. vnode.parent.data.pendingInsert = queue;
  54932. } else {
  54933. for (var i = 0; i < queue.length; ++i) {
  54934. queue[i].data.hook.insert(queue[i]);
  54935. }
  54936. }
  54937. }
  54938. var hydrationBailed = false;
  54939. // list of modules that can skip create hook during hydration because they
  54940. // are already rendered on the client or has no need for initialization
  54941. // Note: style is excluded because it relies on initial clone for future
  54942. // deep updates (#7063).
  54943. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  54944. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  54945. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  54946. var i;
  54947. var tag = vnode.tag;
  54948. var data = vnode.data;
  54949. var children = vnode.children;
  54950. inVPre = inVPre || (data && data.pre);
  54951. vnode.elm = elm;
  54952. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  54953. vnode.isAsyncPlaceholder = true;
  54954. return true
  54955. }
  54956. // assert node match
  54957. {
  54958. if (!assertNodeMatch(elm, vnode, inVPre)) {
  54959. return false
  54960. }
  54961. }
  54962. if (isDef(data)) {
  54963. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  54964. if (isDef(i = vnode.componentInstance)) {
  54965. // child component. it should have hydrated its own tree.
  54966. initComponent(vnode, insertedVnodeQueue);
  54967. return true
  54968. }
  54969. }
  54970. if (isDef(tag)) {
  54971. if (isDef(children)) {
  54972. // empty element, allow client to pick up and populate children
  54973. if (!elm.hasChildNodes()) {
  54974. createChildren(vnode, children, insertedVnodeQueue);
  54975. } else {
  54976. // v-html and domProps: innerHTML
  54977. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  54978. if (i !== elm.innerHTML) {
  54979. /* istanbul ignore if */
  54980. if (typeof console !== 'undefined' &&
  54981. !hydrationBailed
  54982. ) {
  54983. hydrationBailed = true;
  54984. console.warn('Parent: ', elm);
  54985. console.warn('server innerHTML: ', i);
  54986. console.warn('client innerHTML: ', elm.innerHTML);
  54987. }
  54988. return false
  54989. }
  54990. } else {
  54991. // iterate and compare children lists
  54992. var childrenMatch = true;
  54993. var childNode = elm.firstChild;
  54994. for (var i$1 = 0; i$1 < children.length; i$1++) {
  54995. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  54996. childrenMatch = false;
  54997. break
  54998. }
  54999. childNode = childNode.nextSibling;
  55000. }
  55001. // if childNode is not null, it means the actual childNodes list is
  55002. // longer than the virtual children list.
  55003. if (!childrenMatch || childNode) {
  55004. /* istanbul ignore if */
  55005. if (typeof console !== 'undefined' &&
  55006. !hydrationBailed
  55007. ) {
  55008. hydrationBailed = true;
  55009. console.warn('Parent: ', elm);
  55010. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55011. }
  55012. return false
  55013. }
  55014. }
  55015. }
  55016. }
  55017. if (isDef(data)) {
  55018. var fullInvoke = false;
  55019. for (var key in data) {
  55020. if (!isRenderedModule(key)) {
  55021. fullInvoke = true;
  55022. invokeCreateHooks(vnode, insertedVnodeQueue);
  55023. break
  55024. }
  55025. }
  55026. if (!fullInvoke && data['class']) {
  55027. // ensure collecting deps for deep class bindings for future updates
  55028. traverse(data['class']);
  55029. }
  55030. }
  55031. } else if (elm.data !== vnode.text) {
  55032. elm.data = vnode.text;
  55033. }
  55034. return true
  55035. }
  55036. function assertNodeMatch (node, vnode, inVPre) {
  55037. if (isDef(vnode.tag)) {
  55038. return vnode.tag.indexOf('vue-component') === 0 || (
  55039. !isUnknownElement$$1(vnode, inVPre) &&
  55040. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55041. )
  55042. } else {
  55043. return node.nodeType === (vnode.isComment ? 8 : 3)
  55044. }
  55045. }
  55046. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55047. if (isUndef(vnode)) {
  55048. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55049. return
  55050. }
  55051. var isInitialPatch = false;
  55052. var insertedVnodeQueue = [];
  55053. if (isUndef(oldVnode)) {
  55054. // empty mount (likely as component), create new root element
  55055. isInitialPatch = true;
  55056. createElm(vnode, insertedVnodeQueue);
  55057. } else {
  55058. var isRealElement = isDef(oldVnode.nodeType);
  55059. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55060. // patch existing root node
  55061. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55062. } else {
  55063. if (isRealElement) {
  55064. // mounting to a real element
  55065. // check if this is server-rendered content and if we can perform
  55066. // a successful hydration.
  55067. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55068. oldVnode.removeAttribute(SSR_ATTR);
  55069. hydrating = true;
  55070. }
  55071. if (isTrue(hydrating)) {
  55072. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55073. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55074. return oldVnode
  55075. } else {
  55076. warn(
  55077. 'The client-side rendered virtual DOM tree is not matching ' +
  55078. 'server-rendered content. This is likely caused by incorrect ' +
  55079. 'HTML markup, for example nesting block-level elements inside ' +
  55080. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55081. 'full client-side render.'
  55082. );
  55083. }
  55084. }
  55085. // either not server-rendered, or hydration failed.
  55086. // create an empty node and replace it
  55087. oldVnode = emptyNodeAt(oldVnode);
  55088. }
  55089. // replacing existing element
  55090. var oldElm = oldVnode.elm;
  55091. var parentElm = nodeOps.parentNode(oldElm);
  55092. // create new node
  55093. createElm(
  55094. vnode,
  55095. insertedVnodeQueue,
  55096. // extremely rare edge case: do not insert if old element is in a
  55097. // leaving transition. Only happens when combining transition +
  55098. // keep-alive + HOCs. (#4590)
  55099. oldElm._leaveCb ? null : parentElm,
  55100. nodeOps.nextSibling(oldElm)
  55101. );
  55102. // update parent placeholder node element, recursively
  55103. if (isDef(vnode.parent)) {
  55104. var ancestor = vnode.parent;
  55105. var patchable = isPatchable(vnode);
  55106. while (ancestor) {
  55107. for (var i = 0; i < cbs.destroy.length; ++i) {
  55108. cbs.destroy[i](ancestor);
  55109. }
  55110. ancestor.elm = vnode.elm;
  55111. if (patchable) {
  55112. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55113. cbs.create[i$1](emptyNode, ancestor);
  55114. }
  55115. // #6513
  55116. // invoke insert hooks that may have been merged by create hooks.
  55117. // e.g. for directives that uses the "inserted" hook.
  55118. var insert = ancestor.data.hook.insert;
  55119. if (insert.merged) {
  55120. // start at index 1 to avoid re-invoking component mounted hook
  55121. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55122. insert.fns[i$2]();
  55123. }
  55124. }
  55125. } else {
  55126. registerRef(ancestor);
  55127. }
  55128. ancestor = ancestor.parent;
  55129. }
  55130. }
  55131. // destroy old node
  55132. if (isDef(parentElm)) {
  55133. removeVnodes([oldVnode], 0, 0);
  55134. } else if (isDef(oldVnode.tag)) {
  55135. invokeDestroyHook(oldVnode);
  55136. }
  55137. }
  55138. }
  55139. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55140. return vnode.elm
  55141. }
  55142. }
  55143. /* */
  55144. var directives = {
  55145. create: updateDirectives,
  55146. update: updateDirectives,
  55147. destroy: function unbindDirectives (vnode) {
  55148. updateDirectives(vnode, emptyNode);
  55149. }
  55150. };
  55151. function updateDirectives (oldVnode, vnode) {
  55152. if (oldVnode.data.directives || vnode.data.directives) {
  55153. _update(oldVnode, vnode);
  55154. }
  55155. }
  55156. function _update (oldVnode, vnode) {
  55157. var isCreate = oldVnode === emptyNode;
  55158. var isDestroy = vnode === emptyNode;
  55159. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55160. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55161. var dirsWithInsert = [];
  55162. var dirsWithPostpatch = [];
  55163. var key, oldDir, dir;
  55164. for (key in newDirs) {
  55165. oldDir = oldDirs[key];
  55166. dir = newDirs[key];
  55167. if (!oldDir) {
  55168. // new directive, bind
  55169. callHook$1(dir, 'bind', vnode, oldVnode);
  55170. if (dir.def && dir.def.inserted) {
  55171. dirsWithInsert.push(dir);
  55172. }
  55173. } else {
  55174. // existing directive, update
  55175. dir.oldValue = oldDir.value;
  55176. dir.oldArg = oldDir.arg;
  55177. callHook$1(dir, 'update', vnode, oldVnode);
  55178. if (dir.def && dir.def.componentUpdated) {
  55179. dirsWithPostpatch.push(dir);
  55180. }
  55181. }
  55182. }
  55183. if (dirsWithInsert.length) {
  55184. var callInsert = function () {
  55185. for (var i = 0; i < dirsWithInsert.length; i++) {
  55186. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55187. }
  55188. };
  55189. if (isCreate) {
  55190. mergeVNodeHook(vnode, 'insert', callInsert);
  55191. } else {
  55192. callInsert();
  55193. }
  55194. }
  55195. if (dirsWithPostpatch.length) {
  55196. mergeVNodeHook(vnode, 'postpatch', function () {
  55197. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55198. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55199. }
  55200. });
  55201. }
  55202. if (!isCreate) {
  55203. for (key in oldDirs) {
  55204. if (!newDirs[key]) {
  55205. // no longer present, unbind
  55206. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55207. }
  55208. }
  55209. }
  55210. }
  55211. var emptyModifiers = Object.create(null);
  55212. function normalizeDirectives$1 (
  55213. dirs,
  55214. vm
  55215. ) {
  55216. var res = Object.create(null);
  55217. if (!dirs) {
  55218. // $flow-disable-line
  55219. return res
  55220. }
  55221. var i, dir;
  55222. for (i = 0; i < dirs.length; i++) {
  55223. dir = dirs[i];
  55224. if (!dir.modifiers) {
  55225. // $flow-disable-line
  55226. dir.modifiers = emptyModifiers;
  55227. }
  55228. res[getRawDirName(dir)] = dir;
  55229. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55230. }
  55231. // $flow-disable-line
  55232. return res
  55233. }
  55234. function getRawDirName (dir) {
  55235. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55236. }
  55237. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55238. var fn = dir.def && dir.def[hook];
  55239. if (fn) {
  55240. try {
  55241. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55242. } catch (e) {
  55243. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55244. }
  55245. }
  55246. }
  55247. var baseModules = [
  55248. ref,
  55249. directives
  55250. ];
  55251. /* */
  55252. function updateAttrs (oldVnode, vnode) {
  55253. var opts = vnode.componentOptions;
  55254. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55255. return
  55256. }
  55257. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55258. return
  55259. }
  55260. var key, cur, old;
  55261. var elm = vnode.elm;
  55262. var oldAttrs = oldVnode.data.attrs || {};
  55263. var attrs = vnode.data.attrs || {};
  55264. // clone observed objects, as the user probably wants to mutate it
  55265. if (isDef(attrs.__ob__)) {
  55266. attrs = vnode.data.attrs = extend({}, attrs);
  55267. }
  55268. for (key in attrs) {
  55269. cur = attrs[key];
  55270. old = oldAttrs[key];
  55271. if (old !== cur) {
  55272. setAttr(elm, key, cur);
  55273. }
  55274. }
  55275. // #4391: in IE9, setting type can reset value for input[type=radio]
  55276. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55277. /* istanbul ignore if */
  55278. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55279. setAttr(elm, 'value', attrs.value);
  55280. }
  55281. for (key in oldAttrs) {
  55282. if (isUndef(attrs[key])) {
  55283. if (isXlink(key)) {
  55284. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55285. } else if (!isEnumeratedAttr(key)) {
  55286. elm.removeAttribute(key);
  55287. }
  55288. }
  55289. }
  55290. }
  55291. function setAttr (el, key, value) {
  55292. if (el.tagName.indexOf('-') > -1) {
  55293. baseSetAttr(el, key, value);
  55294. } else if (isBooleanAttr(key)) {
  55295. // set attribute for blank value
  55296. // e.g. <option disabled>Select one</option>
  55297. if (isFalsyAttrValue(value)) {
  55298. el.removeAttribute(key);
  55299. } else {
  55300. // technically allowfullscreen is a boolean attribute for <iframe>,
  55301. // but Flash expects a value of "true" when used on <embed> tag
  55302. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55303. ? 'true'
  55304. : key;
  55305. el.setAttribute(key, value);
  55306. }
  55307. } else if (isEnumeratedAttr(key)) {
  55308. el.setAttribute(key, convertEnumeratedValue(key, value));
  55309. } else if (isXlink(key)) {
  55310. if (isFalsyAttrValue(value)) {
  55311. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55312. } else {
  55313. el.setAttributeNS(xlinkNS, key, value);
  55314. }
  55315. } else {
  55316. baseSetAttr(el, key, value);
  55317. }
  55318. }
  55319. function baseSetAttr (el, key, value) {
  55320. if (isFalsyAttrValue(value)) {
  55321. el.removeAttribute(key);
  55322. } else {
  55323. // #7138: IE10 & 11 fires input event when setting placeholder on
  55324. // <textarea>... block the first input event and remove the blocker
  55325. // immediately.
  55326. /* istanbul ignore if */
  55327. if (
  55328. isIE && !isIE9 &&
  55329. el.tagName === 'TEXTAREA' &&
  55330. key === 'placeholder' && value !== '' && !el.__ieph
  55331. ) {
  55332. var blocker = function (e) {
  55333. e.stopImmediatePropagation();
  55334. el.removeEventListener('input', blocker);
  55335. };
  55336. el.addEventListener('input', blocker);
  55337. // $flow-disable-line
  55338. el.__ieph = true; /* IE placeholder patched */
  55339. }
  55340. el.setAttribute(key, value);
  55341. }
  55342. }
  55343. var attrs = {
  55344. create: updateAttrs,
  55345. update: updateAttrs
  55346. };
  55347. /* */
  55348. function updateClass (oldVnode, vnode) {
  55349. var el = vnode.elm;
  55350. var data = vnode.data;
  55351. var oldData = oldVnode.data;
  55352. if (
  55353. isUndef(data.staticClass) &&
  55354. isUndef(data.class) && (
  55355. isUndef(oldData) || (
  55356. isUndef(oldData.staticClass) &&
  55357. isUndef(oldData.class)
  55358. )
  55359. )
  55360. ) {
  55361. return
  55362. }
  55363. var cls = genClassForVnode(vnode);
  55364. // handle transition classes
  55365. var transitionClass = el._transitionClasses;
  55366. if (isDef(transitionClass)) {
  55367. cls = concat(cls, stringifyClass(transitionClass));
  55368. }
  55369. // set the class
  55370. if (cls !== el._prevClass) {
  55371. el.setAttribute('class', cls);
  55372. el._prevClass = cls;
  55373. }
  55374. }
  55375. var klass = {
  55376. create: updateClass,
  55377. update: updateClass
  55378. };
  55379. /* */
  55380. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55381. function parseFilters (exp) {
  55382. var inSingle = false;
  55383. var inDouble = false;
  55384. var inTemplateString = false;
  55385. var inRegex = false;
  55386. var curly = 0;
  55387. var square = 0;
  55388. var paren = 0;
  55389. var lastFilterIndex = 0;
  55390. var c, prev, i, expression, filters;
  55391. for (i = 0; i < exp.length; i++) {
  55392. prev = c;
  55393. c = exp.charCodeAt(i);
  55394. if (inSingle) {
  55395. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55396. } else if (inDouble) {
  55397. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55398. } else if (inTemplateString) {
  55399. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55400. } else if (inRegex) {
  55401. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55402. } else if (
  55403. c === 0x7C && // pipe
  55404. exp.charCodeAt(i + 1) !== 0x7C &&
  55405. exp.charCodeAt(i - 1) !== 0x7C &&
  55406. !curly && !square && !paren
  55407. ) {
  55408. if (expression === undefined) {
  55409. // first filter, end of expression
  55410. lastFilterIndex = i + 1;
  55411. expression = exp.slice(0, i).trim();
  55412. } else {
  55413. pushFilter();
  55414. }
  55415. } else {
  55416. switch (c) {
  55417. case 0x22: inDouble = true; break // "
  55418. case 0x27: inSingle = true; break // '
  55419. case 0x60: inTemplateString = true; break // `
  55420. case 0x28: paren++; break // (
  55421. case 0x29: paren--; break // )
  55422. case 0x5B: square++; break // [
  55423. case 0x5D: square--; break // ]
  55424. case 0x7B: curly++; break // {
  55425. case 0x7D: curly--; break // }
  55426. }
  55427. if (c === 0x2f) { // /
  55428. var j = i - 1;
  55429. var p = (void 0);
  55430. // find first non-whitespace prev char
  55431. for (; j >= 0; j--) {
  55432. p = exp.charAt(j);
  55433. if (p !== ' ') { break }
  55434. }
  55435. if (!p || !validDivisionCharRE.test(p)) {
  55436. inRegex = true;
  55437. }
  55438. }
  55439. }
  55440. }
  55441. if (expression === undefined) {
  55442. expression = exp.slice(0, i).trim();
  55443. } else if (lastFilterIndex !== 0) {
  55444. pushFilter();
  55445. }
  55446. function pushFilter () {
  55447. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55448. lastFilterIndex = i + 1;
  55449. }
  55450. if (filters) {
  55451. for (i = 0; i < filters.length; i++) {
  55452. expression = wrapFilter(expression, filters[i]);
  55453. }
  55454. }
  55455. return expression
  55456. }
  55457. function wrapFilter (exp, filter) {
  55458. var i = filter.indexOf('(');
  55459. if (i < 0) {
  55460. // _f: resolveFilter
  55461. return ("_f(\"" + filter + "\")(" + exp + ")")
  55462. } else {
  55463. var name = filter.slice(0, i);
  55464. var args = filter.slice(i + 1);
  55465. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55466. }
  55467. }
  55468. /* */
  55469. /* eslint-disable no-unused-vars */
  55470. function baseWarn (msg, range) {
  55471. console.error(("[Vue compiler]: " + msg));
  55472. }
  55473. /* eslint-enable no-unused-vars */
  55474. function pluckModuleFunction (
  55475. modules,
  55476. key
  55477. ) {
  55478. return modules
  55479. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55480. : []
  55481. }
  55482. function addProp (el, name, value, range, dynamic) {
  55483. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55484. el.plain = false;
  55485. }
  55486. function addAttr (el, name, value, range, dynamic) {
  55487. var attrs = dynamic
  55488. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55489. : (el.attrs || (el.attrs = []));
  55490. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55491. el.plain = false;
  55492. }
  55493. // add a raw attr (use this in preTransforms)
  55494. function addRawAttr (el, name, value, range) {
  55495. el.attrsMap[name] = value;
  55496. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55497. }
  55498. function addDirective (
  55499. el,
  55500. name,
  55501. rawName,
  55502. value,
  55503. arg,
  55504. isDynamicArg,
  55505. modifiers,
  55506. range
  55507. ) {
  55508. (el.directives || (el.directives = [])).push(rangeSetItem({
  55509. name: name,
  55510. rawName: rawName,
  55511. value: value,
  55512. arg: arg,
  55513. isDynamicArg: isDynamicArg,
  55514. modifiers: modifiers
  55515. }, range));
  55516. el.plain = false;
  55517. }
  55518. function prependModifierMarker (symbol, name, dynamic) {
  55519. return dynamic
  55520. ? ("_p(" + name + ",\"" + symbol + "\")")
  55521. : symbol + name // mark the event as captured
  55522. }
  55523. function addHandler (
  55524. el,
  55525. name,
  55526. value,
  55527. modifiers,
  55528. important,
  55529. warn,
  55530. range,
  55531. dynamic
  55532. ) {
  55533. modifiers = modifiers || emptyObject;
  55534. // warn prevent and passive modifier
  55535. /* istanbul ignore if */
  55536. if (
  55537. warn &&
  55538. modifiers.prevent && modifiers.passive
  55539. ) {
  55540. warn(
  55541. 'passive and prevent can\'t be used together. ' +
  55542. 'Passive handler can\'t prevent default event.',
  55543. range
  55544. );
  55545. }
  55546. // normalize click.right and click.middle since they don't actually fire
  55547. // this is technically browser-specific, but at least for now browsers are
  55548. // the only target envs that have right/middle clicks.
  55549. if (modifiers.right) {
  55550. if (dynamic) {
  55551. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55552. } else if (name === 'click') {
  55553. name = 'contextmenu';
  55554. delete modifiers.right;
  55555. }
  55556. } else if (modifiers.middle) {
  55557. if (dynamic) {
  55558. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55559. } else if (name === 'click') {
  55560. name = 'mouseup';
  55561. }
  55562. }
  55563. // check capture modifier
  55564. if (modifiers.capture) {
  55565. delete modifiers.capture;
  55566. name = prependModifierMarker('!', name, dynamic);
  55567. }
  55568. if (modifiers.once) {
  55569. delete modifiers.once;
  55570. name = prependModifierMarker('~', name, dynamic);
  55571. }
  55572. /* istanbul ignore if */
  55573. if (modifiers.passive) {
  55574. delete modifiers.passive;
  55575. name = prependModifierMarker('&', name, dynamic);
  55576. }
  55577. var events;
  55578. if (modifiers.native) {
  55579. delete modifiers.native;
  55580. events = el.nativeEvents || (el.nativeEvents = {});
  55581. } else {
  55582. events = el.events || (el.events = {});
  55583. }
  55584. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55585. if (modifiers !== emptyObject) {
  55586. newHandler.modifiers = modifiers;
  55587. }
  55588. var handlers = events[name];
  55589. /* istanbul ignore if */
  55590. if (Array.isArray(handlers)) {
  55591. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55592. } else if (handlers) {
  55593. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55594. } else {
  55595. events[name] = newHandler;
  55596. }
  55597. el.plain = false;
  55598. }
  55599. function getRawBindingAttr (
  55600. el,
  55601. name
  55602. ) {
  55603. return el.rawAttrsMap[':' + name] ||
  55604. el.rawAttrsMap['v-bind:' + name] ||
  55605. el.rawAttrsMap[name]
  55606. }
  55607. function getBindingAttr (
  55608. el,
  55609. name,
  55610. getStatic
  55611. ) {
  55612. var dynamicValue =
  55613. getAndRemoveAttr(el, ':' + name) ||
  55614. getAndRemoveAttr(el, 'v-bind:' + name);
  55615. if (dynamicValue != null) {
  55616. return parseFilters(dynamicValue)
  55617. } else if (getStatic !== false) {
  55618. var staticValue = getAndRemoveAttr(el, name);
  55619. if (staticValue != null) {
  55620. return JSON.stringify(staticValue)
  55621. }
  55622. }
  55623. }
  55624. // note: this only removes the attr from the Array (attrsList) so that it
  55625. // doesn't get processed by processAttrs.
  55626. // By default it does NOT remove it from the map (attrsMap) because the map is
  55627. // needed during codegen.
  55628. function getAndRemoveAttr (
  55629. el,
  55630. name,
  55631. removeFromMap
  55632. ) {
  55633. var val;
  55634. if ((val = el.attrsMap[name]) != null) {
  55635. var list = el.attrsList;
  55636. for (var i = 0, l = list.length; i < l; i++) {
  55637. if (list[i].name === name) {
  55638. list.splice(i, 1);
  55639. break
  55640. }
  55641. }
  55642. }
  55643. if (removeFromMap) {
  55644. delete el.attrsMap[name];
  55645. }
  55646. return val
  55647. }
  55648. function getAndRemoveAttrByRegex (
  55649. el,
  55650. name
  55651. ) {
  55652. var list = el.attrsList;
  55653. for (var i = 0, l = list.length; i < l; i++) {
  55654. var attr = list[i];
  55655. if (name.test(attr.name)) {
  55656. list.splice(i, 1);
  55657. return attr
  55658. }
  55659. }
  55660. }
  55661. function rangeSetItem (
  55662. item,
  55663. range
  55664. ) {
  55665. if (range) {
  55666. if (range.start != null) {
  55667. item.start = range.start;
  55668. }
  55669. if (range.end != null) {
  55670. item.end = range.end;
  55671. }
  55672. }
  55673. return item
  55674. }
  55675. /* */
  55676. /**
  55677. * Cross-platform code generation for component v-model
  55678. */
  55679. function genComponentModel (
  55680. el,
  55681. value,
  55682. modifiers
  55683. ) {
  55684. var ref = modifiers || {};
  55685. var number = ref.number;
  55686. var trim = ref.trim;
  55687. var baseValueExpression = '$$v';
  55688. var valueExpression = baseValueExpression;
  55689. if (trim) {
  55690. valueExpression =
  55691. "(typeof " + baseValueExpression + " === 'string'" +
  55692. "? " + baseValueExpression + ".trim()" +
  55693. ": " + baseValueExpression + ")";
  55694. }
  55695. if (number) {
  55696. valueExpression = "_n(" + valueExpression + ")";
  55697. }
  55698. var assignment = genAssignmentCode(value, valueExpression);
  55699. el.model = {
  55700. value: ("(" + value + ")"),
  55701. expression: JSON.stringify(value),
  55702. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55703. };
  55704. }
  55705. /**
  55706. * Cross-platform codegen helper for generating v-model value assignment code.
  55707. */
  55708. function genAssignmentCode (
  55709. value,
  55710. assignment
  55711. ) {
  55712. var res = parseModel(value);
  55713. if (res.key === null) {
  55714. return (value + "=" + assignment)
  55715. } else {
  55716. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55717. }
  55718. }
  55719. /**
  55720. * Parse a v-model expression into a base path and a final key segment.
  55721. * Handles both dot-path and possible square brackets.
  55722. *
  55723. * Possible cases:
  55724. *
  55725. * - test
  55726. * - test[key]
  55727. * - test[test1[key]]
  55728. * - test["a"][key]
  55729. * - xxx.test[a[a].test1[key]]
  55730. * - test.xxx.a["asa"][test1[key]]
  55731. *
  55732. */
  55733. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55734. function parseModel (val) {
  55735. // Fix https://github.com/vuejs/vue/pull/7730
  55736. // allow v-model="obj.val " (trailing whitespace)
  55737. val = val.trim();
  55738. len = val.length;
  55739. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55740. index$1 = val.lastIndexOf('.');
  55741. if (index$1 > -1) {
  55742. return {
  55743. exp: val.slice(0, index$1),
  55744. key: '"' + val.slice(index$1 + 1) + '"'
  55745. }
  55746. } else {
  55747. return {
  55748. exp: val,
  55749. key: null
  55750. }
  55751. }
  55752. }
  55753. str = val;
  55754. index$1 = expressionPos = expressionEndPos = 0;
  55755. while (!eof()) {
  55756. chr = next();
  55757. /* istanbul ignore if */
  55758. if (isStringStart(chr)) {
  55759. parseString(chr);
  55760. } else if (chr === 0x5B) {
  55761. parseBracket(chr);
  55762. }
  55763. }
  55764. return {
  55765. exp: val.slice(0, expressionPos),
  55766. key: val.slice(expressionPos + 1, expressionEndPos)
  55767. }
  55768. }
  55769. function next () {
  55770. return str.charCodeAt(++index$1)
  55771. }
  55772. function eof () {
  55773. return index$1 >= len
  55774. }
  55775. function isStringStart (chr) {
  55776. return chr === 0x22 || chr === 0x27
  55777. }
  55778. function parseBracket (chr) {
  55779. var inBracket = 1;
  55780. expressionPos = index$1;
  55781. while (!eof()) {
  55782. chr = next();
  55783. if (isStringStart(chr)) {
  55784. parseString(chr);
  55785. continue
  55786. }
  55787. if (chr === 0x5B) { inBracket++; }
  55788. if (chr === 0x5D) { inBracket--; }
  55789. if (inBracket === 0) {
  55790. expressionEndPos = index$1;
  55791. break
  55792. }
  55793. }
  55794. }
  55795. function parseString (chr) {
  55796. var stringQuote = chr;
  55797. while (!eof()) {
  55798. chr = next();
  55799. if (chr === stringQuote) {
  55800. break
  55801. }
  55802. }
  55803. }
  55804. /* */
  55805. var warn$1;
  55806. // in some cases, the event used has to be determined at runtime
  55807. // so we used some reserved tokens during compile.
  55808. var RANGE_TOKEN = '__r';
  55809. var CHECKBOX_RADIO_TOKEN = '__c';
  55810. function model (
  55811. el,
  55812. dir,
  55813. _warn
  55814. ) {
  55815. warn$1 = _warn;
  55816. var value = dir.value;
  55817. var modifiers = dir.modifiers;
  55818. var tag = el.tag;
  55819. var type = el.attrsMap.type;
  55820. {
  55821. // inputs with type="file" are read only and setting the input's
  55822. // value will throw an error.
  55823. if (tag === 'input' && type === 'file') {
  55824. warn$1(
  55825. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55826. "File inputs are read only. Use a v-on:change listener instead.",
  55827. el.rawAttrsMap['v-model']
  55828. );
  55829. }
  55830. }
  55831. if (el.component) {
  55832. genComponentModel(el, value, modifiers);
  55833. // component v-model doesn't need extra runtime
  55834. return false
  55835. } else if (tag === 'select') {
  55836. genSelect(el, value, modifiers);
  55837. } else if (tag === 'input' && type === 'checkbox') {
  55838. genCheckboxModel(el, value, modifiers);
  55839. } else if (tag === 'input' && type === 'radio') {
  55840. genRadioModel(el, value, modifiers);
  55841. } else if (tag === 'input' || tag === 'textarea') {
  55842. genDefaultModel(el, value, modifiers);
  55843. } else if (!config.isReservedTag(tag)) {
  55844. genComponentModel(el, value, modifiers);
  55845. // component v-model doesn't need extra runtime
  55846. return false
  55847. } else {
  55848. warn$1(
  55849. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55850. "v-model is not supported on this element type. " +
  55851. 'If you are working with contenteditable, it\'s recommended to ' +
  55852. 'wrap a library dedicated for that purpose inside a custom component.',
  55853. el.rawAttrsMap['v-model']
  55854. );
  55855. }
  55856. // ensure runtime directive metadata
  55857. return true
  55858. }
  55859. function genCheckboxModel (
  55860. el,
  55861. value,
  55862. modifiers
  55863. ) {
  55864. var number = modifiers && modifiers.number;
  55865. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55866. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55867. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55868. addProp(el, 'checked',
  55869. "Array.isArray(" + value + ")" +
  55870. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55871. trueValueBinding === 'true'
  55872. ? (":(" + value + ")")
  55873. : (":_q(" + value + "," + trueValueBinding + ")")
  55874. )
  55875. );
  55876. addHandler(el, 'change',
  55877. "var $$a=" + value + "," +
  55878. '$$el=$event.target,' +
  55879. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55880. 'if(Array.isArray($$a)){' +
  55881. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55882. '$$i=_i($$a,$$v);' +
  55883. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55884. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55885. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55886. null, true
  55887. );
  55888. }
  55889. function genRadioModel (
  55890. el,
  55891. value,
  55892. modifiers
  55893. ) {
  55894. var number = modifiers && modifiers.number;
  55895. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55896. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55897. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  55898. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  55899. }
  55900. function genSelect (
  55901. el,
  55902. value,
  55903. modifiers
  55904. ) {
  55905. var number = modifiers && modifiers.number;
  55906. var selectedVal = "Array.prototype.filter" +
  55907. ".call($event.target.options,function(o){return o.selected})" +
  55908. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  55909. "return " + (number ? '_n(val)' : 'val') + "})";
  55910. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  55911. var code = "var $$selectedVal = " + selectedVal + ";";
  55912. code = code + " " + (genAssignmentCode(value, assignment));
  55913. addHandler(el, 'change', code, null, true);
  55914. }
  55915. function genDefaultModel (
  55916. el,
  55917. value,
  55918. modifiers
  55919. ) {
  55920. var type = el.attrsMap.type;
  55921. // warn if v-bind:value conflicts with v-model
  55922. // except for inputs with v-bind:type
  55923. {
  55924. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  55925. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  55926. if (value$1 && !typeBinding) {
  55927. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  55928. warn$1(
  55929. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  55930. 'because the latter already expands to a value binding internally',
  55931. el.rawAttrsMap[binding]
  55932. );
  55933. }
  55934. }
  55935. var ref = modifiers || {};
  55936. var lazy = ref.lazy;
  55937. var number = ref.number;
  55938. var trim = ref.trim;
  55939. var needCompositionGuard = !lazy && type !== 'range';
  55940. var event = lazy
  55941. ? 'change'
  55942. : type === 'range'
  55943. ? RANGE_TOKEN
  55944. : 'input';
  55945. var valueExpression = '$event.target.value';
  55946. if (trim) {
  55947. valueExpression = "$event.target.value.trim()";
  55948. }
  55949. if (number) {
  55950. valueExpression = "_n(" + valueExpression + ")";
  55951. }
  55952. var code = genAssignmentCode(value, valueExpression);
  55953. if (needCompositionGuard) {
  55954. code = "if($event.target.composing)return;" + code;
  55955. }
  55956. addProp(el, 'value', ("(" + value + ")"));
  55957. addHandler(el, event, code, null, true);
  55958. if (trim || number) {
  55959. addHandler(el, 'blur', '$forceUpdate()');
  55960. }
  55961. }
  55962. /* */
  55963. // normalize v-model event tokens that can only be determined at runtime.
  55964. // it's important to place the event as the first in the array because
  55965. // the whole point is ensuring the v-model callback gets called before
  55966. // user-attached handlers.
  55967. function normalizeEvents (on) {
  55968. /* istanbul ignore if */
  55969. if (isDef(on[RANGE_TOKEN])) {
  55970. // IE input[type=range] only supports `change` event
  55971. var event = isIE ? 'change' : 'input';
  55972. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  55973. delete on[RANGE_TOKEN];
  55974. }
  55975. // This was originally intended to fix #4521 but no longer necessary
  55976. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  55977. /* istanbul ignore if */
  55978. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  55979. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  55980. delete on[CHECKBOX_RADIO_TOKEN];
  55981. }
  55982. }
  55983. var target$1;
  55984. function createOnceHandler$1 (event, handler, capture) {
  55985. var _target = target$1; // save current target element in closure
  55986. return function onceHandler () {
  55987. var res = handler.apply(null, arguments);
  55988. if (res !== null) {
  55989. remove$2(event, onceHandler, capture, _target);
  55990. }
  55991. }
  55992. }
  55993. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  55994. // implementation and does not fire microtasks in between event propagation, so
  55995. // safe to exclude.
  55996. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  55997. function add$1 (
  55998. name,
  55999. handler,
  56000. capture,
  56001. passive
  56002. ) {
  56003. // async edge case #6566: inner click event triggers patch, event handler
  56004. // attached to outer element during patch, and triggered again. This
  56005. // happens because browsers fire microtask ticks between event propagation.
  56006. // the solution is simple: we save the timestamp when a handler is attached,
  56007. // and the handler would only fire if the event passed to it was fired
  56008. // AFTER it was attached.
  56009. if (useMicrotaskFix) {
  56010. var attachedTimestamp = currentFlushTimestamp;
  56011. var original = handler;
  56012. handler = original._wrapper = function (e) {
  56013. if (
  56014. // no bubbling, should always fire.
  56015. // this is just a safety net in case event.timeStamp is unreliable in
  56016. // certain weird environments...
  56017. e.target === e.currentTarget ||
  56018. // event is fired after handler attachment
  56019. e.timeStamp >= attachedTimestamp ||
  56020. // bail for environments that have buggy event.timeStamp implementations
  56021. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56022. // #9681 QtWebEngine event.timeStamp is negative value
  56023. e.timeStamp <= 0 ||
  56024. // #9448 bail if event is fired in another document in a multi-page
  56025. // electron/nw.js app, since event.timeStamp will be using a different
  56026. // starting reference
  56027. e.target.ownerDocument !== document
  56028. ) {
  56029. return original.apply(this, arguments)
  56030. }
  56031. };
  56032. }
  56033. target$1.addEventListener(
  56034. name,
  56035. handler,
  56036. supportsPassive
  56037. ? { capture: capture, passive: passive }
  56038. : capture
  56039. );
  56040. }
  56041. function remove$2 (
  56042. name,
  56043. handler,
  56044. capture,
  56045. _target
  56046. ) {
  56047. (_target || target$1).removeEventListener(
  56048. name,
  56049. handler._wrapper || handler,
  56050. capture
  56051. );
  56052. }
  56053. function updateDOMListeners (oldVnode, vnode) {
  56054. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56055. return
  56056. }
  56057. var on = vnode.data.on || {};
  56058. var oldOn = oldVnode.data.on || {};
  56059. target$1 = vnode.elm;
  56060. normalizeEvents(on);
  56061. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56062. target$1 = undefined;
  56063. }
  56064. var events = {
  56065. create: updateDOMListeners,
  56066. update: updateDOMListeners
  56067. };
  56068. /* */
  56069. var svgContainer;
  56070. function updateDOMProps (oldVnode, vnode) {
  56071. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56072. return
  56073. }
  56074. var key, cur;
  56075. var elm = vnode.elm;
  56076. var oldProps = oldVnode.data.domProps || {};
  56077. var props = vnode.data.domProps || {};
  56078. // clone observed objects, as the user probably wants to mutate it
  56079. if (isDef(props.__ob__)) {
  56080. props = vnode.data.domProps = extend({}, props);
  56081. }
  56082. for (key in oldProps) {
  56083. if (!(key in props)) {
  56084. elm[key] = '';
  56085. }
  56086. }
  56087. for (key in props) {
  56088. cur = props[key];
  56089. // ignore children if the node has textContent or innerHTML,
  56090. // as these will throw away existing DOM nodes and cause removal errors
  56091. // on subsequent patches (#3360)
  56092. if (key === 'textContent' || key === 'innerHTML') {
  56093. if (vnode.children) { vnode.children.length = 0; }
  56094. if (cur === oldProps[key]) { continue }
  56095. // #6601 work around Chrome version <= 55 bug where single textNode
  56096. // replaced by innerHTML/textContent retains its parentNode property
  56097. if (elm.childNodes.length === 1) {
  56098. elm.removeChild(elm.childNodes[0]);
  56099. }
  56100. }
  56101. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56102. // store value as _value as well since
  56103. // non-string values will be stringified
  56104. elm._value = cur;
  56105. // avoid resetting cursor position when value is the same
  56106. var strCur = isUndef(cur) ? '' : String(cur);
  56107. if (shouldUpdateValue(elm, strCur)) {
  56108. elm.value = strCur;
  56109. }
  56110. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56111. // IE doesn't support innerHTML for SVG elements
  56112. svgContainer = svgContainer || document.createElement('div');
  56113. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56114. var svg = svgContainer.firstChild;
  56115. while (elm.firstChild) {
  56116. elm.removeChild(elm.firstChild);
  56117. }
  56118. while (svg.firstChild) {
  56119. elm.appendChild(svg.firstChild);
  56120. }
  56121. } else if (
  56122. // skip the update if old and new VDOM state is the same.
  56123. // `value` is handled separately because the DOM value may be temporarily
  56124. // out of sync with VDOM state due to focus, composition and modifiers.
  56125. // This #4521 by skipping the unnecesarry `checked` update.
  56126. cur !== oldProps[key]
  56127. ) {
  56128. // some property updates can throw
  56129. // e.g. `value` on <progress> w/ non-finite value
  56130. try {
  56131. elm[key] = cur;
  56132. } catch (e) {}
  56133. }
  56134. }
  56135. }
  56136. // check platforms/web/util/attrs.js acceptValue
  56137. function shouldUpdateValue (elm, checkVal) {
  56138. return (!elm.composing && (
  56139. elm.tagName === 'OPTION' ||
  56140. isNotInFocusAndDirty(elm, checkVal) ||
  56141. isDirtyWithModifiers(elm, checkVal)
  56142. ))
  56143. }
  56144. function isNotInFocusAndDirty (elm, checkVal) {
  56145. // return true when textbox (.number and .trim) loses focus and its value is
  56146. // not equal to the updated value
  56147. var notInFocus = true;
  56148. // #6157
  56149. // work around IE bug when accessing document.activeElement in an iframe
  56150. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56151. return notInFocus && elm.value !== checkVal
  56152. }
  56153. function isDirtyWithModifiers (elm, newVal) {
  56154. var value = elm.value;
  56155. var modifiers = elm._vModifiers; // injected by v-model runtime
  56156. if (isDef(modifiers)) {
  56157. if (modifiers.number) {
  56158. return toNumber(value) !== toNumber(newVal)
  56159. }
  56160. if (modifiers.trim) {
  56161. return value.trim() !== newVal.trim()
  56162. }
  56163. }
  56164. return value !== newVal
  56165. }
  56166. var domProps = {
  56167. create: updateDOMProps,
  56168. update: updateDOMProps
  56169. };
  56170. /* */
  56171. var parseStyleText = cached(function (cssText) {
  56172. var res = {};
  56173. var listDelimiter = /;(?![^(]*\))/g;
  56174. var propertyDelimiter = /:(.+)/;
  56175. cssText.split(listDelimiter).forEach(function (item) {
  56176. if (item) {
  56177. var tmp = item.split(propertyDelimiter);
  56178. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56179. }
  56180. });
  56181. return res
  56182. });
  56183. // merge static and dynamic style data on the same vnode
  56184. function normalizeStyleData (data) {
  56185. var style = normalizeStyleBinding(data.style);
  56186. // static style is pre-processed into an object during compilation
  56187. // and is always a fresh object, so it's safe to merge into it
  56188. return data.staticStyle
  56189. ? extend(data.staticStyle, style)
  56190. : style
  56191. }
  56192. // normalize possible array / string values into Object
  56193. function normalizeStyleBinding (bindingStyle) {
  56194. if (Array.isArray(bindingStyle)) {
  56195. return toObject(bindingStyle)
  56196. }
  56197. if (typeof bindingStyle === 'string') {
  56198. return parseStyleText(bindingStyle)
  56199. }
  56200. return bindingStyle
  56201. }
  56202. /**
  56203. * parent component style should be after child's
  56204. * so that parent component's style could override it
  56205. */
  56206. function getStyle (vnode, checkChild) {
  56207. var res = {};
  56208. var styleData;
  56209. if (checkChild) {
  56210. var childNode = vnode;
  56211. while (childNode.componentInstance) {
  56212. childNode = childNode.componentInstance._vnode;
  56213. if (
  56214. childNode && childNode.data &&
  56215. (styleData = normalizeStyleData(childNode.data))
  56216. ) {
  56217. extend(res, styleData);
  56218. }
  56219. }
  56220. }
  56221. if ((styleData = normalizeStyleData(vnode.data))) {
  56222. extend(res, styleData);
  56223. }
  56224. var parentNode = vnode;
  56225. while ((parentNode = parentNode.parent)) {
  56226. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56227. extend(res, styleData);
  56228. }
  56229. }
  56230. return res
  56231. }
  56232. /* */
  56233. var cssVarRE = /^--/;
  56234. var importantRE = /\s*!important$/;
  56235. var setProp = function (el, name, val) {
  56236. /* istanbul ignore if */
  56237. if (cssVarRE.test(name)) {
  56238. el.style.setProperty(name, val);
  56239. } else if (importantRE.test(val)) {
  56240. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56241. } else {
  56242. var normalizedName = normalize(name);
  56243. if (Array.isArray(val)) {
  56244. // Support values array created by autoprefixer, e.g.
  56245. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56246. // Set them one by one, and the browser will only set those it can recognize
  56247. for (var i = 0, len = val.length; i < len; i++) {
  56248. el.style[normalizedName] = val[i];
  56249. }
  56250. } else {
  56251. el.style[normalizedName] = val;
  56252. }
  56253. }
  56254. };
  56255. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56256. var emptyStyle;
  56257. var normalize = cached(function (prop) {
  56258. emptyStyle = emptyStyle || document.createElement('div').style;
  56259. prop = camelize(prop);
  56260. if (prop !== 'filter' && (prop in emptyStyle)) {
  56261. return prop
  56262. }
  56263. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56264. for (var i = 0; i < vendorNames.length; i++) {
  56265. var name = vendorNames[i] + capName;
  56266. if (name in emptyStyle) {
  56267. return name
  56268. }
  56269. }
  56270. });
  56271. function updateStyle (oldVnode, vnode) {
  56272. var data = vnode.data;
  56273. var oldData = oldVnode.data;
  56274. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56275. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56276. ) {
  56277. return
  56278. }
  56279. var cur, name;
  56280. var el = vnode.elm;
  56281. var oldStaticStyle = oldData.staticStyle;
  56282. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56283. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56284. var oldStyle = oldStaticStyle || oldStyleBinding;
  56285. var style = normalizeStyleBinding(vnode.data.style) || {};
  56286. // store normalized style under a different key for next diff
  56287. // make sure to clone it if it's reactive, since the user likely wants
  56288. // to mutate it.
  56289. vnode.data.normalizedStyle = isDef(style.__ob__)
  56290. ? extend({}, style)
  56291. : style;
  56292. var newStyle = getStyle(vnode, true);
  56293. for (name in oldStyle) {
  56294. if (isUndef(newStyle[name])) {
  56295. setProp(el, name, '');
  56296. }
  56297. }
  56298. for (name in newStyle) {
  56299. cur = newStyle[name];
  56300. if (cur !== oldStyle[name]) {
  56301. // ie9 setting to null has no effect, must use empty string
  56302. setProp(el, name, cur == null ? '' : cur);
  56303. }
  56304. }
  56305. }
  56306. var style = {
  56307. create: updateStyle,
  56308. update: updateStyle
  56309. };
  56310. /* */
  56311. var whitespaceRE = /\s+/;
  56312. /**
  56313. * Add class with compatibility for SVG since classList is not supported on
  56314. * SVG elements in IE
  56315. */
  56316. function addClass (el, cls) {
  56317. /* istanbul ignore if */
  56318. if (!cls || !(cls = cls.trim())) {
  56319. return
  56320. }
  56321. /* istanbul ignore else */
  56322. if (el.classList) {
  56323. if (cls.indexOf(' ') > -1) {
  56324. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56325. } else {
  56326. el.classList.add(cls);
  56327. }
  56328. } else {
  56329. var cur = " " + (el.getAttribute('class') || '') + " ";
  56330. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56331. el.setAttribute('class', (cur + cls).trim());
  56332. }
  56333. }
  56334. }
  56335. /**
  56336. * Remove class with compatibility for SVG since classList is not supported on
  56337. * SVG elements in IE
  56338. */
  56339. function removeClass (el, cls) {
  56340. /* istanbul ignore if */
  56341. if (!cls || !(cls = cls.trim())) {
  56342. return
  56343. }
  56344. /* istanbul ignore else */
  56345. if (el.classList) {
  56346. if (cls.indexOf(' ') > -1) {
  56347. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56348. } else {
  56349. el.classList.remove(cls);
  56350. }
  56351. if (!el.classList.length) {
  56352. el.removeAttribute('class');
  56353. }
  56354. } else {
  56355. var cur = " " + (el.getAttribute('class') || '') + " ";
  56356. var tar = ' ' + cls + ' ';
  56357. while (cur.indexOf(tar) >= 0) {
  56358. cur = cur.replace(tar, ' ');
  56359. }
  56360. cur = cur.trim();
  56361. if (cur) {
  56362. el.setAttribute('class', cur);
  56363. } else {
  56364. el.removeAttribute('class');
  56365. }
  56366. }
  56367. }
  56368. /* */
  56369. function resolveTransition (def$$1) {
  56370. if (!def$$1) {
  56371. return
  56372. }
  56373. /* istanbul ignore else */
  56374. if (typeof def$$1 === 'object') {
  56375. var res = {};
  56376. if (def$$1.css !== false) {
  56377. extend(res, autoCssTransition(def$$1.name || 'v'));
  56378. }
  56379. extend(res, def$$1);
  56380. return res
  56381. } else if (typeof def$$1 === 'string') {
  56382. return autoCssTransition(def$$1)
  56383. }
  56384. }
  56385. var autoCssTransition = cached(function (name) {
  56386. return {
  56387. enterClass: (name + "-enter"),
  56388. enterToClass: (name + "-enter-to"),
  56389. enterActiveClass: (name + "-enter-active"),
  56390. leaveClass: (name + "-leave"),
  56391. leaveToClass: (name + "-leave-to"),
  56392. leaveActiveClass: (name + "-leave-active")
  56393. }
  56394. });
  56395. var hasTransition = inBrowser && !isIE9;
  56396. var TRANSITION = 'transition';
  56397. var ANIMATION = 'animation';
  56398. // Transition property/event sniffing
  56399. var transitionProp = 'transition';
  56400. var transitionEndEvent = 'transitionend';
  56401. var animationProp = 'animation';
  56402. var animationEndEvent = 'animationend';
  56403. if (hasTransition) {
  56404. /* istanbul ignore if */
  56405. if (window.ontransitionend === undefined &&
  56406. window.onwebkittransitionend !== undefined
  56407. ) {
  56408. transitionProp = 'WebkitTransition';
  56409. transitionEndEvent = 'webkitTransitionEnd';
  56410. }
  56411. if (window.onanimationend === undefined &&
  56412. window.onwebkitanimationend !== undefined
  56413. ) {
  56414. animationProp = 'WebkitAnimation';
  56415. animationEndEvent = 'webkitAnimationEnd';
  56416. }
  56417. }
  56418. // binding to window is necessary to make hot reload work in IE in strict mode
  56419. var raf = inBrowser
  56420. ? window.requestAnimationFrame
  56421. ? window.requestAnimationFrame.bind(window)
  56422. : setTimeout
  56423. : /* istanbul ignore next */ function (fn) { return fn(); };
  56424. function nextFrame (fn) {
  56425. raf(function () {
  56426. raf(fn);
  56427. });
  56428. }
  56429. function addTransitionClass (el, cls) {
  56430. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56431. if (transitionClasses.indexOf(cls) < 0) {
  56432. transitionClasses.push(cls);
  56433. addClass(el, cls);
  56434. }
  56435. }
  56436. function removeTransitionClass (el, cls) {
  56437. if (el._transitionClasses) {
  56438. remove(el._transitionClasses, cls);
  56439. }
  56440. removeClass(el, cls);
  56441. }
  56442. function whenTransitionEnds (
  56443. el,
  56444. expectedType,
  56445. cb
  56446. ) {
  56447. var ref = getTransitionInfo(el, expectedType);
  56448. var type = ref.type;
  56449. var timeout = ref.timeout;
  56450. var propCount = ref.propCount;
  56451. if (!type) { return cb() }
  56452. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56453. var ended = 0;
  56454. var end = function () {
  56455. el.removeEventListener(event, onEnd);
  56456. cb();
  56457. };
  56458. var onEnd = function (e) {
  56459. if (e.target === el) {
  56460. if (++ended >= propCount) {
  56461. end();
  56462. }
  56463. }
  56464. };
  56465. setTimeout(function () {
  56466. if (ended < propCount) {
  56467. end();
  56468. }
  56469. }, timeout + 1);
  56470. el.addEventListener(event, onEnd);
  56471. }
  56472. var transformRE = /\b(transform|all)(,|$)/;
  56473. function getTransitionInfo (el, expectedType) {
  56474. var styles = window.getComputedStyle(el);
  56475. // JSDOM may return undefined for transition properties
  56476. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56477. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56478. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56479. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56480. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56481. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56482. var type;
  56483. var timeout = 0;
  56484. var propCount = 0;
  56485. /* istanbul ignore if */
  56486. if (expectedType === TRANSITION) {
  56487. if (transitionTimeout > 0) {
  56488. type = TRANSITION;
  56489. timeout = transitionTimeout;
  56490. propCount = transitionDurations.length;
  56491. }
  56492. } else if (expectedType === ANIMATION) {
  56493. if (animationTimeout > 0) {
  56494. type = ANIMATION;
  56495. timeout = animationTimeout;
  56496. propCount = animationDurations.length;
  56497. }
  56498. } else {
  56499. timeout = Math.max(transitionTimeout, animationTimeout);
  56500. type = timeout > 0
  56501. ? transitionTimeout > animationTimeout
  56502. ? TRANSITION
  56503. : ANIMATION
  56504. : null;
  56505. propCount = type
  56506. ? type === TRANSITION
  56507. ? transitionDurations.length
  56508. : animationDurations.length
  56509. : 0;
  56510. }
  56511. var hasTransform =
  56512. type === TRANSITION &&
  56513. transformRE.test(styles[transitionProp + 'Property']);
  56514. return {
  56515. type: type,
  56516. timeout: timeout,
  56517. propCount: propCount,
  56518. hasTransform: hasTransform
  56519. }
  56520. }
  56521. function getTimeout (delays, durations) {
  56522. /* istanbul ignore next */
  56523. while (delays.length < durations.length) {
  56524. delays = delays.concat(delays);
  56525. }
  56526. return Math.max.apply(null, durations.map(function (d, i) {
  56527. return toMs(d) + toMs(delays[i])
  56528. }))
  56529. }
  56530. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56531. // in a locale-dependent way, using a comma instead of a dot.
  56532. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56533. // as a floor function) causing unexpected behaviors
  56534. function toMs (s) {
  56535. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56536. }
  56537. /* */
  56538. function enter (vnode, toggleDisplay) {
  56539. var el = vnode.elm;
  56540. // call leave callback now
  56541. if (isDef(el._leaveCb)) {
  56542. el._leaveCb.cancelled = true;
  56543. el._leaveCb();
  56544. }
  56545. var data = resolveTransition(vnode.data.transition);
  56546. if (isUndef(data)) {
  56547. return
  56548. }
  56549. /* istanbul ignore if */
  56550. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56551. return
  56552. }
  56553. var css = data.css;
  56554. var type = data.type;
  56555. var enterClass = data.enterClass;
  56556. var enterToClass = data.enterToClass;
  56557. var enterActiveClass = data.enterActiveClass;
  56558. var appearClass = data.appearClass;
  56559. var appearToClass = data.appearToClass;
  56560. var appearActiveClass = data.appearActiveClass;
  56561. var beforeEnter = data.beforeEnter;
  56562. var enter = data.enter;
  56563. var afterEnter = data.afterEnter;
  56564. var enterCancelled = data.enterCancelled;
  56565. var beforeAppear = data.beforeAppear;
  56566. var appear = data.appear;
  56567. var afterAppear = data.afterAppear;
  56568. var appearCancelled = data.appearCancelled;
  56569. var duration = data.duration;
  56570. // activeInstance will always be the <transition> component managing this
  56571. // transition. One edge case to check is when the <transition> is placed
  56572. // as the root node of a child component. In that case we need to check
  56573. // <transition>'s parent for appear check.
  56574. var context = activeInstance;
  56575. var transitionNode = activeInstance.$vnode;
  56576. while (transitionNode && transitionNode.parent) {
  56577. context = transitionNode.context;
  56578. transitionNode = transitionNode.parent;
  56579. }
  56580. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56581. if (isAppear && !appear && appear !== '') {
  56582. return
  56583. }
  56584. var startClass = isAppear && appearClass
  56585. ? appearClass
  56586. : enterClass;
  56587. var activeClass = isAppear && appearActiveClass
  56588. ? appearActiveClass
  56589. : enterActiveClass;
  56590. var toClass = isAppear && appearToClass
  56591. ? appearToClass
  56592. : enterToClass;
  56593. var beforeEnterHook = isAppear
  56594. ? (beforeAppear || beforeEnter)
  56595. : beforeEnter;
  56596. var enterHook = isAppear
  56597. ? (typeof appear === 'function' ? appear : enter)
  56598. : enter;
  56599. var afterEnterHook = isAppear
  56600. ? (afterAppear || afterEnter)
  56601. : afterEnter;
  56602. var enterCancelledHook = isAppear
  56603. ? (appearCancelled || enterCancelled)
  56604. : enterCancelled;
  56605. var explicitEnterDuration = toNumber(
  56606. isObject(duration)
  56607. ? duration.enter
  56608. : duration
  56609. );
  56610. if (explicitEnterDuration != null) {
  56611. checkDuration(explicitEnterDuration, 'enter', vnode);
  56612. }
  56613. var expectsCSS = css !== false && !isIE9;
  56614. var userWantsControl = getHookArgumentsLength(enterHook);
  56615. var cb = el._enterCb = once(function () {
  56616. if (expectsCSS) {
  56617. removeTransitionClass(el, toClass);
  56618. removeTransitionClass(el, activeClass);
  56619. }
  56620. if (cb.cancelled) {
  56621. if (expectsCSS) {
  56622. removeTransitionClass(el, startClass);
  56623. }
  56624. enterCancelledHook && enterCancelledHook(el);
  56625. } else {
  56626. afterEnterHook && afterEnterHook(el);
  56627. }
  56628. el._enterCb = null;
  56629. });
  56630. if (!vnode.data.show) {
  56631. // remove pending leave element on enter by injecting an insert hook
  56632. mergeVNodeHook(vnode, 'insert', function () {
  56633. var parent = el.parentNode;
  56634. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56635. if (pendingNode &&
  56636. pendingNode.tag === vnode.tag &&
  56637. pendingNode.elm._leaveCb
  56638. ) {
  56639. pendingNode.elm._leaveCb();
  56640. }
  56641. enterHook && enterHook(el, cb);
  56642. });
  56643. }
  56644. // start enter transition
  56645. beforeEnterHook && beforeEnterHook(el);
  56646. if (expectsCSS) {
  56647. addTransitionClass(el, startClass);
  56648. addTransitionClass(el, activeClass);
  56649. nextFrame(function () {
  56650. removeTransitionClass(el, startClass);
  56651. if (!cb.cancelled) {
  56652. addTransitionClass(el, toClass);
  56653. if (!userWantsControl) {
  56654. if (isValidDuration(explicitEnterDuration)) {
  56655. setTimeout(cb, explicitEnterDuration);
  56656. } else {
  56657. whenTransitionEnds(el, type, cb);
  56658. }
  56659. }
  56660. }
  56661. });
  56662. }
  56663. if (vnode.data.show) {
  56664. toggleDisplay && toggleDisplay();
  56665. enterHook && enterHook(el, cb);
  56666. }
  56667. if (!expectsCSS && !userWantsControl) {
  56668. cb();
  56669. }
  56670. }
  56671. function leave (vnode, rm) {
  56672. var el = vnode.elm;
  56673. // call enter callback now
  56674. if (isDef(el._enterCb)) {
  56675. el._enterCb.cancelled = true;
  56676. el._enterCb();
  56677. }
  56678. var data = resolveTransition(vnode.data.transition);
  56679. if (isUndef(data) || el.nodeType !== 1) {
  56680. return rm()
  56681. }
  56682. /* istanbul ignore if */
  56683. if (isDef(el._leaveCb)) {
  56684. return
  56685. }
  56686. var css = data.css;
  56687. var type = data.type;
  56688. var leaveClass = data.leaveClass;
  56689. var leaveToClass = data.leaveToClass;
  56690. var leaveActiveClass = data.leaveActiveClass;
  56691. var beforeLeave = data.beforeLeave;
  56692. var leave = data.leave;
  56693. var afterLeave = data.afterLeave;
  56694. var leaveCancelled = data.leaveCancelled;
  56695. var delayLeave = data.delayLeave;
  56696. var duration = data.duration;
  56697. var expectsCSS = css !== false && !isIE9;
  56698. var userWantsControl = getHookArgumentsLength(leave);
  56699. var explicitLeaveDuration = toNumber(
  56700. isObject(duration)
  56701. ? duration.leave
  56702. : duration
  56703. );
  56704. if (isDef(explicitLeaveDuration)) {
  56705. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56706. }
  56707. var cb = el._leaveCb = once(function () {
  56708. if (el.parentNode && el.parentNode._pending) {
  56709. el.parentNode._pending[vnode.key] = null;
  56710. }
  56711. if (expectsCSS) {
  56712. removeTransitionClass(el, leaveToClass);
  56713. removeTransitionClass(el, leaveActiveClass);
  56714. }
  56715. if (cb.cancelled) {
  56716. if (expectsCSS) {
  56717. removeTransitionClass(el, leaveClass);
  56718. }
  56719. leaveCancelled && leaveCancelled(el);
  56720. } else {
  56721. rm();
  56722. afterLeave && afterLeave(el);
  56723. }
  56724. el._leaveCb = null;
  56725. });
  56726. if (delayLeave) {
  56727. delayLeave(performLeave);
  56728. } else {
  56729. performLeave();
  56730. }
  56731. function performLeave () {
  56732. // the delayed leave may have already been cancelled
  56733. if (cb.cancelled) {
  56734. return
  56735. }
  56736. // record leaving element
  56737. if (!vnode.data.show && el.parentNode) {
  56738. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56739. }
  56740. beforeLeave && beforeLeave(el);
  56741. if (expectsCSS) {
  56742. addTransitionClass(el, leaveClass);
  56743. addTransitionClass(el, leaveActiveClass);
  56744. nextFrame(function () {
  56745. removeTransitionClass(el, leaveClass);
  56746. if (!cb.cancelled) {
  56747. addTransitionClass(el, leaveToClass);
  56748. if (!userWantsControl) {
  56749. if (isValidDuration(explicitLeaveDuration)) {
  56750. setTimeout(cb, explicitLeaveDuration);
  56751. } else {
  56752. whenTransitionEnds(el, type, cb);
  56753. }
  56754. }
  56755. }
  56756. });
  56757. }
  56758. leave && leave(el, cb);
  56759. if (!expectsCSS && !userWantsControl) {
  56760. cb();
  56761. }
  56762. }
  56763. }
  56764. // only used in dev mode
  56765. function checkDuration (val, name, vnode) {
  56766. if (typeof val !== 'number') {
  56767. warn(
  56768. "<transition> explicit " + name + " duration is not a valid number - " +
  56769. "got " + (JSON.stringify(val)) + ".",
  56770. vnode.context
  56771. );
  56772. } else if (isNaN(val)) {
  56773. warn(
  56774. "<transition> explicit " + name + " duration is NaN - " +
  56775. 'the duration expression might be incorrect.',
  56776. vnode.context
  56777. );
  56778. }
  56779. }
  56780. function isValidDuration (val) {
  56781. return typeof val === 'number' && !isNaN(val)
  56782. }
  56783. /**
  56784. * Normalize a transition hook's argument length. The hook may be:
  56785. * - a merged hook (invoker) with the original in .fns
  56786. * - a wrapped component method (check ._length)
  56787. * - a plain function (.length)
  56788. */
  56789. function getHookArgumentsLength (fn) {
  56790. if (isUndef(fn)) {
  56791. return false
  56792. }
  56793. var invokerFns = fn.fns;
  56794. if (isDef(invokerFns)) {
  56795. // invoker
  56796. return getHookArgumentsLength(
  56797. Array.isArray(invokerFns)
  56798. ? invokerFns[0]
  56799. : invokerFns
  56800. )
  56801. } else {
  56802. return (fn._length || fn.length) > 1
  56803. }
  56804. }
  56805. function _enter (_, vnode) {
  56806. if (vnode.data.show !== true) {
  56807. enter(vnode);
  56808. }
  56809. }
  56810. var transition = inBrowser ? {
  56811. create: _enter,
  56812. activate: _enter,
  56813. remove: function remove$$1 (vnode, rm) {
  56814. /* istanbul ignore else */
  56815. if (vnode.data.show !== true) {
  56816. leave(vnode, rm);
  56817. } else {
  56818. rm();
  56819. }
  56820. }
  56821. } : {};
  56822. var platformModules = [
  56823. attrs,
  56824. klass,
  56825. events,
  56826. domProps,
  56827. style,
  56828. transition
  56829. ];
  56830. /* */
  56831. // the directive module should be applied last, after all
  56832. // built-in modules have been applied.
  56833. var modules = platformModules.concat(baseModules);
  56834. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56835. /**
  56836. * Not type checking this file because flow doesn't like attaching
  56837. * properties to Elements.
  56838. */
  56839. /* istanbul ignore if */
  56840. if (isIE9) {
  56841. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56842. document.addEventListener('selectionchange', function () {
  56843. var el = document.activeElement;
  56844. if (el && el.vmodel) {
  56845. trigger(el, 'input');
  56846. }
  56847. });
  56848. }
  56849. var directive = {
  56850. inserted: function inserted (el, binding, vnode, oldVnode) {
  56851. if (vnode.tag === 'select') {
  56852. // #6903
  56853. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56854. mergeVNodeHook(vnode, 'postpatch', function () {
  56855. directive.componentUpdated(el, binding, vnode);
  56856. });
  56857. } else {
  56858. setSelected(el, binding, vnode.context);
  56859. }
  56860. el._vOptions = [].map.call(el.options, getValue);
  56861. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56862. el._vModifiers = binding.modifiers;
  56863. if (!binding.modifiers.lazy) {
  56864. el.addEventListener('compositionstart', onCompositionStart);
  56865. el.addEventListener('compositionend', onCompositionEnd);
  56866. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56867. // switching focus before confirming composition choice
  56868. // this also fixes the issue where some browsers e.g. iOS Chrome
  56869. // fires "change" instead of "input" on autocomplete.
  56870. el.addEventListener('change', onCompositionEnd);
  56871. /* istanbul ignore if */
  56872. if (isIE9) {
  56873. el.vmodel = true;
  56874. }
  56875. }
  56876. }
  56877. },
  56878. componentUpdated: function componentUpdated (el, binding, vnode) {
  56879. if (vnode.tag === 'select') {
  56880. setSelected(el, binding, vnode.context);
  56881. // in case the options rendered by v-for have changed,
  56882. // it's possible that the value is out-of-sync with the rendered options.
  56883. // detect such cases and filter out values that no longer has a matching
  56884. // option in the DOM.
  56885. var prevOptions = el._vOptions;
  56886. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56887. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56888. // trigger change event if
  56889. // no matching option found for at least one value
  56890. var needReset = el.multiple
  56891. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56892. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56893. if (needReset) {
  56894. trigger(el, 'change');
  56895. }
  56896. }
  56897. }
  56898. }
  56899. };
  56900. function setSelected (el, binding, vm) {
  56901. actuallySetSelected(el, binding, vm);
  56902. /* istanbul ignore if */
  56903. if (isIE || isEdge) {
  56904. setTimeout(function () {
  56905. actuallySetSelected(el, binding, vm);
  56906. }, 0);
  56907. }
  56908. }
  56909. function actuallySetSelected (el, binding, vm) {
  56910. var value = binding.value;
  56911. var isMultiple = el.multiple;
  56912. if (isMultiple && !Array.isArray(value)) {
  56913. warn(
  56914. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  56915. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  56916. vm
  56917. );
  56918. return
  56919. }
  56920. var selected, option;
  56921. for (var i = 0, l = el.options.length; i < l; i++) {
  56922. option = el.options[i];
  56923. if (isMultiple) {
  56924. selected = looseIndexOf(value, getValue(option)) > -1;
  56925. if (option.selected !== selected) {
  56926. option.selected = selected;
  56927. }
  56928. } else {
  56929. if (looseEqual(getValue(option), value)) {
  56930. if (el.selectedIndex !== i) {
  56931. el.selectedIndex = i;
  56932. }
  56933. return
  56934. }
  56935. }
  56936. }
  56937. if (!isMultiple) {
  56938. el.selectedIndex = -1;
  56939. }
  56940. }
  56941. function hasNoMatchingOption (value, options) {
  56942. return options.every(function (o) { return !looseEqual(o, value); })
  56943. }
  56944. function getValue (option) {
  56945. return '_value' in option
  56946. ? option._value
  56947. : option.value
  56948. }
  56949. function onCompositionStart (e) {
  56950. e.target.composing = true;
  56951. }
  56952. function onCompositionEnd (e) {
  56953. // prevent triggering an input event for no reason
  56954. if (!e.target.composing) { return }
  56955. e.target.composing = false;
  56956. trigger(e.target, 'input');
  56957. }
  56958. function trigger (el, type) {
  56959. var e = document.createEvent('HTMLEvents');
  56960. e.initEvent(type, true, true);
  56961. el.dispatchEvent(e);
  56962. }
  56963. /* */
  56964. // recursively search for possible transition defined inside the component root
  56965. function locateNode (vnode) {
  56966. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  56967. ? locateNode(vnode.componentInstance._vnode)
  56968. : vnode
  56969. }
  56970. var show = {
  56971. bind: function bind (el, ref, vnode) {
  56972. var value = ref.value;
  56973. vnode = locateNode(vnode);
  56974. var transition$$1 = vnode.data && vnode.data.transition;
  56975. var originalDisplay = el.__vOriginalDisplay =
  56976. el.style.display === 'none' ? '' : el.style.display;
  56977. if (value && transition$$1) {
  56978. vnode.data.show = true;
  56979. enter(vnode, function () {
  56980. el.style.display = originalDisplay;
  56981. });
  56982. } else {
  56983. el.style.display = value ? originalDisplay : 'none';
  56984. }
  56985. },
  56986. update: function update (el, ref, vnode) {
  56987. var value = ref.value;
  56988. var oldValue = ref.oldValue;
  56989. /* istanbul ignore if */
  56990. if (!value === !oldValue) { return }
  56991. vnode = locateNode(vnode);
  56992. var transition$$1 = vnode.data && vnode.data.transition;
  56993. if (transition$$1) {
  56994. vnode.data.show = true;
  56995. if (value) {
  56996. enter(vnode, function () {
  56997. el.style.display = el.__vOriginalDisplay;
  56998. });
  56999. } else {
  57000. leave(vnode, function () {
  57001. el.style.display = 'none';
  57002. });
  57003. }
  57004. } else {
  57005. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57006. }
  57007. },
  57008. unbind: function unbind (
  57009. el,
  57010. binding,
  57011. vnode,
  57012. oldVnode,
  57013. isDestroy
  57014. ) {
  57015. if (!isDestroy) {
  57016. el.style.display = el.__vOriginalDisplay;
  57017. }
  57018. }
  57019. };
  57020. var platformDirectives = {
  57021. model: directive,
  57022. show: show
  57023. };
  57024. /* */
  57025. var transitionProps = {
  57026. name: String,
  57027. appear: Boolean,
  57028. css: Boolean,
  57029. mode: String,
  57030. type: String,
  57031. enterClass: String,
  57032. leaveClass: String,
  57033. enterToClass: String,
  57034. leaveToClass: String,
  57035. enterActiveClass: String,
  57036. leaveActiveClass: String,
  57037. appearClass: String,
  57038. appearActiveClass: String,
  57039. appearToClass: String,
  57040. duration: [Number, String, Object]
  57041. };
  57042. // in case the child is also an abstract component, e.g. <keep-alive>
  57043. // we want to recursively retrieve the real component to be rendered
  57044. function getRealChild (vnode) {
  57045. var compOptions = vnode && vnode.componentOptions;
  57046. if (compOptions && compOptions.Ctor.options.abstract) {
  57047. return getRealChild(getFirstComponentChild(compOptions.children))
  57048. } else {
  57049. return vnode
  57050. }
  57051. }
  57052. function extractTransitionData (comp) {
  57053. var data = {};
  57054. var options = comp.$options;
  57055. // props
  57056. for (var key in options.propsData) {
  57057. data[key] = comp[key];
  57058. }
  57059. // events.
  57060. // extract listeners and pass them directly to the transition methods
  57061. var listeners = options._parentListeners;
  57062. for (var key$1 in listeners) {
  57063. data[camelize(key$1)] = listeners[key$1];
  57064. }
  57065. return data
  57066. }
  57067. function placeholder (h, rawChild) {
  57068. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57069. return h('keep-alive', {
  57070. props: rawChild.componentOptions.propsData
  57071. })
  57072. }
  57073. }
  57074. function hasParentTransition (vnode) {
  57075. while ((vnode = vnode.parent)) {
  57076. if (vnode.data.transition) {
  57077. return true
  57078. }
  57079. }
  57080. }
  57081. function isSameChild (child, oldChild) {
  57082. return oldChild.key === child.key && oldChild.tag === child.tag
  57083. }
  57084. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57085. var isVShowDirective = function (d) { return d.name === 'show'; };
  57086. var Transition = {
  57087. name: 'transition',
  57088. props: transitionProps,
  57089. abstract: true,
  57090. render: function render (h) {
  57091. var this$1 = this;
  57092. var children = this.$slots.default;
  57093. if (!children) {
  57094. return
  57095. }
  57096. // filter out text nodes (possible whitespaces)
  57097. children = children.filter(isNotTextNode);
  57098. /* istanbul ignore if */
  57099. if (!children.length) {
  57100. return
  57101. }
  57102. // warn multiple elements
  57103. if (children.length > 1) {
  57104. warn(
  57105. '<transition> can only be used on a single element. Use ' +
  57106. '<transition-group> for lists.',
  57107. this.$parent
  57108. );
  57109. }
  57110. var mode = this.mode;
  57111. // warn invalid mode
  57112. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57113. ) {
  57114. warn(
  57115. 'invalid <transition> mode: ' + mode,
  57116. this.$parent
  57117. );
  57118. }
  57119. var rawChild = children[0];
  57120. // if this is a component root node and the component's
  57121. // parent container node also has transition, skip.
  57122. if (hasParentTransition(this.$vnode)) {
  57123. return rawChild
  57124. }
  57125. // apply transition data to child
  57126. // use getRealChild() to ignore abstract components e.g. keep-alive
  57127. var child = getRealChild(rawChild);
  57128. /* istanbul ignore if */
  57129. if (!child) {
  57130. return rawChild
  57131. }
  57132. if (this._leaving) {
  57133. return placeholder(h, rawChild)
  57134. }
  57135. // ensure a key that is unique to the vnode type and to this transition
  57136. // component instance. This key will be used to remove pending leaving nodes
  57137. // during entering.
  57138. var id = "__transition-" + (this._uid) + "-";
  57139. child.key = child.key == null
  57140. ? child.isComment
  57141. ? id + 'comment'
  57142. : id + child.tag
  57143. : isPrimitive(child.key)
  57144. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57145. : child.key;
  57146. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57147. var oldRawChild = this._vnode;
  57148. var oldChild = getRealChild(oldRawChild);
  57149. // mark v-show
  57150. // so that the transition module can hand over the control to the directive
  57151. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57152. child.data.show = true;
  57153. }
  57154. if (
  57155. oldChild &&
  57156. oldChild.data &&
  57157. !isSameChild(child, oldChild) &&
  57158. !isAsyncPlaceholder(oldChild) &&
  57159. // #6687 component root is a comment node
  57160. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57161. ) {
  57162. // replace old child transition data with fresh one
  57163. // important for dynamic transitions!
  57164. var oldData = oldChild.data.transition = extend({}, data);
  57165. // handle transition mode
  57166. if (mode === 'out-in') {
  57167. // return placeholder node and queue update when leave finishes
  57168. this._leaving = true;
  57169. mergeVNodeHook(oldData, 'afterLeave', function () {
  57170. this$1._leaving = false;
  57171. this$1.$forceUpdate();
  57172. });
  57173. return placeholder(h, rawChild)
  57174. } else if (mode === 'in-out') {
  57175. if (isAsyncPlaceholder(child)) {
  57176. return oldRawChild
  57177. }
  57178. var delayedLeave;
  57179. var performLeave = function () { delayedLeave(); };
  57180. mergeVNodeHook(data, 'afterEnter', performLeave);
  57181. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57182. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57183. }
  57184. }
  57185. return rawChild
  57186. }
  57187. };
  57188. /* */
  57189. var props = extend({
  57190. tag: String,
  57191. moveClass: String
  57192. }, transitionProps);
  57193. delete props.mode;
  57194. var TransitionGroup = {
  57195. props: props,
  57196. beforeMount: function beforeMount () {
  57197. var this$1 = this;
  57198. var update = this._update;
  57199. this._update = function (vnode, hydrating) {
  57200. var restoreActiveInstance = setActiveInstance(this$1);
  57201. // force removing pass
  57202. this$1.__patch__(
  57203. this$1._vnode,
  57204. this$1.kept,
  57205. false, // hydrating
  57206. true // removeOnly (!important, avoids unnecessary moves)
  57207. );
  57208. this$1._vnode = this$1.kept;
  57209. restoreActiveInstance();
  57210. update.call(this$1, vnode, hydrating);
  57211. };
  57212. },
  57213. render: function render (h) {
  57214. var tag = this.tag || this.$vnode.data.tag || 'span';
  57215. var map = Object.create(null);
  57216. var prevChildren = this.prevChildren = this.children;
  57217. var rawChildren = this.$slots.default || [];
  57218. var children = this.children = [];
  57219. var transitionData = extractTransitionData(this);
  57220. for (var i = 0; i < rawChildren.length; i++) {
  57221. var c = rawChildren[i];
  57222. if (c.tag) {
  57223. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57224. children.push(c);
  57225. map[c.key] = c
  57226. ;(c.data || (c.data = {})).transition = transitionData;
  57227. } else {
  57228. var opts = c.componentOptions;
  57229. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57230. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57231. }
  57232. }
  57233. }
  57234. if (prevChildren) {
  57235. var kept = [];
  57236. var removed = [];
  57237. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57238. var c$1 = prevChildren[i$1];
  57239. c$1.data.transition = transitionData;
  57240. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57241. if (map[c$1.key]) {
  57242. kept.push(c$1);
  57243. } else {
  57244. removed.push(c$1);
  57245. }
  57246. }
  57247. this.kept = h(tag, null, kept);
  57248. this.removed = removed;
  57249. }
  57250. return h(tag, null, children)
  57251. },
  57252. updated: function updated () {
  57253. var children = this.prevChildren;
  57254. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57255. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57256. return
  57257. }
  57258. // we divide the work into three loops to avoid mixing DOM reads and writes
  57259. // in each iteration - which helps prevent layout thrashing.
  57260. children.forEach(callPendingCbs);
  57261. children.forEach(recordPosition);
  57262. children.forEach(applyTranslation);
  57263. // force reflow to put everything in position
  57264. // assign to this to avoid being removed in tree-shaking
  57265. // $flow-disable-line
  57266. this._reflow = document.body.offsetHeight;
  57267. children.forEach(function (c) {
  57268. if (c.data.moved) {
  57269. var el = c.elm;
  57270. var s = el.style;
  57271. addTransitionClass(el, moveClass);
  57272. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57273. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57274. if (e && e.target !== el) {
  57275. return
  57276. }
  57277. if (!e || /transform$/.test(e.propertyName)) {
  57278. el.removeEventListener(transitionEndEvent, cb);
  57279. el._moveCb = null;
  57280. removeTransitionClass(el, moveClass);
  57281. }
  57282. });
  57283. }
  57284. });
  57285. },
  57286. methods: {
  57287. hasMove: function hasMove (el, moveClass) {
  57288. /* istanbul ignore if */
  57289. if (!hasTransition) {
  57290. return false
  57291. }
  57292. /* istanbul ignore if */
  57293. if (this._hasMove) {
  57294. return this._hasMove
  57295. }
  57296. // Detect whether an element with the move class applied has
  57297. // CSS transitions. Since the element may be inside an entering
  57298. // transition at this very moment, we make a clone of it and remove
  57299. // all other transition classes applied to ensure only the move class
  57300. // is applied.
  57301. var clone = el.cloneNode();
  57302. if (el._transitionClasses) {
  57303. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57304. }
  57305. addClass(clone, moveClass);
  57306. clone.style.display = 'none';
  57307. this.$el.appendChild(clone);
  57308. var info = getTransitionInfo(clone);
  57309. this.$el.removeChild(clone);
  57310. return (this._hasMove = info.hasTransform)
  57311. }
  57312. }
  57313. };
  57314. function callPendingCbs (c) {
  57315. /* istanbul ignore if */
  57316. if (c.elm._moveCb) {
  57317. c.elm._moveCb();
  57318. }
  57319. /* istanbul ignore if */
  57320. if (c.elm._enterCb) {
  57321. c.elm._enterCb();
  57322. }
  57323. }
  57324. function recordPosition (c) {
  57325. c.data.newPos = c.elm.getBoundingClientRect();
  57326. }
  57327. function applyTranslation (c) {
  57328. var oldPos = c.data.pos;
  57329. var newPos = c.data.newPos;
  57330. var dx = oldPos.left - newPos.left;
  57331. var dy = oldPos.top - newPos.top;
  57332. if (dx || dy) {
  57333. c.data.moved = true;
  57334. var s = c.elm.style;
  57335. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57336. s.transitionDuration = '0s';
  57337. }
  57338. }
  57339. var platformComponents = {
  57340. Transition: Transition,
  57341. TransitionGroup: TransitionGroup
  57342. };
  57343. /* */
  57344. // install platform specific utils
  57345. Vue.config.mustUseProp = mustUseProp;
  57346. Vue.config.isReservedTag = isReservedTag;
  57347. Vue.config.isReservedAttr = isReservedAttr;
  57348. Vue.config.getTagNamespace = getTagNamespace;
  57349. Vue.config.isUnknownElement = isUnknownElement;
  57350. // install platform runtime directives & components
  57351. extend(Vue.options.directives, platformDirectives);
  57352. extend(Vue.options.components, platformComponents);
  57353. // install platform patch function
  57354. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57355. // public mount method
  57356. Vue.prototype.$mount = function (
  57357. el,
  57358. hydrating
  57359. ) {
  57360. el = el && inBrowser ? query(el) : undefined;
  57361. return mountComponent(this, el, hydrating)
  57362. };
  57363. // devtools global hook
  57364. /* istanbul ignore next */
  57365. if (inBrowser) {
  57366. setTimeout(function () {
  57367. if (config.devtools) {
  57368. if (devtools) {
  57369. devtools.emit('init', Vue);
  57370. } else {
  57371. console[console.info ? 'info' : 'log'](
  57372. 'Download the Vue Devtools extension for a better development experience:\n' +
  57373. 'https://github.com/vuejs/vue-devtools'
  57374. );
  57375. }
  57376. }
  57377. if (config.productionTip !== false &&
  57378. typeof console !== 'undefined'
  57379. ) {
  57380. console[console.info ? 'info' : 'log'](
  57381. "You are running Vue in development mode.\n" +
  57382. "Make sure to turn on production mode when deploying for production.\n" +
  57383. "See more tips at https://vuejs.org/guide/deployment.html"
  57384. );
  57385. }
  57386. }, 0);
  57387. }
  57388. /* */
  57389. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57390. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57391. var buildRegex = cached(function (delimiters) {
  57392. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57393. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57394. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57395. });
  57396. function parseText (
  57397. text,
  57398. delimiters
  57399. ) {
  57400. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57401. if (!tagRE.test(text)) {
  57402. return
  57403. }
  57404. var tokens = [];
  57405. var rawTokens = [];
  57406. var lastIndex = tagRE.lastIndex = 0;
  57407. var match, index, tokenValue;
  57408. while ((match = tagRE.exec(text))) {
  57409. index = match.index;
  57410. // push text token
  57411. if (index > lastIndex) {
  57412. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57413. tokens.push(JSON.stringify(tokenValue));
  57414. }
  57415. // tag token
  57416. var exp = parseFilters(match[1].trim());
  57417. tokens.push(("_s(" + exp + ")"));
  57418. rawTokens.push({ '@binding': exp });
  57419. lastIndex = index + match[0].length;
  57420. }
  57421. if (lastIndex < text.length) {
  57422. rawTokens.push(tokenValue = text.slice(lastIndex));
  57423. tokens.push(JSON.stringify(tokenValue));
  57424. }
  57425. return {
  57426. expression: tokens.join('+'),
  57427. tokens: rawTokens
  57428. }
  57429. }
  57430. /* */
  57431. function transformNode (el, options) {
  57432. var warn = options.warn || baseWarn;
  57433. var staticClass = getAndRemoveAttr(el, 'class');
  57434. if (staticClass) {
  57435. var res = parseText(staticClass, options.delimiters);
  57436. if (res) {
  57437. warn(
  57438. "class=\"" + staticClass + "\": " +
  57439. 'Interpolation inside attributes has been removed. ' +
  57440. 'Use v-bind or the colon shorthand instead. For example, ' +
  57441. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57442. el.rawAttrsMap['class']
  57443. );
  57444. }
  57445. }
  57446. if (staticClass) {
  57447. el.staticClass = JSON.stringify(staticClass);
  57448. }
  57449. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57450. if (classBinding) {
  57451. el.classBinding = classBinding;
  57452. }
  57453. }
  57454. function genData (el) {
  57455. var data = '';
  57456. if (el.staticClass) {
  57457. data += "staticClass:" + (el.staticClass) + ",";
  57458. }
  57459. if (el.classBinding) {
  57460. data += "class:" + (el.classBinding) + ",";
  57461. }
  57462. return data
  57463. }
  57464. var klass$1 = {
  57465. staticKeys: ['staticClass'],
  57466. transformNode: transformNode,
  57467. genData: genData
  57468. };
  57469. /* */
  57470. function transformNode$1 (el, options) {
  57471. var warn = options.warn || baseWarn;
  57472. var staticStyle = getAndRemoveAttr(el, 'style');
  57473. if (staticStyle) {
  57474. /* istanbul ignore if */
  57475. {
  57476. var res = parseText(staticStyle, options.delimiters);
  57477. if (res) {
  57478. warn(
  57479. "style=\"" + staticStyle + "\": " +
  57480. 'Interpolation inside attributes has been removed. ' +
  57481. 'Use v-bind or the colon shorthand instead. For example, ' +
  57482. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57483. el.rawAttrsMap['style']
  57484. );
  57485. }
  57486. }
  57487. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57488. }
  57489. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57490. if (styleBinding) {
  57491. el.styleBinding = styleBinding;
  57492. }
  57493. }
  57494. function genData$1 (el) {
  57495. var data = '';
  57496. if (el.staticStyle) {
  57497. data += "staticStyle:" + (el.staticStyle) + ",";
  57498. }
  57499. if (el.styleBinding) {
  57500. data += "style:(" + (el.styleBinding) + "),";
  57501. }
  57502. return data
  57503. }
  57504. var style$1 = {
  57505. staticKeys: ['staticStyle'],
  57506. transformNode: transformNode$1,
  57507. genData: genData$1
  57508. };
  57509. /* */
  57510. var decoder;
  57511. var he = {
  57512. decode: function decode (html) {
  57513. decoder = decoder || document.createElement('div');
  57514. decoder.innerHTML = html;
  57515. return decoder.textContent
  57516. }
  57517. };
  57518. /* */
  57519. var isUnaryTag = makeMap(
  57520. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57521. 'link,meta,param,source,track,wbr'
  57522. );
  57523. // Elements that you can, intentionally, leave open
  57524. // (and which close themselves)
  57525. var canBeLeftOpenTag = makeMap(
  57526. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57527. );
  57528. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57529. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57530. var isNonPhrasingTag = makeMap(
  57531. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57532. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57533. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57534. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57535. 'title,tr,track'
  57536. );
  57537. /**
  57538. * Not type-checking this file because it's mostly vendor code.
  57539. */
  57540. // Regular Expressions for parsing tags and attributes
  57541. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57542. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57543. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57544. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57545. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57546. var startTagClose = /^\s*(\/?)>/;
  57547. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57548. var doctype = /^<!DOCTYPE [^>]+>/i;
  57549. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57550. var comment = /^<!\--/;
  57551. var conditionalComment = /^<!\[/;
  57552. // Special Elements (can contain anything)
  57553. var isPlainTextElement = makeMap('script,style,textarea', true);
  57554. var reCache = {};
  57555. var decodingMap = {
  57556. '&lt;': '<',
  57557. '&gt;': '>',
  57558. '&quot;': '"',
  57559. '&amp;': '&',
  57560. '&#10;': '\n',
  57561. '&#9;': '\t',
  57562. '&#39;': "'"
  57563. };
  57564. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57565. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57566. // #5992
  57567. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57568. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57569. function decodeAttr (value, shouldDecodeNewlines) {
  57570. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57571. return value.replace(re, function (match) { return decodingMap[match]; })
  57572. }
  57573. function parseHTML (html, options) {
  57574. var stack = [];
  57575. var expectHTML = options.expectHTML;
  57576. var isUnaryTag$$1 = options.isUnaryTag || no;
  57577. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57578. var index = 0;
  57579. var last, lastTag;
  57580. while (html) {
  57581. last = html;
  57582. // Make sure we're not in a plaintext content element like script/style
  57583. if (!lastTag || !isPlainTextElement(lastTag)) {
  57584. var textEnd = html.indexOf('<');
  57585. if (textEnd === 0) {
  57586. // Comment:
  57587. if (comment.test(html)) {
  57588. var commentEnd = html.indexOf('-->');
  57589. if (commentEnd >= 0) {
  57590. if (options.shouldKeepComment) {
  57591. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57592. }
  57593. advance(commentEnd + 3);
  57594. continue
  57595. }
  57596. }
  57597. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57598. if (conditionalComment.test(html)) {
  57599. var conditionalEnd = html.indexOf(']>');
  57600. if (conditionalEnd >= 0) {
  57601. advance(conditionalEnd + 2);
  57602. continue
  57603. }
  57604. }
  57605. // Doctype:
  57606. var doctypeMatch = html.match(doctype);
  57607. if (doctypeMatch) {
  57608. advance(doctypeMatch[0].length);
  57609. continue
  57610. }
  57611. // End tag:
  57612. var endTagMatch = html.match(endTag);
  57613. if (endTagMatch) {
  57614. var curIndex = index;
  57615. advance(endTagMatch[0].length);
  57616. parseEndTag(endTagMatch[1], curIndex, index);
  57617. continue
  57618. }
  57619. // Start tag:
  57620. var startTagMatch = parseStartTag();
  57621. if (startTagMatch) {
  57622. handleStartTag(startTagMatch);
  57623. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57624. advance(1);
  57625. }
  57626. continue
  57627. }
  57628. }
  57629. var text = (void 0), rest = (void 0), next = (void 0);
  57630. if (textEnd >= 0) {
  57631. rest = html.slice(textEnd);
  57632. while (
  57633. !endTag.test(rest) &&
  57634. !startTagOpen.test(rest) &&
  57635. !comment.test(rest) &&
  57636. !conditionalComment.test(rest)
  57637. ) {
  57638. // < in plain text, be forgiving and treat it as text
  57639. next = rest.indexOf('<', 1);
  57640. if (next < 0) { break }
  57641. textEnd += next;
  57642. rest = html.slice(textEnd);
  57643. }
  57644. text = html.substring(0, textEnd);
  57645. }
  57646. if (textEnd < 0) {
  57647. text = html;
  57648. }
  57649. if (text) {
  57650. advance(text.length);
  57651. }
  57652. if (options.chars && text) {
  57653. options.chars(text, index - text.length, index);
  57654. }
  57655. } else {
  57656. var endTagLength = 0;
  57657. var stackedTag = lastTag.toLowerCase();
  57658. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57659. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57660. endTagLength = endTag.length;
  57661. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57662. text = text
  57663. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57664. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57665. }
  57666. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57667. text = text.slice(1);
  57668. }
  57669. if (options.chars) {
  57670. options.chars(text);
  57671. }
  57672. return ''
  57673. });
  57674. index += html.length - rest$1.length;
  57675. html = rest$1;
  57676. parseEndTag(stackedTag, index - endTagLength, index);
  57677. }
  57678. if (html === last) {
  57679. options.chars && options.chars(html);
  57680. if (!stack.length && options.warn) {
  57681. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57682. }
  57683. break
  57684. }
  57685. }
  57686. // Clean up any remaining tags
  57687. parseEndTag();
  57688. function advance (n) {
  57689. index += n;
  57690. html = html.substring(n);
  57691. }
  57692. function parseStartTag () {
  57693. var start = html.match(startTagOpen);
  57694. if (start) {
  57695. var match = {
  57696. tagName: start[1],
  57697. attrs: [],
  57698. start: index
  57699. };
  57700. advance(start[0].length);
  57701. var end, attr;
  57702. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57703. attr.start = index;
  57704. advance(attr[0].length);
  57705. attr.end = index;
  57706. match.attrs.push(attr);
  57707. }
  57708. if (end) {
  57709. match.unarySlash = end[1];
  57710. advance(end[0].length);
  57711. match.end = index;
  57712. return match
  57713. }
  57714. }
  57715. }
  57716. function handleStartTag (match) {
  57717. var tagName = match.tagName;
  57718. var unarySlash = match.unarySlash;
  57719. if (expectHTML) {
  57720. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57721. parseEndTag(lastTag);
  57722. }
  57723. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57724. parseEndTag(tagName);
  57725. }
  57726. }
  57727. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57728. var l = match.attrs.length;
  57729. var attrs = new Array(l);
  57730. for (var i = 0; i < l; i++) {
  57731. var args = match.attrs[i];
  57732. var value = args[3] || args[4] || args[5] || '';
  57733. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57734. ? options.shouldDecodeNewlinesForHref
  57735. : options.shouldDecodeNewlines;
  57736. attrs[i] = {
  57737. name: args[1],
  57738. value: decodeAttr(value, shouldDecodeNewlines)
  57739. };
  57740. if (options.outputSourceRange) {
  57741. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57742. attrs[i].end = args.end;
  57743. }
  57744. }
  57745. if (!unary) {
  57746. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57747. lastTag = tagName;
  57748. }
  57749. if (options.start) {
  57750. options.start(tagName, attrs, unary, match.start, match.end);
  57751. }
  57752. }
  57753. function parseEndTag (tagName, start, end) {
  57754. var pos, lowerCasedTagName;
  57755. if (start == null) { start = index; }
  57756. if (end == null) { end = index; }
  57757. // Find the closest opened tag of the same type
  57758. if (tagName) {
  57759. lowerCasedTagName = tagName.toLowerCase();
  57760. for (pos = stack.length - 1; pos >= 0; pos--) {
  57761. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57762. break
  57763. }
  57764. }
  57765. } else {
  57766. // If no tag name is provided, clean shop
  57767. pos = 0;
  57768. }
  57769. if (pos >= 0) {
  57770. // Close all the open elements, up the stack
  57771. for (var i = stack.length - 1; i >= pos; i--) {
  57772. if (i > pos || !tagName &&
  57773. options.warn
  57774. ) {
  57775. options.warn(
  57776. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57777. { start: stack[i].start, end: stack[i].end }
  57778. );
  57779. }
  57780. if (options.end) {
  57781. options.end(stack[i].tag, start, end);
  57782. }
  57783. }
  57784. // Remove the open elements from the stack
  57785. stack.length = pos;
  57786. lastTag = pos && stack[pos - 1].tag;
  57787. } else if (lowerCasedTagName === 'br') {
  57788. if (options.start) {
  57789. options.start(tagName, [], true, start, end);
  57790. }
  57791. } else if (lowerCasedTagName === 'p') {
  57792. if (options.start) {
  57793. options.start(tagName, [], false, start, end);
  57794. }
  57795. if (options.end) {
  57796. options.end(tagName, start, end);
  57797. }
  57798. }
  57799. }
  57800. }
  57801. /* */
  57802. var onRE = /^@|^v-on:/;
  57803. var dirRE = /^v-|^@|^:|^#/;
  57804. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57805. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57806. var stripParensRE = /^\(|\)$/g;
  57807. var dynamicArgRE = /^\[.*\]$/;
  57808. var argRE = /:(.*)$/;
  57809. var bindRE = /^:|^\.|^v-bind:/;
  57810. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57811. var slotRE = /^v-slot(:|$)|^#/;
  57812. var lineBreakRE = /[\r\n]/;
  57813. var whitespaceRE$1 = /\s+/g;
  57814. var invalidAttributeRE = /[\s"'<>\/=]/;
  57815. var decodeHTMLCached = cached(he.decode);
  57816. var emptySlotScopeToken = "_empty_";
  57817. // configurable state
  57818. var warn$2;
  57819. var delimiters;
  57820. var transforms;
  57821. var preTransforms;
  57822. var postTransforms;
  57823. var platformIsPreTag;
  57824. var platformMustUseProp;
  57825. var platformGetTagNamespace;
  57826. var maybeComponent;
  57827. function createASTElement (
  57828. tag,
  57829. attrs,
  57830. parent
  57831. ) {
  57832. return {
  57833. type: 1,
  57834. tag: tag,
  57835. attrsList: attrs,
  57836. attrsMap: makeAttrsMap(attrs),
  57837. rawAttrsMap: {},
  57838. parent: parent,
  57839. children: []
  57840. }
  57841. }
  57842. /**
  57843. * Convert HTML string to AST.
  57844. */
  57845. function parse (
  57846. template,
  57847. options
  57848. ) {
  57849. warn$2 = options.warn || baseWarn;
  57850. platformIsPreTag = options.isPreTag || no;
  57851. platformMustUseProp = options.mustUseProp || no;
  57852. platformGetTagNamespace = options.getTagNamespace || no;
  57853. var isReservedTag = options.isReservedTag || no;
  57854. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57855. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57856. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57857. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57858. delimiters = options.delimiters;
  57859. var stack = [];
  57860. var preserveWhitespace = options.preserveWhitespace !== false;
  57861. var whitespaceOption = options.whitespace;
  57862. var root;
  57863. var currentParent;
  57864. var inVPre = false;
  57865. var inPre = false;
  57866. var warned = false;
  57867. function warnOnce (msg, range) {
  57868. if (!warned) {
  57869. warned = true;
  57870. warn$2(msg, range);
  57871. }
  57872. }
  57873. function closeElement (element) {
  57874. trimEndingWhitespace(element);
  57875. if (!inVPre && !element.processed) {
  57876. element = processElement(element, options);
  57877. }
  57878. // tree management
  57879. if (!stack.length && element !== root) {
  57880. // allow root elements with v-if, v-else-if and v-else
  57881. if (root.if && (element.elseif || element.else)) {
  57882. {
  57883. checkRootConstraints(element);
  57884. }
  57885. addIfCondition(root, {
  57886. exp: element.elseif,
  57887. block: element
  57888. });
  57889. } else {
  57890. warnOnce(
  57891. "Component template should contain exactly one root element. " +
  57892. "If you are using v-if on multiple elements, " +
  57893. "use v-else-if to chain them instead.",
  57894. { start: element.start }
  57895. );
  57896. }
  57897. }
  57898. if (currentParent && !element.forbidden) {
  57899. if (element.elseif || element.else) {
  57900. processIfConditions(element, currentParent);
  57901. } else {
  57902. if (element.slotScope) {
  57903. // scoped slot
  57904. // keep it in the children list so that v-else(-if) conditions can
  57905. // find it as the prev node.
  57906. var name = element.slotTarget || '"default"'
  57907. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  57908. }
  57909. currentParent.children.push(element);
  57910. element.parent = currentParent;
  57911. }
  57912. }
  57913. // final children cleanup
  57914. // filter out scoped slots
  57915. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  57916. // remove trailing whitespace node again
  57917. trimEndingWhitespace(element);
  57918. // check pre state
  57919. if (element.pre) {
  57920. inVPre = false;
  57921. }
  57922. if (platformIsPreTag(element.tag)) {
  57923. inPre = false;
  57924. }
  57925. // apply post-transforms
  57926. for (var i = 0; i < postTransforms.length; i++) {
  57927. postTransforms[i](element, options);
  57928. }
  57929. }
  57930. function trimEndingWhitespace (el) {
  57931. // remove trailing whitespace node
  57932. if (!inPre) {
  57933. var lastNode;
  57934. while (
  57935. (lastNode = el.children[el.children.length - 1]) &&
  57936. lastNode.type === 3 &&
  57937. lastNode.text === ' '
  57938. ) {
  57939. el.children.pop();
  57940. }
  57941. }
  57942. }
  57943. function checkRootConstraints (el) {
  57944. if (el.tag === 'slot' || el.tag === 'template') {
  57945. warnOnce(
  57946. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  57947. 'contain multiple nodes.',
  57948. { start: el.start }
  57949. );
  57950. }
  57951. if (el.attrsMap.hasOwnProperty('v-for')) {
  57952. warnOnce(
  57953. 'Cannot use v-for on stateful component root element because ' +
  57954. 'it renders multiple elements.',
  57955. el.rawAttrsMap['v-for']
  57956. );
  57957. }
  57958. }
  57959. parseHTML(template, {
  57960. warn: warn$2,
  57961. expectHTML: options.expectHTML,
  57962. isUnaryTag: options.isUnaryTag,
  57963. canBeLeftOpenTag: options.canBeLeftOpenTag,
  57964. shouldDecodeNewlines: options.shouldDecodeNewlines,
  57965. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  57966. shouldKeepComment: options.comments,
  57967. outputSourceRange: options.outputSourceRange,
  57968. start: function start (tag, attrs, unary, start$1, end) {
  57969. // check namespace.
  57970. // inherit parent ns if there is one
  57971. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  57972. // handle IE svg bug
  57973. /* istanbul ignore if */
  57974. if (isIE && ns === 'svg') {
  57975. attrs = guardIESVGBug(attrs);
  57976. }
  57977. var element = createASTElement(tag, attrs, currentParent);
  57978. if (ns) {
  57979. element.ns = ns;
  57980. }
  57981. {
  57982. if (options.outputSourceRange) {
  57983. element.start = start$1;
  57984. element.end = end;
  57985. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  57986. cumulated[attr.name] = attr;
  57987. return cumulated
  57988. }, {});
  57989. }
  57990. attrs.forEach(function (attr) {
  57991. if (invalidAttributeRE.test(attr.name)) {
  57992. warn$2(
  57993. "Invalid dynamic argument expression: attribute names cannot contain " +
  57994. "spaces, quotes, <, >, / or =.",
  57995. {
  57996. start: attr.start + attr.name.indexOf("["),
  57997. end: attr.start + attr.name.length
  57998. }
  57999. );
  58000. }
  58001. });
  58002. }
  58003. if (isForbiddenTag(element) && !isServerRendering()) {
  58004. element.forbidden = true;
  58005. warn$2(
  58006. 'Templates should only be responsible for mapping the state to the ' +
  58007. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58008. "<" + tag + ">" + ', as they will not be parsed.',
  58009. { start: element.start }
  58010. );
  58011. }
  58012. // apply pre-transforms
  58013. for (var i = 0; i < preTransforms.length; i++) {
  58014. element = preTransforms[i](element, options) || element;
  58015. }
  58016. if (!inVPre) {
  58017. processPre(element);
  58018. if (element.pre) {
  58019. inVPre = true;
  58020. }
  58021. }
  58022. if (platformIsPreTag(element.tag)) {
  58023. inPre = true;
  58024. }
  58025. if (inVPre) {
  58026. processRawAttrs(element);
  58027. } else if (!element.processed) {
  58028. // structural directives
  58029. processFor(element);
  58030. processIf(element);
  58031. processOnce(element);
  58032. }
  58033. if (!root) {
  58034. root = element;
  58035. {
  58036. checkRootConstraints(root);
  58037. }
  58038. }
  58039. if (!unary) {
  58040. currentParent = element;
  58041. stack.push(element);
  58042. } else {
  58043. closeElement(element);
  58044. }
  58045. },
  58046. end: function end (tag, start, end$1) {
  58047. var element = stack[stack.length - 1];
  58048. // pop stack
  58049. stack.length -= 1;
  58050. currentParent = stack[stack.length - 1];
  58051. if (options.outputSourceRange) {
  58052. element.end = end$1;
  58053. }
  58054. closeElement(element);
  58055. },
  58056. chars: function chars (text, start, end) {
  58057. if (!currentParent) {
  58058. {
  58059. if (text === template) {
  58060. warnOnce(
  58061. 'Component template requires a root element, rather than just text.',
  58062. { start: start }
  58063. );
  58064. } else if ((text = text.trim())) {
  58065. warnOnce(
  58066. ("text \"" + text + "\" outside root element will be ignored."),
  58067. { start: start }
  58068. );
  58069. }
  58070. }
  58071. return
  58072. }
  58073. // IE textarea placeholder bug
  58074. /* istanbul ignore if */
  58075. if (isIE &&
  58076. currentParent.tag === 'textarea' &&
  58077. currentParent.attrsMap.placeholder === text
  58078. ) {
  58079. return
  58080. }
  58081. var children = currentParent.children;
  58082. if (inPre || text.trim()) {
  58083. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58084. } else if (!children.length) {
  58085. // remove the whitespace-only node right after an opening tag
  58086. text = '';
  58087. } else if (whitespaceOption) {
  58088. if (whitespaceOption === 'condense') {
  58089. // in condense mode, remove the whitespace node if it contains
  58090. // line break, otherwise condense to a single space
  58091. text = lineBreakRE.test(text) ? '' : ' ';
  58092. } else {
  58093. text = ' ';
  58094. }
  58095. } else {
  58096. text = preserveWhitespace ? ' ' : '';
  58097. }
  58098. if (text) {
  58099. if (!inPre && whitespaceOption === 'condense') {
  58100. // condense consecutive whitespaces into single space
  58101. text = text.replace(whitespaceRE$1, ' ');
  58102. }
  58103. var res;
  58104. var child;
  58105. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58106. child = {
  58107. type: 2,
  58108. expression: res.expression,
  58109. tokens: res.tokens,
  58110. text: text
  58111. };
  58112. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58113. child = {
  58114. type: 3,
  58115. text: text
  58116. };
  58117. }
  58118. if (child) {
  58119. if (options.outputSourceRange) {
  58120. child.start = start;
  58121. child.end = end;
  58122. }
  58123. children.push(child);
  58124. }
  58125. }
  58126. },
  58127. comment: function comment (text, start, end) {
  58128. // adding anyting as a sibling to the root node is forbidden
  58129. // comments should still be allowed, but ignored
  58130. if (currentParent) {
  58131. var child = {
  58132. type: 3,
  58133. text: text,
  58134. isComment: true
  58135. };
  58136. if (options.outputSourceRange) {
  58137. child.start = start;
  58138. child.end = end;
  58139. }
  58140. currentParent.children.push(child);
  58141. }
  58142. }
  58143. });
  58144. return root
  58145. }
  58146. function processPre (el) {
  58147. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58148. el.pre = true;
  58149. }
  58150. }
  58151. function processRawAttrs (el) {
  58152. var list = el.attrsList;
  58153. var len = list.length;
  58154. if (len) {
  58155. var attrs = el.attrs = new Array(len);
  58156. for (var i = 0; i < len; i++) {
  58157. attrs[i] = {
  58158. name: list[i].name,
  58159. value: JSON.stringify(list[i].value)
  58160. };
  58161. if (list[i].start != null) {
  58162. attrs[i].start = list[i].start;
  58163. attrs[i].end = list[i].end;
  58164. }
  58165. }
  58166. } else if (!el.pre) {
  58167. // non root node in pre blocks with no attributes
  58168. el.plain = true;
  58169. }
  58170. }
  58171. function processElement (
  58172. element,
  58173. options
  58174. ) {
  58175. processKey(element);
  58176. // determine whether this is a plain element after
  58177. // removing structural attributes
  58178. element.plain = (
  58179. !element.key &&
  58180. !element.scopedSlots &&
  58181. !element.attrsList.length
  58182. );
  58183. processRef(element);
  58184. processSlotContent(element);
  58185. processSlotOutlet(element);
  58186. processComponent(element);
  58187. for (var i = 0; i < transforms.length; i++) {
  58188. element = transforms[i](element, options) || element;
  58189. }
  58190. processAttrs(element);
  58191. return element
  58192. }
  58193. function processKey (el) {
  58194. var exp = getBindingAttr(el, 'key');
  58195. if (exp) {
  58196. {
  58197. if (el.tag === 'template') {
  58198. warn$2(
  58199. "<template> cannot be keyed. Place the key on real elements instead.",
  58200. getRawBindingAttr(el, 'key')
  58201. );
  58202. }
  58203. if (el.for) {
  58204. var iterator = el.iterator2 || el.iterator1;
  58205. var parent = el.parent;
  58206. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58207. warn$2(
  58208. "Do not use v-for index as key on <transition-group> children, " +
  58209. "this is the same as not using keys.",
  58210. getRawBindingAttr(el, 'key'),
  58211. true /* tip */
  58212. );
  58213. }
  58214. }
  58215. }
  58216. el.key = exp;
  58217. }
  58218. }
  58219. function processRef (el) {
  58220. var ref = getBindingAttr(el, 'ref');
  58221. if (ref) {
  58222. el.ref = ref;
  58223. el.refInFor = checkInFor(el);
  58224. }
  58225. }
  58226. function processFor (el) {
  58227. var exp;
  58228. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58229. var res = parseFor(exp);
  58230. if (res) {
  58231. extend(el, res);
  58232. } else {
  58233. warn$2(
  58234. ("Invalid v-for expression: " + exp),
  58235. el.rawAttrsMap['v-for']
  58236. );
  58237. }
  58238. }
  58239. }
  58240. function parseFor (exp) {
  58241. var inMatch = exp.match(forAliasRE);
  58242. if (!inMatch) { return }
  58243. var res = {};
  58244. res.for = inMatch[2].trim();
  58245. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58246. var iteratorMatch = alias.match(forIteratorRE);
  58247. if (iteratorMatch) {
  58248. res.alias = alias.replace(forIteratorRE, '').trim();
  58249. res.iterator1 = iteratorMatch[1].trim();
  58250. if (iteratorMatch[2]) {
  58251. res.iterator2 = iteratorMatch[2].trim();
  58252. }
  58253. } else {
  58254. res.alias = alias;
  58255. }
  58256. return res
  58257. }
  58258. function processIf (el) {
  58259. var exp = getAndRemoveAttr(el, 'v-if');
  58260. if (exp) {
  58261. el.if = exp;
  58262. addIfCondition(el, {
  58263. exp: exp,
  58264. block: el
  58265. });
  58266. } else {
  58267. if (getAndRemoveAttr(el, 'v-else') != null) {
  58268. el.else = true;
  58269. }
  58270. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58271. if (elseif) {
  58272. el.elseif = elseif;
  58273. }
  58274. }
  58275. }
  58276. function processIfConditions (el, parent) {
  58277. var prev = findPrevElement(parent.children);
  58278. if (prev && prev.if) {
  58279. addIfCondition(prev, {
  58280. exp: el.elseif,
  58281. block: el
  58282. });
  58283. } else {
  58284. warn$2(
  58285. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58286. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58287. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58288. );
  58289. }
  58290. }
  58291. function findPrevElement (children) {
  58292. var i = children.length;
  58293. while (i--) {
  58294. if (children[i].type === 1) {
  58295. return children[i]
  58296. } else {
  58297. if (children[i].text !== ' ') {
  58298. warn$2(
  58299. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58300. "will be ignored.",
  58301. children[i]
  58302. );
  58303. }
  58304. children.pop();
  58305. }
  58306. }
  58307. }
  58308. function addIfCondition (el, condition) {
  58309. if (!el.ifConditions) {
  58310. el.ifConditions = [];
  58311. }
  58312. el.ifConditions.push(condition);
  58313. }
  58314. function processOnce (el) {
  58315. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58316. if (once$$1 != null) {
  58317. el.once = true;
  58318. }
  58319. }
  58320. // handle content being passed to a component as slot,
  58321. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58322. function processSlotContent (el) {
  58323. var slotScope;
  58324. if (el.tag === 'template') {
  58325. slotScope = getAndRemoveAttr(el, 'scope');
  58326. /* istanbul ignore if */
  58327. if (slotScope) {
  58328. warn$2(
  58329. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58330. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58331. "can also be used on plain elements in addition to <template> to " +
  58332. "denote scoped slots.",
  58333. el.rawAttrsMap['scope'],
  58334. true
  58335. );
  58336. }
  58337. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58338. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58339. /* istanbul ignore if */
  58340. if (el.attrsMap['v-for']) {
  58341. warn$2(
  58342. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58343. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58344. "scoped slot to make it clearer.",
  58345. el.rawAttrsMap['slot-scope'],
  58346. true
  58347. );
  58348. }
  58349. el.slotScope = slotScope;
  58350. }
  58351. // slot="xxx"
  58352. var slotTarget = getBindingAttr(el, 'slot');
  58353. if (slotTarget) {
  58354. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58355. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58356. // preserve slot as an attribute for native shadow DOM compat
  58357. // only for non-scoped slots.
  58358. if (el.tag !== 'template' && !el.slotScope) {
  58359. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58360. }
  58361. }
  58362. // 2.6 v-slot syntax
  58363. {
  58364. if (el.tag === 'template') {
  58365. // v-slot on <template>
  58366. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58367. if (slotBinding) {
  58368. {
  58369. if (el.slotTarget || el.slotScope) {
  58370. warn$2(
  58371. "Unexpected mixed usage of different slot syntaxes.",
  58372. el
  58373. );
  58374. }
  58375. if (el.parent && !maybeComponent(el.parent)) {
  58376. warn$2(
  58377. "<template v-slot> can only appear at the root level inside " +
  58378. "the receiving component",
  58379. el
  58380. );
  58381. }
  58382. }
  58383. var ref = getSlotName(slotBinding);
  58384. var name = ref.name;
  58385. var dynamic = ref.dynamic;
  58386. el.slotTarget = name;
  58387. el.slotTargetDynamic = dynamic;
  58388. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58389. }
  58390. } else {
  58391. // v-slot on component, denotes default slot
  58392. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58393. if (slotBinding$1) {
  58394. {
  58395. if (!maybeComponent(el)) {
  58396. warn$2(
  58397. "v-slot can only be used on components or <template>.",
  58398. slotBinding$1
  58399. );
  58400. }
  58401. if (el.slotScope || el.slotTarget) {
  58402. warn$2(
  58403. "Unexpected mixed usage of different slot syntaxes.",
  58404. el
  58405. );
  58406. }
  58407. if (el.scopedSlots) {
  58408. warn$2(
  58409. "To avoid scope ambiguity, the default slot should also use " +
  58410. "<template> syntax when there are other named slots.",
  58411. slotBinding$1
  58412. );
  58413. }
  58414. }
  58415. // add the component's children to its default slot
  58416. var slots = el.scopedSlots || (el.scopedSlots = {});
  58417. var ref$1 = getSlotName(slotBinding$1);
  58418. var name$1 = ref$1.name;
  58419. var dynamic$1 = ref$1.dynamic;
  58420. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58421. slotContainer.slotTarget = name$1;
  58422. slotContainer.slotTargetDynamic = dynamic$1;
  58423. slotContainer.children = el.children.filter(function (c) {
  58424. if (!c.slotScope) {
  58425. c.parent = slotContainer;
  58426. return true
  58427. }
  58428. });
  58429. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58430. // remove children as they are returned from scopedSlots now
  58431. el.children = [];
  58432. // mark el non-plain so data gets generated
  58433. el.plain = false;
  58434. }
  58435. }
  58436. }
  58437. }
  58438. function getSlotName (binding) {
  58439. var name = binding.name.replace(slotRE, '');
  58440. if (!name) {
  58441. if (binding.name[0] !== '#') {
  58442. name = 'default';
  58443. } else {
  58444. warn$2(
  58445. "v-slot shorthand syntax requires a slot name.",
  58446. binding
  58447. );
  58448. }
  58449. }
  58450. return dynamicArgRE.test(name)
  58451. // dynamic [name]
  58452. ? { name: name.slice(1, -1), dynamic: true }
  58453. // static name
  58454. : { name: ("\"" + name + "\""), dynamic: false }
  58455. }
  58456. // handle <slot/> outlets
  58457. function processSlotOutlet (el) {
  58458. if (el.tag === 'slot') {
  58459. el.slotName = getBindingAttr(el, 'name');
  58460. if (el.key) {
  58461. warn$2(
  58462. "`key` does not work on <slot> because slots are abstract outlets " +
  58463. "and can possibly expand into multiple elements. " +
  58464. "Use the key on a wrapping element instead.",
  58465. getRawBindingAttr(el, 'key')
  58466. );
  58467. }
  58468. }
  58469. }
  58470. function processComponent (el) {
  58471. var binding;
  58472. if ((binding = getBindingAttr(el, 'is'))) {
  58473. el.component = binding;
  58474. }
  58475. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58476. el.inlineTemplate = true;
  58477. }
  58478. }
  58479. function processAttrs (el) {
  58480. var list = el.attrsList;
  58481. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58482. for (i = 0, l = list.length; i < l; i++) {
  58483. name = rawName = list[i].name;
  58484. value = list[i].value;
  58485. if (dirRE.test(name)) {
  58486. // mark element as dynamic
  58487. el.hasBindings = true;
  58488. // modifiers
  58489. modifiers = parseModifiers(name.replace(dirRE, ''));
  58490. // support .foo shorthand syntax for the .prop modifier
  58491. if (modifiers) {
  58492. name = name.replace(modifierRE, '');
  58493. }
  58494. if (bindRE.test(name)) { // v-bind
  58495. name = name.replace(bindRE, '');
  58496. value = parseFilters(value);
  58497. isDynamic = dynamicArgRE.test(name);
  58498. if (isDynamic) {
  58499. name = name.slice(1, -1);
  58500. }
  58501. if (
  58502. value.trim().length === 0
  58503. ) {
  58504. warn$2(
  58505. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58506. );
  58507. }
  58508. if (modifiers) {
  58509. if (modifiers.prop && !isDynamic) {
  58510. name = camelize(name);
  58511. if (name === 'innerHtml') { name = 'innerHTML'; }
  58512. }
  58513. if (modifiers.camel && !isDynamic) {
  58514. name = camelize(name);
  58515. }
  58516. if (modifiers.sync) {
  58517. syncGen = genAssignmentCode(value, "$event");
  58518. if (!isDynamic) {
  58519. addHandler(
  58520. el,
  58521. ("update:" + (camelize(name))),
  58522. syncGen,
  58523. null,
  58524. false,
  58525. warn$2,
  58526. list[i]
  58527. );
  58528. if (hyphenate(name) !== camelize(name)) {
  58529. addHandler(
  58530. el,
  58531. ("update:" + (hyphenate(name))),
  58532. syncGen,
  58533. null,
  58534. false,
  58535. warn$2,
  58536. list[i]
  58537. );
  58538. }
  58539. } else {
  58540. // handler w/ dynamic event name
  58541. addHandler(
  58542. el,
  58543. ("\"update:\"+(" + name + ")"),
  58544. syncGen,
  58545. null,
  58546. false,
  58547. warn$2,
  58548. list[i],
  58549. true // dynamic
  58550. );
  58551. }
  58552. }
  58553. }
  58554. if ((modifiers && modifiers.prop) || (
  58555. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58556. )) {
  58557. addProp(el, name, value, list[i], isDynamic);
  58558. } else {
  58559. addAttr(el, name, value, list[i], isDynamic);
  58560. }
  58561. } else if (onRE.test(name)) { // v-on
  58562. name = name.replace(onRE, '');
  58563. isDynamic = dynamicArgRE.test(name);
  58564. if (isDynamic) {
  58565. name = name.slice(1, -1);
  58566. }
  58567. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58568. } else { // normal directives
  58569. name = name.replace(dirRE, '');
  58570. // parse arg
  58571. var argMatch = name.match(argRE);
  58572. var arg = argMatch && argMatch[1];
  58573. isDynamic = false;
  58574. if (arg) {
  58575. name = name.slice(0, -(arg.length + 1));
  58576. if (dynamicArgRE.test(arg)) {
  58577. arg = arg.slice(1, -1);
  58578. isDynamic = true;
  58579. }
  58580. }
  58581. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58582. if (name === 'model') {
  58583. checkForAliasModel(el, value);
  58584. }
  58585. }
  58586. } else {
  58587. // literal attribute
  58588. {
  58589. var res = parseText(value, delimiters);
  58590. if (res) {
  58591. warn$2(
  58592. name + "=\"" + value + "\": " +
  58593. 'Interpolation inside attributes has been removed. ' +
  58594. 'Use v-bind or the colon shorthand instead. For example, ' +
  58595. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58596. list[i]
  58597. );
  58598. }
  58599. }
  58600. addAttr(el, name, JSON.stringify(value), list[i]);
  58601. // #6887 firefox doesn't update muted state if set via attribute
  58602. // even immediately after element creation
  58603. if (!el.component &&
  58604. name === 'muted' &&
  58605. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58606. addProp(el, name, 'true', list[i]);
  58607. }
  58608. }
  58609. }
  58610. }
  58611. function checkInFor (el) {
  58612. var parent = el;
  58613. while (parent) {
  58614. if (parent.for !== undefined) {
  58615. return true
  58616. }
  58617. parent = parent.parent;
  58618. }
  58619. return false
  58620. }
  58621. function parseModifiers (name) {
  58622. var match = name.match(modifierRE);
  58623. if (match) {
  58624. var ret = {};
  58625. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58626. return ret
  58627. }
  58628. }
  58629. function makeAttrsMap (attrs) {
  58630. var map = {};
  58631. for (var i = 0, l = attrs.length; i < l; i++) {
  58632. if (
  58633. map[attrs[i].name] && !isIE && !isEdge
  58634. ) {
  58635. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58636. }
  58637. map[attrs[i].name] = attrs[i].value;
  58638. }
  58639. return map
  58640. }
  58641. // for script (e.g. type="x/template") or style, do not decode content
  58642. function isTextTag (el) {
  58643. return el.tag === 'script' || el.tag === 'style'
  58644. }
  58645. function isForbiddenTag (el) {
  58646. return (
  58647. el.tag === 'style' ||
  58648. (el.tag === 'script' && (
  58649. !el.attrsMap.type ||
  58650. el.attrsMap.type === 'text/javascript'
  58651. ))
  58652. )
  58653. }
  58654. var ieNSBug = /^xmlns:NS\d+/;
  58655. var ieNSPrefix = /^NS\d+:/;
  58656. /* istanbul ignore next */
  58657. function guardIESVGBug (attrs) {
  58658. var res = [];
  58659. for (var i = 0; i < attrs.length; i++) {
  58660. var attr = attrs[i];
  58661. if (!ieNSBug.test(attr.name)) {
  58662. attr.name = attr.name.replace(ieNSPrefix, '');
  58663. res.push(attr);
  58664. }
  58665. }
  58666. return res
  58667. }
  58668. function checkForAliasModel (el, value) {
  58669. var _el = el;
  58670. while (_el) {
  58671. if (_el.for && _el.alias === value) {
  58672. warn$2(
  58673. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58674. "You are binding v-model directly to a v-for iteration alias. " +
  58675. "This will not be able to modify the v-for source array because " +
  58676. "writing to the alias is like modifying a function local variable. " +
  58677. "Consider using an array of objects and use v-model on an object property instead.",
  58678. el.rawAttrsMap['v-model']
  58679. );
  58680. }
  58681. _el = _el.parent;
  58682. }
  58683. }
  58684. /* */
  58685. function preTransformNode (el, options) {
  58686. if (el.tag === 'input') {
  58687. var map = el.attrsMap;
  58688. if (!map['v-model']) {
  58689. return
  58690. }
  58691. var typeBinding;
  58692. if (map[':type'] || map['v-bind:type']) {
  58693. typeBinding = getBindingAttr(el, 'type');
  58694. }
  58695. if (!map.type && !typeBinding && map['v-bind']) {
  58696. typeBinding = "(" + (map['v-bind']) + ").type";
  58697. }
  58698. if (typeBinding) {
  58699. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58700. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58701. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58702. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58703. // 1. checkbox
  58704. var branch0 = cloneASTElement(el);
  58705. // process for on the main node
  58706. processFor(branch0);
  58707. addRawAttr(branch0, 'type', 'checkbox');
  58708. processElement(branch0, options);
  58709. branch0.processed = true; // prevent it from double-processed
  58710. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58711. addIfCondition(branch0, {
  58712. exp: branch0.if,
  58713. block: branch0
  58714. });
  58715. // 2. add radio else-if condition
  58716. var branch1 = cloneASTElement(el);
  58717. getAndRemoveAttr(branch1, 'v-for', true);
  58718. addRawAttr(branch1, 'type', 'radio');
  58719. processElement(branch1, options);
  58720. addIfCondition(branch0, {
  58721. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58722. block: branch1
  58723. });
  58724. // 3. other
  58725. var branch2 = cloneASTElement(el);
  58726. getAndRemoveAttr(branch2, 'v-for', true);
  58727. addRawAttr(branch2, ':type', typeBinding);
  58728. processElement(branch2, options);
  58729. addIfCondition(branch0, {
  58730. exp: ifCondition,
  58731. block: branch2
  58732. });
  58733. if (hasElse) {
  58734. branch0.else = true;
  58735. } else if (elseIfCondition) {
  58736. branch0.elseif = elseIfCondition;
  58737. }
  58738. return branch0
  58739. }
  58740. }
  58741. }
  58742. function cloneASTElement (el) {
  58743. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58744. }
  58745. var model$1 = {
  58746. preTransformNode: preTransformNode
  58747. };
  58748. var modules$1 = [
  58749. klass$1,
  58750. style$1,
  58751. model$1
  58752. ];
  58753. /* */
  58754. function text (el, dir) {
  58755. if (dir.value) {
  58756. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58757. }
  58758. }
  58759. /* */
  58760. function html (el, dir) {
  58761. if (dir.value) {
  58762. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58763. }
  58764. }
  58765. var directives$1 = {
  58766. model: model,
  58767. text: text,
  58768. html: html
  58769. };
  58770. /* */
  58771. var baseOptions = {
  58772. expectHTML: true,
  58773. modules: modules$1,
  58774. directives: directives$1,
  58775. isPreTag: isPreTag,
  58776. isUnaryTag: isUnaryTag,
  58777. mustUseProp: mustUseProp,
  58778. canBeLeftOpenTag: canBeLeftOpenTag,
  58779. isReservedTag: isReservedTag,
  58780. getTagNamespace: getTagNamespace,
  58781. staticKeys: genStaticKeys(modules$1)
  58782. };
  58783. /* */
  58784. var isStaticKey;
  58785. var isPlatformReservedTag;
  58786. var genStaticKeysCached = cached(genStaticKeys$1);
  58787. /**
  58788. * Goal of the optimizer: walk the generated template AST tree
  58789. * and detect sub-trees that are purely static, i.e. parts of
  58790. * the DOM that never needs to change.
  58791. *
  58792. * Once we detect these sub-trees, we can:
  58793. *
  58794. * 1. Hoist them into constants, so that we no longer need to
  58795. * create fresh nodes for them on each re-render;
  58796. * 2. Completely skip them in the patching process.
  58797. */
  58798. function optimize (root, options) {
  58799. if (!root) { return }
  58800. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58801. isPlatformReservedTag = options.isReservedTag || no;
  58802. // first pass: mark all non-static nodes.
  58803. markStatic$1(root);
  58804. // second pass: mark static roots.
  58805. markStaticRoots(root, false);
  58806. }
  58807. function genStaticKeys$1 (keys) {
  58808. return makeMap(
  58809. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58810. (keys ? ',' + keys : '')
  58811. )
  58812. }
  58813. function markStatic$1 (node) {
  58814. node.static = isStatic(node);
  58815. if (node.type === 1) {
  58816. // do not make component slot content static. this avoids
  58817. // 1. components not able to mutate slot nodes
  58818. // 2. static slot content fails for hot-reloading
  58819. if (
  58820. !isPlatformReservedTag(node.tag) &&
  58821. node.tag !== 'slot' &&
  58822. node.attrsMap['inline-template'] == null
  58823. ) {
  58824. return
  58825. }
  58826. for (var i = 0, l = node.children.length; i < l; i++) {
  58827. var child = node.children[i];
  58828. markStatic$1(child);
  58829. if (!child.static) {
  58830. node.static = false;
  58831. }
  58832. }
  58833. if (node.ifConditions) {
  58834. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58835. var block = node.ifConditions[i$1].block;
  58836. markStatic$1(block);
  58837. if (!block.static) {
  58838. node.static = false;
  58839. }
  58840. }
  58841. }
  58842. }
  58843. }
  58844. function markStaticRoots (node, isInFor) {
  58845. if (node.type === 1) {
  58846. if (node.static || node.once) {
  58847. node.staticInFor = isInFor;
  58848. }
  58849. // For a node to qualify as a static root, it should have children that
  58850. // are not just static text. Otherwise the cost of hoisting out will
  58851. // outweigh the benefits and it's better off to just always render it fresh.
  58852. if (node.static && node.children.length && !(
  58853. node.children.length === 1 &&
  58854. node.children[0].type === 3
  58855. )) {
  58856. node.staticRoot = true;
  58857. return
  58858. } else {
  58859. node.staticRoot = false;
  58860. }
  58861. if (node.children) {
  58862. for (var i = 0, l = node.children.length; i < l; i++) {
  58863. markStaticRoots(node.children[i], isInFor || !!node.for);
  58864. }
  58865. }
  58866. if (node.ifConditions) {
  58867. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58868. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58869. }
  58870. }
  58871. }
  58872. }
  58873. function isStatic (node) {
  58874. if (node.type === 2) { // expression
  58875. return false
  58876. }
  58877. if (node.type === 3) { // text
  58878. return true
  58879. }
  58880. return !!(node.pre || (
  58881. !node.hasBindings && // no dynamic bindings
  58882. !node.if && !node.for && // not v-if or v-for or v-else
  58883. !isBuiltInTag(node.tag) && // not a built-in
  58884. isPlatformReservedTag(node.tag) && // not a component
  58885. !isDirectChildOfTemplateFor(node) &&
  58886. Object.keys(node).every(isStaticKey)
  58887. ))
  58888. }
  58889. function isDirectChildOfTemplateFor (node) {
  58890. while (node.parent) {
  58891. node = node.parent;
  58892. if (node.tag !== 'template') {
  58893. return false
  58894. }
  58895. if (node.for) {
  58896. return true
  58897. }
  58898. }
  58899. return false
  58900. }
  58901. /* */
  58902. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  58903. var fnInvokeRE = /\([^)]*?\);*$/;
  58904. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  58905. // KeyboardEvent.keyCode aliases
  58906. var keyCodes = {
  58907. esc: 27,
  58908. tab: 9,
  58909. enter: 13,
  58910. space: 32,
  58911. up: 38,
  58912. left: 37,
  58913. right: 39,
  58914. down: 40,
  58915. 'delete': [8, 46]
  58916. };
  58917. // KeyboardEvent.key aliases
  58918. var keyNames = {
  58919. // #7880: IE11 and Edge use `Esc` for Escape key name.
  58920. esc: ['Esc', 'Escape'],
  58921. tab: 'Tab',
  58922. enter: 'Enter',
  58923. // #9112: IE11 uses `Spacebar` for Space key name.
  58924. space: [' ', 'Spacebar'],
  58925. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  58926. up: ['Up', 'ArrowUp'],
  58927. left: ['Left', 'ArrowLeft'],
  58928. right: ['Right', 'ArrowRight'],
  58929. down: ['Down', 'ArrowDown'],
  58930. // #9112: IE11 uses `Del` for Delete key name.
  58931. 'delete': ['Backspace', 'Delete', 'Del']
  58932. };
  58933. // #4868: modifiers that prevent the execution of the listener
  58934. // need to explicitly return null so that we can determine whether to remove
  58935. // the listener for .once
  58936. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  58937. var modifierCode = {
  58938. stop: '$event.stopPropagation();',
  58939. prevent: '$event.preventDefault();',
  58940. self: genGuard("$event.target !== $event.currentTarget"),
  58941. ctrl: genGuard("!$event.ctrlKey"),
  58942. shift: genGuard("!$event.shiftKey"),
  58943. alt: genGuard("!$event.altKey"),
  58944. meta: genGuard("!$event.metaKey"),
  58945. left: genGuard("'button' in $event && $event.button !== 0"),
  58946. middle: genGuard("'button' in $event && $event.button !== 1"),
  58947. right: genGuard("'button' in $event && $event.button !== 2")
  58948. };
  58949. function genHandlers (
  58950. events,
  58951. isNative
  58952. ) {
  58953. var prefix = isNative ? 'nativeOn:' : 'on:';
  58954. var staticHandlers = "";
  58955. var dynamicHandlers = "";
  58956. for (var name in events) {
  58957. var handlerCode = genHandler(events[name]);
  58958. if (events[name] && events[name].dynamic) {
  58959. dynamicHandlers += name + "," + handlerCode + ",";
  58960. } else {
  58961. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  58962. }
  58963. }
  58964. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  58965. if (dynamicHandlers) {
  58966. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  58967. } else {
  58968. return prefix + staticHandlers
  58969. }
  58970. }
  58971. function genHandler (handler) {
  58972. if (!handler) {
  58973. return 'function(){}'
  58974. }
  58975. if (Array.isArray(handler)) {
  58976. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  58977. }
  58978. var isMethodPath = simplePathRE.test(handler.value);
  58979. var isFunctionExpression = fnExpRE.test(handler.value);
  58980. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  58981. if (!handler.modifiers) {
  58982. if (isMethodPath || isFunctionExpression) {
  58983. return handler.value
  58984. }
  58985. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  58986. } else {
  58987. var code = '';
  58988. var genModifierCode = '';
  58989. var keys = [];
  58990. for (var key in handler.modifiers) {
  58991. if (modifierCode[key]) {
  58992. genModifierCode += modifierCode[key];
  58993. // left/right
  58994. if (keyCodes[key]) {
  58995. keys.push(key);
  58996. }
  58997. } else if (key === 'exact') {
  58998. var modifiers = (handler.modifiers);
  58999. genModifierCode += genGuard(
  59000. ['ctrl', 'shift', 'alt', 'meta']
  59001. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59002. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59003. .join('||')
  59004. );
  59005. } else {
  59006. keys.push(key);
  59007. }
  59008. }
  59009. if (keys.length) {
  59010. code += genKeyFilter(keys);
  59011. }
  59012. // Make sure modifiers like prevent and stop get executed after key filtering
  59013. if (genModifierCode) {
  59014. code += genModifierCode;
  59015. }
  59016. var handlerCode = isMethodPath
  59017. ? ("return " + (handler.value) + "($event)")
  59018. : isFunctionExpression
  59019. ? ("return (" + (handler.value) + ")($event)")
  59020. : isFunctionInvocation
  59021. ? ("return " + (handler.value))
  59022. : handler.value;
  59023. return ("function($event){" + code + handlerCode + "}")
  59024. }
  59025. }
  59026. function genKeyFilter (keys) {
  59027. return (
  59028. // make sure the key filters only apply to KeyboardEvents
  59029. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59030. // key events that do not have keyCode property...
  59031. "if(!$event.type.indexOf('key')&&" +
  59032. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59033. )
  59034. }
  59035. function genFilterCode (key) {
  59036. var keyVal = parseInt(key, 10);
  59037. if (keyVal) {
  59038. return ("$event.keyCode!==" + keyVal)
  59039. }
  59040. var keyCode = keyCodes[key];
  59041. var keyName = keyNames[key];
  59042. return (
  59043. "_k($event.keyCode," +
  59044. (JSON.stringify(key)) + "," +
  59045. (JSON.stringify(keyCode)) + "," +
  59046. "$event.key," +
  59047. "" + (JSON.stringify(keyName)) +
  59048. ")"
  59049. )
  59050. }
  59051. /* */
  59052. function on (el, dir) {
  59053. if (dir.modifiers) {
  59054. warn("v-on without argument does not support modifiers.");
  59055. }
  59056. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59057. }
  59058. /* */
  59059. function bind$1 (el, dir) {
  59060. el.wrapData = function (code) {
  59061. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59062. };
  59063. }
  59064. /* */
  59065. var baseDirectives = {
  59066. on: on,
  59067. bind: bind$1,
  59068. cloak: noop
  59069. };
  59070. /* */
  59071. var CodegenState = function CodegenState (options) {
  59072. this.options = options;
  59073. this.warn = options.warn || baseWarn;
  59074. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59075. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59076. this.directives = extend(extend({}, baseDirectives), options.directives);
  59077. var isReservedTag = options.isReservedTag || no;
  59078. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59079. this.onceId = 0;
  59080. this.staticRenderFns = [];
  59081. this.pre = false;
  59082. };
  59083. function generate (
  59084. ast,
  59085. options
  59086. ) {
  59087. var state = new CodegenState(options);
  59088. var code = ast ? genElement(ast, state) : '_c("div")';
  59089. return {
  59090. render: ("with(this){return " + code + "}"),
  59091. staticRenderFns: state.staticRenderFns
  59092. }
  59093. }
  59094. function genElement (el, state) {
  59095. if (el.parent) {
  59096. el.pre = el.pre || el.parent.pre;
  59097. }
  59098. if (el.staticRoot && !el.staticProcessed) {
  59099. return genStatic(el, state)
  59100. } else if (el.once && !el.onceProcessed) {
  59101. return genOnce(el, state)
  59102. } else if (el.for && !el.forProcessed) {
  59103. return genFor(el, state)
  59104. } else if (el.if && !el.ifProcessed) {
  59105. return genIf(el, state)
  59106. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59107. return genChildren(el, state) || 'void 0'
  59108. } else if (el.tag === 'slot') {
  59109. return genSlot(el, state)
  59110. } else {
  59111. // component or element
  59112. var code;
  59113. if (el.component) {
  59114. code = genComponent(el.component, el, state);
  59115. } else {
  59116. var data;
  59117. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59118. data = genData$2(el, state);
  59119. }
  59120. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59121. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59122. }
  59123. // module transforms
  59124. for (var i = 0; i < state.transforms.length; i++) {
  59125. code = state.transforms[i](el, code);
  59126. }
  59127. return code
  59128. }
  59129. }
  59130. // hoist static sub-trees out
  59131. function genStatic (el, state) {
  59132. el.staticProcessed = true;
  59133. // Some elements (templates) need to behave differently inside of a v-pre
  59134. // node. All pre nodes are static roots, so we can use this as a location to
  59135. // wrap a state change and reset it upon exiting the pre node.
  59136. var originalPreState = state.pre;
  59137. if (el.pre) {
  59138. state.pre = el.pre;
  59139. }
  59140. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59141. state.pre = originalPreState;
  59142. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59143. }
  59144. // v-once
  59145. function genOnce (el, state) {
  59146. el.onceProcessed = true;
  59147. if (el.if && !el.ifProcessed) {
  59148. return genIf(el, state)
  59149. } else if (el.staticInFor) {
  59150. var key = '';
  59151. var parent = el.parent;
  59152. while (parent) {
  59153. if (parent.for) {
  59154. key = parent.key;
  59155. break
  59156. }
  59157. parent = parent.parent;
  59158. }
  59159. if (!key) {
  59160. state.warn(
  59161. "v-once can only be used inside v-for that is keyed. ",
  59162. el.rawAttrsMap['v-once']
  59163. );
  59164. return genElement(el, state)
  59165. }
  59166. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59167. } else {
  59168. return genStatic(el, state)
  59169. }
  59170. }
  59171. function genIf (
  59172. el,
  59173. state,
  59174. altGen,
  59175. altEmpty
  59176. ) {
  59177. el.ifProcessed = true; // avoid recursion
  59178. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59179. }
  59180. function genIfConditions (
  59181. conditions,
  59182. state,
  59183. altGen,
  59184. altEmpty
  59185. ) {
  59186. if (!conditions.length) {
  59187. return altEmpty || '_e()'
  59188. }
  59189. var condition = conditions.shift();
  59190. if (condition.exp) {
  59191. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59192. } else {
  59193. return ("" + (genTernaryExp(condition.block)))
  59194. }
  59195. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59196. function genTernaryExp (el) {
  59197. return altGen
  59198. ? altGen(el, state)
  59199. : el.once
  59200. ? genOnce(el, state)
  59201. : genElement(el, state)
  59202. }
  59203. }
  59204. function genFor (
  59205. el,
  59206. state,
  59207. altGen,
  59208. altHelper
  59209. ) {
  59210. var exp = el.for;
  59211. var alias = el.alias;
  59212. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59213. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59214. if (state.maybeComponent(el) &&
  59215. el.tag !== 'slot' &&
  59216. el.tag !== 'template' &&
  59217. !el.key
  59218. ) {
  59219. state.warn(
  59220. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59221. "v-for should have explicit keys. " +
  59222. "See https://vuejs.org/guide/list.html#key for more info.",
  59223. el.rawAttrsMap['v-for'],
  59224. true /* tip */
  59225. );
  59226. }
  59227. el.forProcessed = true; // avoid recursion
  59228. return (altHelper || '_l') + "((" + exp + ")," +
  59229. "function(" + alias + iterator1 + iterator2 + "){" +
  59230. "return " + ((altGen || genElement)(el, state)) +
  59231. '})'
  59232. }
  59233. function genData$2 (el, state) {
  59234. var data = '{';
  59235. // directives first.
  59236. // directives may mutate the el's other properties before they are generated.
  59237. var dirs = genDirectives(el, state);
  59238. if (dirs) { data += dirs + ','; }
  59239. // key
  59240. if (el.key) {
  59241. data += "key:" + (el.key) + ",";
  59242. }
  59243. // ref
  59244. if (el.ref) {
  59245. data += "ref:" + (el.ref) + ",";
  59246. }
  59247. if (el.refInFor) {
  59248. data += "refInFor:true,";
  59249. }
  59250. // pre
  59251. if (el.pre) {
  59252. data += "pre:true,";
  59253. }
  59254. // record original tag name for components using "is" attribute
  59255. if (el.component) {
  59256. data += "tag:\"" + (el.tag) + "\",";
  59257. }
  59258. // module data generation functions
  59259. for (var i = 0; i < state.dataGenFns.length; i++) {
  59260. data += state.dataGenFns[i](el);
  59261. }
  59262. // attributes
  59263. if (el.attrs) {
  59264. data += "attrs:" + (genProps(el.attrs)) + ",";
  59265. }
  59266. // DOM props
  59267. if (el.props) {
  59268. data += "domProps:" + (genProps(el.props)) + ",";
  59269. }
  59270. // event handlers
  59271. if (el.events) {
  59272. data += (genHandlers(el.events, false)) + ",";
  59273. }
  59274. if (el.nativeEvents) {
  59275. data += (genHandlers(el.nativeEvents, true)) + ",";
  59276. }
  59277. // slot target
  59278. // only for non-scoped slots
  59279. if (el.slotTarget && !el.slotScope) {
  59280. data += "slot:" + (el.slotTarget) + ",";
  59281. }
  59282. // scoped slots
  59283. if (el.scopedSlots) {
  59284. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59285. }
  59286. // component v-model
  59287. if (el.model) {
  59288. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59289. }
  59290. // inline-template
  59291. if (el.inlineTemplate) {
  59292. var inlineTemplate = genInlineTemplate(el, state);
  59293. if (inlineTemplate) {
  59294. data += inlineTemplate + ",";
  59295. }
  59296. }
  59297. data = data.replace(/,$/, '') + '}';
  59298. // v-bind dynamic argument wrap
  59299. // v-bind with dynamic arguments must be applied using the same v-bind object
  59300. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59301. if (el.dynamicAttrs) {
  59302. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59303. }
  59304. // v-bind data wrap
  59305. if (el.wrapData) {
  59306. data = el.wrapData(data);
  59307. }
  59308. // v-on data wrap
  59309. if (el.wrapListeners) {
  59310. data = el.wrapListeners(data);
  59311. }
  59312. return data
  59313. }
  59314. function genDirectives (el, state) {
  59315. var dirs = el.directives;
  59316. if (!dirs) { return }
  59317. var res = 'directives:[';
  59318. var hasRuntime = false;
  59319. var i, l, dir, needRuntime;
  59320. for (i = 0, l = dirs.length; i < l; i++) {
  59321. dir = dirs[i];
  59322. needRuntime = true;
  59323. var gen = state.directives[dir.name];
  59324. if (gen) {
  59325. // compile-time directive that manipulates AST.
  59326. // returns true if it also needs a runtime counterpart.
  59327. needRuntime = !!gen(el, dir, state.warn);
  59328. }
  59329. if (needRuntime) {
  59330. hasRuntime = true;
  59331. 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))) : '') + "},";
  59332. }
  59333. }
  59334. if (hasRuntime) {
  59335. return res.slice(0, -1) + ']'
  59336. }
  59337. }
  59338. function genInlineTemplate (el, state) {
  59339. var ast = el.children[0];
  59340. if (el.children.length !== 1 || ast.type !== 1) {
  59341. state.warn(
  59342. 'Inline-template components must have exactly one child element.',
  59343. { start: el.start }
  59344. );
  59345. }
  59346. if (ast && ast.type === 1) {
  59347. var inlineRenderFns = generate(ast, state.options);
  59348. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59349. }
  59350. }
  59351. function genScopedSlots (
  59352. el,
  59353. slots,
  59354. state
  59355. ) {
  59356. // by default scoped slots are considered "stable", this allows child
  59357. // components with only scoped slots to skip forced updates from parent.
  59358. // but in some cases we have to bail-out of this optimization
  59359. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59360. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59361. var slot = slots[key];
  59362. return (
  59363. slot.slotTargetDynamic ||
  59364. slot.if ||
  59365. slot.for ||
  59366. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59367. )
  59368. });
  59369. // #9534: if a component with scoped slots is inside a conditional branch,
  59370. // it's possible for the same component to be reused but with different
  59371. // compiled slot content. To avoid that, we generate a unique key based on
  59372. // the generated code of all the slot contents.
  59373. var needsKey = !!el.if;
  59374. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59375. // disconnected due to the intermediate scope variable)
  59376. // #9438, #9506
  59377. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59378. // and skip force updating ones that do not actually use scope variables.
  59379. if (!needsForceUpdate) {
  59380. var parent = el.parent;
  59381. while (parent) {
  59382. if (
  59383. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59384. parent.for
  59385. ) {
  59386. needsForceUpdate = true;
  59387. break
  59388. }
  59389. if (parent.if) {
  59390. needsKey = true;
  59391. }
  59392. parent = parent.parent;
  59393. }
  59394. }
  59395. var generatedSlots = Object.keys(slots)
  59396. .map(function (key) { return genScopedSlot(slots[key], state); })
  59397. .join(',');
  59398. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59399. }
  59400. function hash(str) {
  59401. var hash = 5381;
  59402. var i = str.length;
  59403. while(i) {
  59404. hash = (hash * 33) ^ str.charCodeAt(--i);
  59405. }
  59406. return hash >>> 0
  59407. }
  59408. function containsSlotChild (el) {
  59409. if (el.type === 1) {
  59410. if (el.tag === 'slot') {
  59411. return true
  59412. }
  59413. return el.children.some(containsSlotChild)
  59414. }
  59415. return false
  59416. }
  59417. function genScopedSlot (
  59418. el,
  59419. state
  59420. ) {
  59421. var isLegacySyntax = el.attrsMap['slot-scope'];
  59422. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59423. return genIf(el, state, genScopedSlot, "null")
  59424. }
  59425. if (el.for && !el.forProcessed) {
  59426. return genFor(el, state, genScopedSlot)
  59427. }
  59428. var slotScope = el.slotScope === emptySlotScopeToken
  59429. ? ""
  59430. : String(el.slotScope);
  59431. var fn = "function(" + slotScope + "){" +
  59432. "return " + (el.tag === 'template'
  59433. ? el.if && isLegacySyntax
  59434. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59435. : genChildren(el, state) || 'undefined'
  59436. : genElement(el, state)) + "}";
  59437. // reverse proxy v-slot without scope on this.$slots
  59438. var reverseProxy = slotScope ? "" : ",proxy:true";
  59439. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59440. }
  59441. function genChildren (
  59442. el,
  59443. state,
  59444. checkSkip,
  59445. altGenElement,
  59446. altGenNode
  59447. ) {
  59448. var children = el.children;
  59449. if (children.length) {
  59450. var el$1 = children[0];
  59451. // optimize single v-for
  59452. if (children.length === 1 &&
  59453. el$1.for &&
  59454. el$1.tag !== 'template' &&
  59455. el$1.tag !== 'slot'
  59456. ) {
  59457. var normalizationType = checkSkip
  59458. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59459. : "";
  59460. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59461. }
  59462. var normalizationType$1 = checkSkip
  59463. ? getNormalizationType(children, state.maybeComponent)
  59464. : 0;
  59465. var gen = altGenNode || genNode;
  59466. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59467. }
  59468. }
  59469. // determine the normalization needed for the children array.
  59470. // 0: no normalization needed
  59471. // 1: simple normalization needed (possible 1-level deep nested array)
  59472. // 2: full normalization needed
  59473. function getNormalizationType (
  59474. children,
  59475. maybeComponent
  59476. ) {
  59477. var res = 0;
  59478. for (var i = 0; i < children.length; i++) {
  59479. var el = children[i];
  59480. if (el.type !== 1) {
  59481. continue
  59482. }
  59483. if (needsNormalization(el) ||
  59484. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59485. res = 2;
  59486. break
  59487. }
  59488. if (maybeComponent(el) ||
  59489. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59490. res = 1;
  59491. }
  59492. }
  59493. return res
  59494. }
  59495. function needsNormalization (el) {
  59496. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59497. }
  59498. function genNode (node, state) {
  59499. if (node.type === 1) {
  59500. return genElement(node, state)
  59501. } else if (node.type === 3 && node.isComment) {
  59502. return genComment(node)
  59503. } else {
  59504. return genText(node)
  59505. }
  59506. }
  59507. function genText (text) {
  59508. return ("_v(" + (text.type === 2
  59509. ? text.expression // no need for () because already wrapped in _s()
  59510. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59511. }
  59512. function genComment (comment) {
  59513. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59514. }
  59515. function genSlot (el, state) {
  59516. var slotName = el.slotName || '"default"';
  59517. var children = genChildren(el, state);
  59518. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59519. var attrs = el.attrs || el.dynamicAttrs
  59520. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59521. // slot props are camelized
  59522. name: camelize(attr.name),
  59523. value: attr.value,
  59524. dynamic: attr.dynamic
  59525. }); }))
  59526. : null;
  59527. var bind$$1 = el.attrsMap['v-bind'];
  59528. if ((attrs || bind$$1) && !children) {
  59529. res += ",null";
  59530. }
  59531. if (attrs) {
  59532. res += "," + attrs;
  59533. }
  59534. if (bind$$1) {
  59535. res += (attrs ? '' : ',null') + "," + bind$$1;
  59536. }
  59537. return res + ')'
  59538. }
  59539. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59540. function genComponent (
  59541. componentName,
  59542. el,
  59543. state
  59544. ) {
  59545. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59546. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59547. }
  59548. function genProps (props) {
  59549. var staticProps = "";
  59550. var dynamicProps = "";
  59551. for (var i = 0; i < props.length; i++) {
  59552. var prop = props[i];
  59553. var value = transformSpecialNewlines(prop.value);
  59554. if (prop.dynamic) {
  59555. dynamicProps += (prop.name) + "," + value + ",";
  59556. } else {
  59557. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59558. }
  59559. }
  59560. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59561. if (dynamicProps) {
  59562. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59563. } else {
  59564. return staticProps
  59565. }
  59566. }
  59567. // #3895, #4268
  59568. function transformSpecialNewlines (text) {
  59569. return text
  59570. .replace(/\u2028/g, '\\u2028')
  59571. .replace(/\u2029/g, '\\u2029')
  59572. }
  59573. /* */
  59574. // these keywords should not appear inside expressions, but operators like
  59575. // typeof, instanceof and in are allowed
  59576. var prohibitedKeywordRE = new RegExp('\\b' + (
  59577. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59578. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59579. 'extends,finally,continue,debugger,function,arguments'
  59580. ).split(',').join('\\b|\\b') + '\\b');
  59581. // these unary operators should not be used as property/method names
  59582. var unaryOperatorsRE = new RegExp('\\b' + (
  59583. 'delete,typeof,void'
  59584. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59585. // strip strings in expressions
  59586. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59587. // detect problematic expressions in a template
  59588. function detectErrors (ast, warn) {
  59589. if (ast) {
  59590. checkNode(ast, warn);
  59591. }
  59592. }
  59593. function checkNode (node, warn) {
  59594. if (node.type === 1) {
  59595. for (var name in node.attrsMap) {
  59596. if (dirRE.test(name)) {
  59597. var value = node.attrsMap[name];
  59598. if (value) {
  59599. var range = node.rawAttrsMap[name];
  59600. if (name === 'v-for') {
  59601. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59602. } else if (name === 'v-slot' || name[0] === '#') {
  59603. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59604. } else if (onRE.test(name)) {
  59605. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59606. } else {
  59607. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59608. }
  59609. }
  59610. }
  59611. }
  59612. if (node.children) {
  59613. for (var i = 0; i < node.children.length; i++) {
  59614. checkNode(node.children[i], warn);
  59615. }
  59616. }
  59617. } else if (node.type === 2) {
  59618. checkExpression(node.expression, node.text, warn, node);
  59619. }
  59620. }
  59621. function checkEvent (exp, text, warn, range) {
  59622. var stripped = exp.replace(stripStringRE, '');
  59623. var keywordMatch = stripped.match(unaryOperatorsRE);
  59624. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59625. warn(
  59626. "avoid using JavaScript unary operator as property name: " +
  59627. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59628. range
  59629. );
  59630. }
  59631. checkExpression(exp, text, warn, range);
  59632. }
  59633. function checkFor (node, text, warn, range) {
  59634. checkExpression(node.for || '', text, warn, range);
  59635. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59636. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59637. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59638. }
  59639. function checkIdentifier (
  59640. ident,
  59641. type,
  59642. text,
  59643. warn,
  59644. range
  59645. ) {
  59646. if (typeof ident === 'string') {
  59647. try {
  59648. new Function(("var " + ident + "=_"));
  59649. } catch (e) {
  59650. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59651. }
  59652. }
  59653. }
  59654. function checkExpression (exp, text, warn, range) {
  59655. try {
  59656. new Function(("return " + exp));
  59657. } catch (e) {
  59658. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59659. if (keywordMatch) {
  59660. warn(
  59661. "avoid using JavaScript keyword as property name: " +
  59662. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59663. range
  59664. );
  59665. } else {
  59666. warn(
  59667. "invalid expression: " + (e.message) + " in\n\n" +
  59668. " " + exp + "\n\n" +
  59669. " Raw expression: " + (text.trim()) + "\n",
  59670. range
  59671. );
  59672. }
  59673. }
  59674. }
  59675. function checkFunctionParameterExpression (exp, text, warn, range) {
  59676. try {
  59677. new Function(exp, '');
  59678. } catch (e) {
  59679. warn(
  59680. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59681. " " + exp + "\n\n" +
  59682. " Raw expression: " + (text.trim()) + "\n",
  59683. range
  59684. );
  59685. }
  59686. }
  59687. /* */
  59688. var range = 2;
  59689. function generateCodeFrame (
  59690. source,
  59691. start,
  59692. end
  59693. ) {
  59694. if ( start === void 0 ) start = 0;
  59695. if ( end === void 0 ) end = source.length;
  59696. var lines = source.split(/\r?\n/);
  59697. var count = 0;
  59698. var res = [];
  59699. for (var i = 0; i < lines.length; i++) {
  59700. count += lines[i].length + 1;
  59701. if (count >= start) {
  59702. for (var j = i - range; j <= i + range || end > count; j++) {
  59703. if (j < 0 || j >= lines.length) { continue }
  59704. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59705. var lineLength = lines[j].length;
  59706. if (j === i) {
  59707. // push underline
  59708. var pad = start - (count - lineLength) + 1;
  59709. var length = end > count ? lineLength - pad : end - start;
  59710. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59711. } else if (j > i) {
  59712. if (end > count) {
  59713. var length$1 = Math.min(end - count, lineLength);
  59714. res.push(" | " + repeat$1("^", length$1));
  59715. }
  59716. count += lineLength + 1;
  59717. }
  59718. }
  59719. break
  59720. }
  59721. }
  59722. return res.join('\n')
  59723. }
  59724. function repeat$1 (str, n) {
  59725. var result = '';
  59726. if (n > 0) {
  59727. while (true) { // eslint-disable-line
  59728. if (n & 1) { result += str; }
  59729. n >>>= 1;
  59730. if (n <= 0) { break }
  59731. str += str;
  59732. }
  59733. }
  59734. return result
  59735. }
  59736. /* */
  59737. function createFunction (code, errors) {
  59738. try {
  59739. return new Function(code)
  59740. } catch (err) {
  59741. errors.push({ err: err, code: code });
  59742. return noop
  59743. }
  59744. }
  59745. function createCompileToFunctionFn (compile) {
  59746. var cache = Object.create(null);
  59747. return function compileToFunctions (
  59748. template,
  59749. options,
  59750. vm
  59751. ) {
  59752. options = extend({}, options);
  59753. var warn$$1 = options.warn || warn;
  59754. delete options.warn;
  59755. /* istanbul ignore if */
  59756. {
  59757. // detect possible CSP restriction
  59758. try {
  59759. new Function('return 1');
  59760. } catch (e) {
  59761. if (e.toString().match(/unsafe-eval|CSP/)) {
  59762. warn$$1(
  59763. 'It seems you are using the standalone build of Vue.js in an ' +
  59764. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59765. 'The template compiler cannot work in this environment. Consider ' +
  59766. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59767. 'templates into render functions.'
  59768. );
  59769. }
  59770. }
  59771. }
  59772. // check cache
  59773. var key = options.delimiters
  59774. ? String(options.delimiters) + template
  59775. : template;
  59776. if (cache[key]) {
  59777. return cache[key]
  59778. }
  59779. // compile
  59780. var compiled = compile(template, options);
  59781. // check compilation errors/tips
  59782. {
  59783. if (compiled.errors && compiled.errors.length) {
  59784. if (options.outputSourceRange) {
  59785. compiled.errors.forEach(function (e) {
  59786. warn$$1(
  59787. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59788. generateCodeFrame(template, e.start, e.end),
  59789. vm
  59790. );
  59791. });
  59792. } else {
  59793. warn$$1(
  59794. "Error compiling template:\n\n" + template + "\n\n" +
  59795. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59796. vm
  59797. );
  59798. }
  59799. }
  59800. if (compiled.tips && compiled.tips.length) {
  59801. if (options.outputSourceRange) {
  59802. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59803. } else {
  59804. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59805. }
  59806. }
  59807. }
  59808. // turn code into functions
  59809. var res = {};
  59810. var fnGenErrors = [];
  59811. res.render = createFunction(compiled.render, fnGenErrors);
  59812. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59813. return createFunction(code, fnGenErrors)
  59814. });
  59815. // check function generation errors.
  59816. // this should only happen if there is a bug in the compiler itself.
  59817. // mostly for codegen development use
  59818. /* istanbul ignore if */
  59819. {
  59820. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59821. warn$$1(
  59822. "Failed to generate render function:\n\n" +
  59823. fnGenErrors.map(function (ref) {
  59824. var err = ref.err;
  59825. var code = ref.code;
  59826. return ((err.toString()) + " in\n\n" + code + "\n");
  59827. }).join('\n'),
  59828. vm
  59829. );
  59830. }
  59831. }
  59832. return (cache[key] = res)
  59833. }
  59834. }
  59835. /* */
  59836. function createCompilerCreator (baseCompile) {
  59837. return function createCompiler (baseOptions) {
  59838. function compile (
  59839. template,
  59840. options
  59841. ) {
  59842. var finalOptions = Object.create(baseOptions);
  59843. var errors = [];
  59844. var tips = [];
  59845. var warn = function (msg, range, tip) {
  59846. (tip ? tips : errors).push(msg);
  59847. };
  59848. if (options) {
  59849. if (options.outputSourceRange) {
  59850. // $flow-disable-line
  59851. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59852. warn = function (msg, range, tip) {
  59853. var data = { msg: msg };
  59854. if (range) {
  59855. if (range.start != null) {
  59856. data.start = range.start + leadingSpaceLength;
  59857. }
  59858. if (range.end != null) {
  59859. data.end = range.end + leadingSpaceLength;
  59860. }
  59861. }
  59862. (tip ? tips : errors).push(data);
  59863. };
  59864. }
  59865. // merge custom modules
  59866. if (options.modules) {
  59867. finalOptions.modules =
  59868. (baseOptions.modules || []).concat(options.modules);
  59869. }
  59870. // merge custom directives
  59871. if (options.directives) {
  59872. finalOptions.directives = extend(
  59873. Object.create(baseOptions.directives || null),
  59874. options.directives
  59875. );
  59876. }
  59877. // copy other options
  59878. for (var key in options) {
  59879. if (key !== 'modules' && key !== 'directives') {
  59880. finalOptions[key] = options[key];
  59881. }
  59882. }
  59883. }
  59884. finalOptions.warn = warn;
  59885. var compiled = baseCompile(template.trim(), finalOptions);
  59886. {
  59887. detectErrors(compiled.ast, warn);
  59888. }
  59889. compiled.errors = errors;
  59890. compiled.tips = tips;
  59891. return compiled
  59892. }
  59893. return {
  59894. compile: compile,
  59895. compileToFunctions: createCompileToFunctionFn(compile)
  59896. }
  59897. }
  59898. }
  59899. /* */
  59900. // `createCompilerCreator` allows creating compilers that use alternative
  59901. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  59902. // Here we just export a default compiler using the default parts.
  59903. var createCompiler = createCompilerCreator(function baseCompile (
  59904. template,
  59905. options
  59906. ) {
  59907. var ast = parse(template.trim(), options);
  59908. if (options.optimize !== false) {
  59909. optimize(ast, options);
  59910. }
  59911. var code = generate(ast, options);
  59912. return {
  59913. ast: ast,
  59914. render: code.render,
  59915. staticRenderFns: code.staticRenderFns
  59916. }
  59917. });
  59918. /* */
  59919. var ref$1 = createCompiler(baseOptions);
  59920. var compile = ref$1.compile;
  59921. var compileToFunctions = ref$1.compileToFunctions;
  59922. /* */
  59923. // check whether current browser encodes a char inside attribute values
  59924. var div;
  59925. function getShouldDecode (href) {
  59926. div = div || document.createElement('div');
  59927. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  59928. return div.innerHTML.indexOf('&#10;') > 0
  59929. }
  59930. // #3663: IE encodes newlines inside attribute values while other browsers don't
  59931. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  59932. // #6828: chrome encodes content in a[href]
  59933. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  59934. /* */
  59935. var idToTemplate = cached(function (id) {
  59936. var el = query(id);
  59937. return el && el.innerHTML
  59938. });
  59939. var mount = Vue.prototype.$mount;
  59940. Vue.prototype.$mount = function (
  59941. el,
  59942. hydrating
  59943. ) {
  59944. el = el && query(el);
  59945. /* istanbul ignore if */
  59946. if (el === document.body || el === document.documentElement) {
  59947. warn(
  59948. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  59949. );
  59950. return this
  59951. }
  59952. var options = this.$options;
  59953. // resolve template/el and convert to render function
  59954. if (!options.render) {
  59955. var template = options.template;
  59956. if (template) {
  59957. if (typeof template === 'string') {
  59958. if (template.charAt(0) === '#') {
  59959. template = idToTemplate(template);
  59960. /* istanbul ignore if */
  59961. if (!template) {
  59962. warn(
  59963. ("Template element not found or is empty: " + (options.template)),
  59964. this
  59965. );
  59966. }
  59967. }
  59968. } else if (template.nodeType) {
  59969. template = template.innerHTML;
  59970. } else {
  59971. {
  59972. warn('invalid template option:' + template, this);
  59973. }
  59974. return this
  59975. }
  59976. } else if (el) {
  59977. template = getOuterHTML(el);
  59978. }
  59979. if (template) {
  59980. /* istanbul ignore if */
  59981. if (config.performance && mark) {
  59982. mark('compile');
  59983. }
  59984. var ref = compileToFunctions(template, {
  59985. outputSourceRange: "development" !== 'production',
  59986. shouldDecodeNewlines: shouldDecodeNewlines,
  59987. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  59988. delimiters: options.delimiters,
  59989. comments: options.comments
  59990. }, this);
  59991. var render = ref.render;
  59992. var staticRenderFns = ref.staticRenderFns;
  59993. options.render = render;
  59994. options.staticRenderFns = staticRenderFns;
  59995. /* istanbul ignore if */
  59996. if (config.performance && mark) {
  59997. mark('compile end');
  59998. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  59999. }
  60000. }
  60001. }
  60002. return mount.call(this, el, hydrating)
  60003. };
  60004. /**
  60005. * Get outerHTML of elements, taking care
  60006. * of SVG elements in IE as well.
  60007. */
  60008. function getOuterHTML (el) {
  60009. if (el.outerHTML) {
  60010. return el.outerHTML
  60011. } else {
  60012. var container = document.createElement('div');
  60013. container.appendChild(el.cloneNode(true));
  60014. return container.innerHTML
  60015. }
  60016. }
  60017. Vue.compile = compileToFunctions;
  60018. module.exports = Vue;
  60019. /* 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))
  60020. /***/ }),
  60021. /***/ "./node_modules/vue/dist/vue.common.js":
  60022. /*!*********************************************!*\
  60023. !*** ./node_modules/vue/dist/vue.common.js ***!
  60024. \*********************************************/
  60025. /*! no static exports found */
  60026. /***/ (function(module, exports, __webpack_require__) {
  60027. if (false) {} else {
  60028. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60029. }
  60030. /***/ }),
  60031. /***/ "./node_modules/webpack/buildin/global.js":
  60032. /*!***********************************!*\
  60033. !*** (webpack)/buildin/global.js ***!
  60034. \***********************************/
  60035. /*! no static exports found */
  60036. /***/ (function(module, exports) {
  60037. var g;
  60038. // This works in non-strict mode
  60039. g = (function() {
  60040. return this;
  60041. })();
  60042. try {
  60043. // This works if eval is allowed (see CSP)
  60044. g = g || new Function("return this")();
  60045. } catch (e) {
  60046. // This works if the window reference is available
  60047. if (typeof window === "object") g = window;
  60048. }
  60049. // g can still be undefined, but nothing to do about it...
  60050. // We return undefined, instead of nothing here, so it's
  60051. // easier to handle this case. if(!global) { ...}
  60052. module.exports = g;
  60053. /***/ }),
  60054. /***/ "./node_modules/webpack/buildin/module.js":
  60055. /*!***********************************!*\
  60056. !*** (webpack)/buildin/module.js ***!
  60057. \***********************************/
  60058. /*! no static exports found */
  60059. /***/ (function(module, exports) {
  60060. module.exports = function(module) {
  60061. if (!module.webpackPolyfill) {
  60062. module.deprecate = function() {};
  60063. module.paths = [];
  60064. // module.parent = undefined by default
  60065. if (!module.children) module.children = [];
  60066. Object.defineProperty(module, "loaded", {
  60067. enumerable: true,
  60068. get: function() {
  60069. return module.l;
  60070. }
  60071. });
  60072. Object.defineProperty(module, "id", {
  60073. enumerable: true,
  60074. get: function() {
  60075. return module.i;
  60076. }
  60077. });
  60078. module.webpackPolyfill = 1;
  60079. }
  60080. return module;
  60081. };
  60082. /***/ }),
  60083. /***/ "./resources/js/app.js":
  60084. /*!*****************************!*\
  60085. !*** ./resources/js/app.js ***!
  60086. \*****************************/
  60087. /*! no exports provided */
  60088. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60089. "use strict";
  60090. __webpack_require__.r(__webpack_exports__);
  60091. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60092. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60093. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60094. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60095. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60096. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60097. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60098. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60099. /**
  60100. * First we will load all of this project's JavaScript dependencies which
  60101. * includes Vue and other libraries. It is a great starting point when
  60102. * building robust, powerful web applications using Vue and Laravel.
  60103. */
  60104. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60105. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60106. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60107. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60108. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60109. mode: 'history',
  60110. routes: [{
  60111. path: '/',
  60112. name: 'home',
  60113. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60114. }, {
  60115. path: '/login',
  60116. name: 'login',
  60117. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60118. }, {
  60119. path: '/dashboard',
  60120. name: 'dashboard',
  60121. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60122. }, {
  60123. path: '/workorders/:id',
  60124. name: 'workorders',
  60125. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60126. props: true
  60127. }]
  60128. });
  60129. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60130. el: '#app',
  60131. components: {
  60132. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60133. },
  60134. router: router
  60135. });
  60136. $(function () {
  60137. $('[data-toggle="tooltip"]').tooltip();
  60138. });
  60139. var clipboard = new Clipboard('.btn-clip');
  60140. clipboard.on('success', function (e) {
  60141. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60142. position: "right",
  60143. className: 'success'
  60144. });
  60145. e.clearSelection();
  60146. });
  60147. /***/ }),
  60148. /***/ "./resources/js/bootstrap.js":
  60149. /*!***********************************!*\
  60150. !*** ./resources/js/bootstrap.js ***!
  60151. \***********************************/
  60152. /*! no exports provided */
  60153. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60154. "use strict";
  60155. __webpack_require__.r(__webpack_exports__);
  60156. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60157. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60158. /**
  60159. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60160. * for JavaScript based Bootstrap features such as modals and tabs. This
  60161. * code may be modified to fit the specific needs of your application.
  60162. */
  60163. try {
  60164. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60165. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60166. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60167. } catch (e) {}
  60168. /**
  60169. * We'll load the axios HTTP library which allows us to easily issue requests
  60170. * to our Laravel back-end. This library automatically handles sending the
  60171. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60172. */
  60173. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60174. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60175. /**
  60176. * Echo exposes an expressive API for subscribing to channels and listening
  60177. * for events that are broadcast by Laravel. Echo and event broadcasting
  60178. * allows your team to easily build robust real-time web applications.
  60179. */
  60180. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60181. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60182. broadcaster: 'pusher',
  60183. key: "upccrt",
  60184. authEndpoint: '/broadcasting/auth',
  60185. wsHost: window.location.hostname,
  60186. wsPort: 6001,
  60187. disableStats: true
  60188. });
  60189. /***/ }),
  60190. /***/ "./resources/js/components/AssetInfo.vue":
  60191. /*!***********************************************!*\
  60192. !*** ./resources/js/components/AssetInfo.vue ***!
  60193. \***********************************************/
  60194. /*! exports provided: default */
  60195. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60196. "use strict";
  60197. __webpack_require__.r(__webpack_exports__);
  60198. /* 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&");
  60199. /* 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&");
  60200. /* 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");
  60201. /* normalize component */
  60202. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60203. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60204. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60205. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60206. false,
  60207. null,
  60208. null,
  60209. null
  60210. )
  60211. /* hot reload */
  60212. if (false) { var api; }
  60213. component.options.__file = "resources/js/components/AssetInfo.vue"
  60214. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60215. /***/ }),
  60216. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60217. /*!************************************************************************!*\
  60218. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60219. \************************************************************************/
  60220. /*! exports provided: default */
  60221. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60222. "use strict";
  60223. __webpack_require__.r(__webpack_exports__);
  60224. /* 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&");
  60225. /* 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"]);
  60226. /***/ }),
  60227. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60228. /*!******************************************************************************!*\
  60229. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60230. \******************************************************************************/
  60231. /*! exports provided: render, staticRenderFns */
  60232. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60233. "use strict";
  60234. __webpack_require__.r(__webpack_exports__);
  60235. /* 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&");
  60236. /* 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"]; });
  60237. /* 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"]; });
  60238. /***/ }),
  60239. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60240. /*!********************************************************!*\
  60241. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60242. \********************************************************/
  60243. /*! exports provided: default */
  60244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60245. "use strict";
  60246. __webpack_require__.r(__webpack_exports__);
  60247. /* 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&");
  60248. /* 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&");
  60249. /* 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");
  60250. /* normalize component */
  60251. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60252. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60253. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60254. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60255. false,
  60256. null,
  60257. null,
  60258. null
  60259. )
  60260. /* hot reload */
  60261. if (false) { var api; }
  60262. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60263. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60264. /***/ }),
  60265. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60266. /*!*********************************************************************************!*\
  60267. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60268. \*********************************************************************************/
  60269. /*! exports provided: default */
  60270. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60271. "use strict";
  60272. __webpack_require__.r(__webpack_exports__);
  60273. /* 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&");
  60274. /* 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"]);
  60275. /***/ }),
  60276. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60277. /*!***************************************************************************************!*\
  60278. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60279. \***************************************************************************************/
  60280. /*! exports provided: render, staticRenderFns */
  60281. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60282. "use strict";
  60283. __webpack_require__.r(__webpack_exports__);
  60284. /* 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&");
  60285. /* 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"]; });
  60286. /* 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"]; });
  60287. /***/ }),
  60288. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60289. /*!****************************************************************!*\
  60290. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60291. \****************************************************************/
  60292. /*! exports provided: default */
  60293. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60294. "use strict";
  60295. __webpack_require__.r(__webpack_exports__);
  60296. /* 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&");
  60297. /* 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&");
  60298. /* 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");
  60299. /* normalize component */
  60300. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60301. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60302. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60303. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60304. false,
  60305. null,
  60306. null,
  60307. null
  60308. )
  60309. /* hot reload */
  60310. if (false) { var api; }
  60311. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60312. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60313. /***/ }),
  60314. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60315. /*!*****************************************************************************************!*\
  60316. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60317. \*****************************************************************************************/
  60318. /*! exports provided: default */
  60319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60320. "use strict";
  60321. __webpack_require__.r(__webpack_exports__);
  60322. /* 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&");
  60323. /* 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"]);
  60324. /***/ }),
  60325. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60326. /*!***********************************************************************************************!*\
  60327. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60328. \***********************************************************************************************/
  60329. /*! exports provided: render, staticRenderFns */
  60330. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60331. "use strict";
  60332. __webpack_require__.r(__webpack_exports__);
  60333. /* 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&");
  60334. /* 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"]; });
  60335. /* 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"]; });
  60336. /***/ }),
  60337. /***/ "./resources/js/components/CircleSpinner.vue":
  60338. /*!***************************************************!*\
  60339. !*** ./resources/js/components/CircleSpinner.vue ***!
  60340. \***************************************************/
  60341. /*! no static exports found */
  60342. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60343. "use strict";
  60344. __webpack_require__.r(__webpack_exports__);
  60345. /* 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&");
  60346. /* 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&");
  60347. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  60348. /* 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&");
  60349. /* 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");
  60350. /* normalize component */
  60351. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60352. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60353. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60354. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60355. false,
  60356. null,
  60357. "9a543b64",
  60358. null
  60359. )
  60360. /* hot reload */
  60361. if (false) { var api; }
  60362. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60363. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60364. /***/ }),
  60365. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60366. /*!****************************************************************************!*\
  60367. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60368. \****************************************************************************/
  60369. /*! no static exports found */
  60370. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60371. "use strict";
  60372. __webpack_require__.r(__webpack_exports__);
  60373. /* 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&");
  60374. /* 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"]);
  60375. /***/ }),
  60376. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60377. /*!************************************************************************************************************!*\
  60378. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60379. \************************************************************************************************************/
  60380. /*! no static exports found */
  60381. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60382. "use strict";
  60383. __webpack_require__.r(__webpack_exports__);
  60384. /* 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&");
  60385. /* 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__);
  60386. /* 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__));
  60387. /* 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);
  60388. /***/ }),
  60389. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60390. /*!**********************************************************************************************!*\
  60391. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60392. \**********************************************************************************************/
  60393. /*! exports provided: render, staticRenderFns */
  60394. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60395. "use strict";
  60396. __webpack_require__.r(__webpack_exports__);
  60397. /* 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&");
  60398. /* 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"]; });
  60399. /* 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"]; });
  60400. /***/ }),
  60401. /***/ "./resources/js/components/Credential.vue":
  60402. /*!************************************************!*\
  60403. !*** ./resources/js/components/Credential.vue ***!
  60404. \************************************************/
  60405. /*! exports provided: default */
  60406. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60407. "use strict";
  60408. __webpack_require__.r(__webpack_exports__);
  60409. /* 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&");
  60410. /* 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&");
  60411. /* 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");
  60412. /* normalize component */
  60413. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60414. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60415. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60416. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60417. false,
  60418. null,
  60419. null,
  60420. null
  60421. )
  60422. /* hot reload */
  60423. if (false) { var api; }
  60424. component.options.__file = "resources/js/components/Credential.vue"
  60425. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60426. /***/ }),
  60427. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60428. /*!*************************************************************************!*\
  60429. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60430. \*************************************************************************/
  60431. /*! exports provided: default */
  60432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60433. "use strict";
  60434. __webpack_require__.r(__webpack_exports__);
  60435. /* 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&");
  60436. /* 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"]);
  60437. /***/ }),
  60438. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60439. /*!*******************************************************************************!*\
  60440. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60441. \*******************************************************************************/
  60442. /*! exports provided: render, staticRenderFns */
  60443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60444. "use strict";
  60445. __webpack_require__.r(__webpack_exports__);
  60446. /* 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&");
  60447. /* 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"]; });
  60448. /* 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"]; });
  60449. /***/ }),
  60450. /***/ "./resources/js/components/CredentialFormModal.vue":
  60451. /*!*********************************************************!*\
  60452. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60453. \*********************************************************/
  60454. /*! exports provided: default */
  60455. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60456. "use strict";
  60457. __webpack_require__.r(__webpack_exports__);
  60458. /* 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&");
  60459. /* 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&");
  60460. /* 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");
  60461. /* normalize component */
  60462. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60463. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60464. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60465. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60466. false,
  60467. null,
  60468. null,
  60469. null
  60470. )
  60471. /* hot reload */
  60472. if (false) { var api; }
  60473. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60474. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60475. /***/ }),
  60476. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60477. /*!**********************************************************************************!*\
  60478. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60479. \**********************************************************************************/
  60480. /*! exports provided: default */
  60481. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60482. "use strict";
  60483. __webpack_require__.r(__webpack_exports__);
  60484. /* 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&");
  60485. /* 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"]);
  60486. /***/ }),
  60487. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60488. /*!****************************************************************************************!*\
  60489. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60490. \****************************************************************************************/
  60491. /*! exports provided: render, staticRenderFns */
  60492. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60493. "use strict";
  60494. __webpack_require__.r(__webpack_exports__);
  60495. /* 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&");
  60496. /* 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"]; });
  60497. /* 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"]; });
  60498. /***/ }),
  60499. /***/ "./resources/js/components/CredentialList.vue":
  60500. /*!****************************************************!*\
  60501. !*** ./resources/js/components/CredentialList.vue ***!
  60502. \****************************************************/
  60503. /*! exports provided: default */
  60504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60505. "use strict";
  60506. __webpack_require__.r(__webpack_exports__);
  60507. /* 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&");
  60508. /* 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&");
  60509. /* 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");
  60510. /* normalize component */
  60511. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60512. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60513. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60514. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60515. false,
  60516. null,
  60517. null,
  60518. null
  60519. )
  60520. /* hot reload */
  60521. if (false) { var api; }
  60522. component.options.__file = "resources/js/components/CredentialList.vue"
  60523. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60524. /***/ }),
  60525. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60526. /*!*****************************************************************************!*\
  60527. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60528. \*****************************************************************************/
  60529. /*! exports provided: default */
  60530. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60531. "use strict";
  60532. __webpack_require__.r(__webpack_exports__);
  60533. /* 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&");
  60534. /* 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"]);
  60535. /***/ }),
  60536. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60537. /*!***********************************************************************************!*\
  60538. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60539. \***********************************************************************************/
  60540. /*! exports provided: render, staticRenderFns */
  60541. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60542. "use strict";
  60543. __webpack_require__.r(__webpack_exports__);
  60544. /* 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&");
  60545. /* 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"]; });
  60546. /* 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"]; });
  60547. /***/ }),
  60548. /***/ "./resources/js/components/Modal.vue":
  60549. /*!*******************************************!*\
  60550. !*** ./resources/js/components/Modal.vue ***!
  60551. \*******************************************/
  60552. /*! exports provided: default */
  60553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60554. "use strict";
  60555. __webpack_require__.r(__webpack_exports__);
  60556. /* 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&");
  60557. /* 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");
  60558. var script = {}
  60559. /* normalize component */
  60560. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  60561. script,
  60562. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60563. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60564. false,
  60565. null,
  60566. null,
  60567. null
  60568. )
  60569. /* hot reload */
  60570. if (false) { var api; }
  60571. component.options.__file = "resources/js/components/Modal.vue"
  60572. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60573. /***/ }),
  60574. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  60575. /*!**************************************************************************!*\
  60576. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  60577. \**************************************************************************/
  60578. /*! exports provided: render, staticRenderFns */
  60579. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60580. "use strict";
  60581. __webpack_require__.r(__webpack_exports__);
  60582. /* 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&");
  60583. /* 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"]; });
  60584. /* 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"]; });
  60585. /***/ }),
  60586. /***/ "./resources/js/components/NoteFormModal.vue":
  60587. /*!***************************************************!*\
  60588. !*** ./resources/js/components/NoteFormModal.vue ***!
  60589. \***************************************************/
  60590. /*! exports provided: default */
  60591. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60592. "use strict";
  60593. __webpack_require__.r(__webpack_exports__);
  60594. /* 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&");
  60595. /* 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&");
  60596. /* 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");
  60597. /* normalize component */
  60598. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60599. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60600. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60601. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60602. false,
  60603. null,
  60604. null,
  60605. null
  60606. )
  60607. /* hot reload */
  60608. if (false) { var api; }
  60609. component.options.__file = "resources/js/components/NoteFormModal.vue"
  60610. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60611. /***/ }),
  60612. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  60613. /*!****************************************************************************!*\
  60614. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  60615. \****************************************************************************/
  60616. /*! exports provided: default */
  60617. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60618. "use strict";
  60619. __webpack_require__.r(__webpack_exports__);
  60620. /* 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&");
  60621. /* 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"]);
  60622. /***/ }),
  60623. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  60624. /*!**********************************************************************************!*\
  60625. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  60626. \**********************************************************************************/
  60627. /*! exports provided: render, staticRenderFns */
  60628. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60629. "use strict";
  60630. __webpack_require__.r(__webpack_exports__);
  60631. /* 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&");
  60632. /* 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"]; });
  60633. /* 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"]; });
  60634. /***/ }),
  60635. /***/ "./resources/js/components/Notes.vue":
  60636. /*!*******************************************!*\
  60637. !*** ./resources/js/components/Notes.vue ***!
  60638. \*******************************************/
  60639. /*! exports provided: default */
  60640. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60641. "use strict";
  60642. __webpack_require__.r(__webpack_exports__);
  60643. /* 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&");
  60644. /* 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&");
  60645. /* 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");
  60646. /* normalize component */
  60647. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60648. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60649. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60650. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60651. false,
  60652. null,
  60653. null,
  60654. null
  60655. )
  60656. /* hot reload */
  60657. if (false) { var api; }
  60658. component.options.__file = "resources/js/components/Notes.vue"
  60659. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60660. /***/ }),
  60661. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  60662. /*!********************************************************************!*\
  60663. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  60664. \********************************************************************/
  60665. /*! exports provided: default */
  60666. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60667. "use strict";
  60668. __webpack_require__.r(__webpack_exports__);
  60669. /* 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&");
  60670. /* 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"]);
  60671. /***/ }),
  60672. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  60673. /*!**************************************************************************!*\
  60674. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  60675. \**************************************************************************/
  60676. /*! exports provided: render, staticRenderFns */
  60677. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60678. "use strict";
  60679. __webpack_require__.r(__webpack_exports__);
  60680. /* 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&");
  60681. /* 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"]; });
  60682. /* 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"]; });
  60683. /***/ }),
  60684. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60685. /*!*****************************************************!*\
  60686. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60687. \*****************************************************/
  60688. /*! exports provided: default */
  60689. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60690. "use strict";
  60691. __webpack_require__.r(__webpack_exports__);
  60692. /* 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&");
  60693. /* 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&");
  60694. /* 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");
  60695. /* normalize component */
  60696. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60697. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60698. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60699. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60700. false,
  60701. null,
  60702. null,
  60703. null
  60704. )
  60705. /* hot reload */
  60706. if (false) { var api; }
  60707. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60708. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60709. /***/ }),
  60710. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60711. /*!******************************************************************************!*\
  60712. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60713. \******************************************************************************/
  60714. /*! exports provided: default */
  60715. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60716. "use strict";
  60717. __webpack_require__.r(__webpack_exports__);
  60718. /* 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&");
  60719. /* 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"]);
  60720. /***/ }),
  60721. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60722. /*!************************************************************************************!*\
  60723. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60724. \************************************************************************************/
  60725. /*! exports provided: render, staticRenderFns */
  60726. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60727. "use strict";
  60728. __webpack_require__.r(__webpack_exports__);
  60729. /* 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&");
  60730. /* 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"]; });
  60731. /* 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"]; });
  60732. /***/ }),
  60733. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60734. /*!***************************************************!*\
  60735. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60736. \***************************************************/
  60737. /*! exports provided: default */
  60738. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60739. "use strict";
  60740. __webpack_require__.r(__webpack_exports__);
  60741. /* 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&");
  60742. /* 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&");
  60743. /* 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");
  60744. /* normalize component */
  60745. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60746. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60747. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60748. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60749. false,
  60750. null,
  60751. null,
  60752. null
  60753. )
  60754. /* hot reload */
  60755. if (false) { var api; }
  60756. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60757. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60758. /***/ }),
  60759. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60760. /*!****************************************************************************!*\
  60761. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60762. \****************************************************************************/
  60763. /*! exports provided: default */
  60764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60765. "use strict";
  60766. __webpack_require__.r(__webpack_exports__);
  60767. /* 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&");
  60768. /* 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"]);
  60769. /***/ }),
  60770. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60771. /*!**********************************************************************************!*\
  60772. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60773. \**********************************************************************************/
  60774. /*! exports provided: render, staticRenderFns */
  60775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60776. "use strict";
  60777. __webpack_require__.r(__webpack_exports__);
  60778. /* 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&");
  60779. /* 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"]; });
  60780. /* 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"]; });
  60781. /***/ }),
  60782. /***/ "./resources/js/mixins/dateMixin.js":
  60783. /*!******************************************!*\
  60784. !*** ./resources/js/mixins/dateMixin.js ***!
  60785. \******************************************/
  60786. /*! exports provided: default */
  60787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60788. "use strict";
  60789. __webpack_require__.r(__webpack_exports__);
  60790. /* harmony default export */ __webpack_exports__["default"] = ({
  60791. methods: {
  60792. treatAsUTC: function treatAsUTC(date) {
  60793. var result = new Date(date);
  60794. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60795. return result;
  60796. },
  60797. daysSinceToday: function daysSinceToday(date) {
  60798. var currentDate = new Date();
  60799. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60800. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60801. },
  60802. getHRDate: function getHRDate(dateString) {
  60803. var date = new Date(dateString);
  60804. return date.toLocaleString('default', {
  60805. month: 'short',
  60806. day: 'numeric',
  60807. year: 'numeric',
  60808. hour: 'numeric',
  60809. minute: 'numeric'
  60810. });
  60811. },
  60812. isZero: function isZero(dateString) {
  60813. return dateString === '0000-00-00 00:00:00';
  60814. }
  60815. }
  60816. });
  60817. /***/ }),
  60818. /***/ "./resources/js/notify.min.js":
  60819. /*!************************************!*\
  60820. !*** ./resources/js/notify.min.js ***!
  60821. \************************************/
  60822. /*! no static exports found */
  60823. /***/ (function(module, exports, __webpack_require__) {
  60824. 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); }
  60825. (function (e) {
  60826. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60827. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60828. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60829. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60830. })(function (e) {
  60831. function A(t, n, i) {
  60832. typeof i == "string" && (i = {
  60833. className: i
  60834. }), 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);
  60835. }
  60836. var t = [].indexOf || function (e) {
  60837. for (var t = 0, n = this.length; t < n; t++) {
  60838. if (t in this && this[t] === e) return t;
  60839. }
  60840. return -1;
  60841. },
  60842. n = "notify",
  60843. r = n + "js",
  60844. i = n + "!blank",
  60845. s = {
  60846. t: "top",
  60847. m: "middle",
  60848. b: "bottom",
  60849. l: "left",
  60850. c: "center",
  60851. r: "right"
  60852. },
  60853. o = ["l", "c", "r"],
  60854. u = ["t", "m", "b"],
  60855. a = ["t", "b", "l", "r"],
  60856. f = {
  60857. t: "b",
  60858. m: null,
  60859. b: "t",
  60860. l: "r",
  60861. c: null,
  60862. r: "l"
  60863. },
  60864. l = function l(t) {
  60865. var n;
  60866. return n = [], e.each(t.split(/\W+/), function (e, t) {
  60867. var r;
  60868. r = t.toLowerCase().charAt(0);
  60869. if (s[r]) return n.push(r);
  60870. }), n;
  60871. },
  60872. c = {},
  60873. h = {
  60874. name: "core",
  60875. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  60876. 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}"
  60877. },
  60878. p = {
  60879. "border-radius": ["-webkit-", "-moz-"]
  60880. },
  60881. d = function d(e) {
  60882. return c[e];
  60883. },
  60884. v = function v(e) {
  60885. if (!e) throw "Missing Style name";
  60886. c[e] && delete c[e];
  60887. },
  60888. m = function m(t, i) {
  60889. if (!t) throw "Missing Style name";
  60890. if (!i) throw "Missing Style definition";
  60891. if (!i.html) throw "Missing Style HTML";
  60892. var s = c[t];
  60893. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  60894. var o = "";
  60895. i.classes && e.each(i.classes, function (t, n) {
  60896. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  60897. return p[t] && e.each(p[t], function (e, r) {
  60898. return o += " " + r + t + ": " + n + ";\n";
  60899. }), o += " " + t + ": " + n + ";\n";
  60900. }), o += "}\n";
  60901. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  60902. var u = {},
  60903. a = e(i.html);
  60904. y("html", a, u), y("text", a, u), i.fields = u;
  60905. },
  60906. g = function g(t) {
  60907. var n, r, i;
  60908. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  60909. try {
  60910. r.html(t);
  60911. } catch (s) {
  60912. r[0].styleSheet.cssText = t;
  60913. }
  60914. return r;
  60915. },
  60916. y = function y(t, n, r) {
  60917. var s;
  60918. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  60919. var n;
  60920. n = e(this).attr(s), n || (n = i), r[n] = t;
  60921. });
  60922. },
  60923. b = function b(e, t) {
  60924. return e.is(t) ? e : e.find(t);
  60925. },
  60926. w = {
  60927. clickToHide: !0,
  60928. autoHide: !0,
  60929. autoHideDelay: 5e3,
  60930. arrowShow: !0,
  60931. arrowSize: 5,
  60932. breakNewLines: !0,
  60933. elementPosition: "bottom",
  60934. globalPosition: "top right",
  60935. style: "bootstrap",
  60936. className: "error",
  60937. showAnimation: "slideDown",
  60938. showDuration: 400,
  60939. hideAnimation: "slideUp",
  60940. hideDuration: 200,
  60941. gap: 5
  60942. },
  60943. E = function E(t, n) {
  60944. var r;
  60945. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  60946. },
  60947. S = function S(t) {
  60948. return e.extend(w, t);
  60949. },
  60950. x = function x(t) {
  60951. return e("<" + t + "></" + t + ">");
  60952. },
  60953. T = {},
  60954. N = function N(t) {
  60955. var n;
  60956. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  60957. return e(r).attr("name") === t.attr("name");
  60958. }), t = n.first()), t;
  60959. },
  60960. C = function C(e, t, n) {
  60961. var r, i;
  60962. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  60963. if (isNaN(n)) return;
  60964. 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;
  60965. },
  60966. k = function k(e, t, n) {
  60967. if (e === "l" || e === "t") return 0;
  60968. if (e === "c" || e === "m") return n / 2 - t / 2;
  60969. if (e === "r" || e === "b") return n - t;
  60970. throw "Invalid alignment";
  60971. },
  60972. L = function L(e) {
  60973. return L.e = L.e || x("div"), L.e.text(e).html();
  60974. };
  60975. A.prototype.loadHTML = function () {
  60976. var t;
  60977. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  60978. }, A.prototype.show = function (e, t) {
  60979. var n, r, i, s, o;
  60980. r = function (n) {
  60981. return function () {
  60982. !e && !n.elem && n.destroy();
  60983. if (t) return t();
  60984. };
  60985. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  60986. 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 {
  60987. if (!!o || !!e) return r();
  60988. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  60989. }
  60990. return n.push(r), i[s].apply(i, n);
  60991. }, A.prototype.setGlobalPosition = function () {
  60992. var t = this.getPosition(),
  60993. n = t[0],
  60994. i = t[1],
  60995. o = s[n],
  60996. u = s[i],
  60997. a = n + "|" + i,
  60998. f = T[a];
  60999. if (!f || !document.body.contains(f[0])) {
  61000. f = T[a] = x("div");
  61001. var l = {};
  61002. 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);
  61003. }
  61004. return f.prepend(this.wrapper);
  61005. }, A.prototype.setElementPosition = function () {
  61006. 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;
  61007. 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"];
  61008. for (w = 0, S = B.length; w < S; w++) {
  61009. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61010. }
  61011. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61012. if (!this.options.arrowShow) this.arrow.hide();else {
  61013. 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";
  61014. for (E = 0, x = a.length; E < x; E++) {
  61015. D = a[E], P = s[D];
  61016. if (D === L) continue;
  61017. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61018. }
  61019. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61020. }
  61021. 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);
  61022. if (r) return this.arrow.removeAttr("style").css(r);
  61023. }, A.prototype.getPosition = function () {
  61024. var e, n, r, i, s, f, c, h;
  61025. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61026. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61027. 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";
  61028. return e.length === 2 && (e[2] = e[1]), e;
  61029. }, A.prototype.getStyle = function (e) {
  61030. var t;
  61031. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61032. if (!t) throw "Missing style: " + e;
  61033. return t;
  61034. }, A.prototype.updateClasses = function () {
  61035. var t, n;
  61036. 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) {
  61037. return r + "-" + n.name + "-" + e;
  61038. }).join(" "), this.userContainer.attr("class", t);
  61039. }, A.prototype.run = function (t, n) {
  61040. var r, s, o, u, a;
  61041. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61042. if (this.container && !t) {
  61043. this.show(!1);
  61044. return;
  61045. }
  61046. if (!this.container && !t) return;
  61047. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61048. for (o in s) {
  61049. r = s[o], u = this.userFields[o];
  61050. if (!u) continue;
  61051. 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);
  61052. }
  61053. 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));
  61054. }, A.prototype.destroy = function () {
  61055. this.wrapper.data(r, null), this.wrapper.remove();
  61056. }, e[n] = function (t, r, i) {
  61057. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61058. }, e.fn[n] = function (t, n) {
  61059. return e(this).each(function () {
  61060. var i = N(e(this)).data(r);
  61061. i && i.destroy();
  61062. var s = new A(e(this), t, n);
  61063. }), this;
  61064. }, e.extend(e[n], {
  61065. defaults: S,
  61066. addStyle: m,
  61067. removeStyle: v,
  61068. pluginOptions: w,
  61069. getStyle: d,
  61070. insertCSS: g
  61071. }), m("bootstrap", {
  61072. html: "<div>\n<span data-notify-text></span>\n</div>",
  61073. classes: {
  61074. base: {
  61075. "font-weight": "bold",
  61076. padding: "8px 15px 8px 14px",
  61077. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61078. "background-color": "#fcf8e3",
  61079. border: "1px solid #fbeed5",
  61080. "border-radius": "4px",
  61081. "white-space": "nowrap",
  61082. "padding-left": "25px",
  61083. "background-repeat": "no-repeat",
  61084. "background-position": "3px 7px"
  61085. },
  61086. error: {
  61087. color: "#B94A48",
  61088. "background-color": "#F2DEDE",
  61089. "border-color": "#EED3D7",
  61090. "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=)"
  61091. },
  61092. success: {
  61093. color: "#468847",
  61094. "background-color": "#DFF0D8",
  61095. "border-color": "#D6E9C6",
  61096. "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==)"
  61097. },
  61098. info: {
  61099. color: "#3A87AD",
  61100. "background-color": "#D9EDF7",
  61101. "border-color": "#BCE8F1",
  61102. "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=)"
  61103. },
  61104. warn: {
  61105. color: "#C09853",
  61106. "background-color": "#FCF8E3",
  61107. "border-color": "#FBEED5",
  61108. "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)"
  61109. }
  61110. }
  61111. }), e(function () {
  61112. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61113. e(this).trigger("notify-hide");
  61114. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61115. var n = e(this).data(r);
  61116. n && n.show(!1);
  61117. });
  61118. });
  61119. });
  61120. /***/ }),
  61121. /***/ "./resources/js/views/App.vue":
  61122. /*!************************************!*\
  61123. !*** ./resources/js/views/App.vue ***!
  61124. \************************************/
  61125. /*! exports provided: default */
  61126. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61127. "use strict";
  61128. __webpack_require__.r(__webpack_exports__);
  61129. /* 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&");
  61130. /* 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&");
  61131. /* 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");
  61132. /* normalize component */
  61133. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61134. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61135. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61136. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61137. false,
  61138. null,
  61139. null,
  61140. null
  61141. )
  61142. /* hot reload */
  61143. if (false) { var api; }
  61144. component.options.__file = "resources/js/views/App.vue"
  61145. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61146. /***/ }),
  61147. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61148. /*!*************************************************************!*\
  61149. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61150. \*************************************************************/
  61151. /*! exports provided: default */
  61152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61153. "use strict";
  61154. __webpack_require__.r(__webpack_exports__);
  61155. /* 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&");
  61156. /* 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"]);
  61157. /***/ }),
  61158. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61159. /*!*******************************************************************!*\
  61160. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61161. \*******************************************************************/
  61162. /*! exports provided: render, staticRenderFns */
  61163. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61164. "use strict";
  61165. __webpack_require__.r(__webpack_exports__);
  61166. /* 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&");
  61167. /* 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"]; });
  61168. /* 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"]; });
  61169. /***/ }),
  61170. /***/ "./resources/js/views/Dashboard.vue":
  61171. /*!******************************************!*\
  61172. !*** ./resources/js/views/Dashboard.vue ***!
  61173. \******************************************/
  61174. /*! exports provided: default */
  61175. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61176. "use strict";
  61177. __webpack_require__.r(__webpack_exports__);
  61178. /* 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&");
  61179. /* 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&");
  61180. /* 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");
  61181. /* normalize component */
  61182. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61183. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61184. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61185. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61186. false,
  61187. null,
  61188. null,
  61189. null
  61190. )
  61191. /* hot reload */
  61192. if (false) { var api; }
  61193. component.options.__file = "resources/js/views/Dashboard.vue"
  61194. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61195. /***/ }),
  61196. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61197. /*!*******************************************************************!*\
  61198. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61199. \*******************************************************************/
  61200. /*! exports provided: default */
  61201. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61202. "use strict";
  61203. __webpack_require__.r(__webpack_exports__);
  61204. /* 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&");
  61205. /* 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"]);
  61206. /***/ }),
  61207. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61208. /*!*************************************************************************!*\
  61209. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61210. \*************************************************************************/
  61211. /*! exports provided: render, staticRenderFns */
  61212. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61213. "use strict";
  61214. __webpack_require__.r(__webpack_exports__);
  61215. /* 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&");
  61216. /* 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"]; });
  61217. /* 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"]; });
  61218. /***/ }),
  61219. /***/ "./resources/js/views/Login.vue":
  61220. /*!**************************************!*\
  61221. !*** ./resources/js/views/Login.vue ***!
  61222. \**************************************/
  61223. /*! exports provided: default */
  61224. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61225. "use strict";
  61226. __webpack_require__.r(__webpack_exports__);
  61227. /* 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&");
  61228. /* 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&");
  61229. /* 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");
  61230. /* normalize component */
  61231. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61232. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61233. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61234. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61235. false,
  61236. null,
  61237. null,
  61238. null
  61239. )
  61240. /* hot reload */
  61241. if (false) { var api; }
  61242. component.options.__file = "resources/js/views/Login.vue"
  61243. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61244. /***/ }),
  61245. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61246. /*!***************************************************************!*\
  61247. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61248. \***************************************************************/
  61249. /*! exports provided: default */
  61250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61251. "use strict";
  61252. __webpack_require__.r(__webpack_exports__);
  61253. /* 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&");
  61254. /* 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"]);
  61255. /***/ }),
  61256. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61257. /*!*********************************************************************!*\
  61258. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61259. \*********************************************************************/
  61260. /*! exports provided: render, staticRenderFns */
  61261. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61262. "use strict";
  61263. __webpack_require__.r(__webpack_exports__);
  61264. /* 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&");
  61265. /* 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"]; });
  61266. /* 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"]; });
  61267. /***/ }),
  61268. /***/ "./resources/js/views/Welcome.vue":
  61269. /*!****************************************!*\
  61270. !*** ./resources/js/views/Welcome.vue ***!
  61271. \****************************************/
  61272. /*! exports provided: default */
  61273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61274. "use strict";
  61275. __webpack_require__.r(__webpack_exports__);
  61276. /* 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&");
  61277. /* 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&");
  61278. /* 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&");
  61279. /* 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");
  61280. /* normalize component */
  61281. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61282. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61283. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61284. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61285. false,
  61286. null,
  61287. "1ae8ae93",
  61288. null
  61289. )
  61290. /* hot reload */
  61291. if (false) { var api; }
  61292. component.options.__file = "resources/js/views/Welcome.vue"
  61293. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61294. /***/ }),
  61295. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61296. /*!*****************************************************************!*\
  61297. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61298. \*****************************************************************/
  61299. /*! exports provided: default */
  61300. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61301. "use strict";
  61302. __webpack_require__.r(__webpack_exports__);
  61303. /* 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&");
  61304. /* 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"]);
  61305. /***/ }),
  61306. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61307. /*!*************************************************************************************************!*\
  61308. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61309. \*************************************************************************************************/
  61310. /*! no static exports found */
  61311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61312. "use strict";
  61313. __webpack_require__.r(__webpack_exports__);
  61314. /* 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&");
  61315. /* 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__);
  61316. /* 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__));
  61317. /* 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);
  61318. /***/ }),
  61319. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61320. /*!***********************************************************************************!*\
  61321. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61322. \***********************************************************************************/
  61323. /*! exports provided: render, staticRenderFns */
  61324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61325. "use strict";
  61326. __webpack_require__.r(__webpack_exports__);
  61327. /* 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&");
  61328. /* 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"]; });
  61329. /* 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"]; });
  61330. /***/ }),
  61331. /***/ "./resources/js/views/WorkOrder.vue":
  61332. /*!******************************************!*\
  61333. !*** ./resources/js/views/WorkOrder.vue ***!
  61334. \******************************************/
  61335. /*! exports provided: default */
  61336. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61337. "use strict";
  61338. __webpack_require__.r(__webpack_exports__);
  61339. /* 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&");
  61340. /* 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&");
  61341. /* 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");
  61342. /* normalize component */
  61343. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61344. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61345. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61346. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61347. false,
  61348. null,
  61349. null,
  61350. null
  61351. )
  61352. /* hot reload */
  61353. if (false) { var api; }
  61354. component.options.__file = "resources/js/views/WorkOrder.vue"
  61355. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61356. /***/ }),
  61357. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61358. /*!*******************************************************************!*\
  61359. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61360. \*******************************************************************/
  61361. /*! exports provided: default */
  61362. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61363. "use strict";
  61364. __webpack_require__.r(__webpack_exports__);
  61365. /* 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&");
  61366. /* 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"]);
  61367. /***/ }),
  61368. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61369. /*!*************************************************************************!*\
  61370. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61371. \*************************************************************************/
  61372. /*! exports provided: render, staticRenderFns */
  61373. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61374. "use strict";
  61375. __webpack_require__.r(__webpack_exports__);
  61376. /* 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&");
  61377. /* 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"]; });
  61378. /* 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"]; });
  61379. /***/ }),
  61380. /***/ "./resources/sass/app.scss":
  61381. /*!*********************************!*\
  61382. !*** ./resources/sass/app.scss ***!
  61383. \*********************************/
  61384. /*! no static exports found */
  61385. /***/ (function(module, exports) {
  61386. // removed by extract-text-webpack-plugin
  61387. /***/ }),
  61388. /***/ 0:
  61389. /*!*************************************************************!*\
  61390. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61391. \*************************************************************/
  61392. /*! no static exports found */
  61393. /***/ (function(module, exports, __webpack_require__) {
  61394. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61395. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61396. /***/ })
  61397. /******/ });