app.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  1574. /*!********************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  1576. \********************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. /* harmony import */ var _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/AssetInfoEditModal.vue */ "./resources/js/components/AssetInfoEditModal.vue");
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. /* harmony default export */ __webpack_exports__["default"] = ({
  1596. components: {
  1597. AssetInfoEditModal: _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1598. },
  1599. props: {
  1600. asset: {
  1601. type: Object,
  1602. required: true
  1603. }
  1604. }
  1605. });
  1606. /***/ }),
  1607. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1608. /*!*****************************************************************************************************************************************************************************!*\
  1609. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  1610. \*****************************************************************************************************************************************************************************/
  1611. /*! exports provided: default */
  1612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1613. "use strict";
  1614. __webpack_require__.r(__webpack_exports__);
  1615. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1616. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. /* harmony default export */ __webpack_exports__["default"] = ({
  1667. components: {
  1668. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1669. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1670. },
  1671. props: {
  1672. populateWith: {
  1673. type: Object,
  1674. required: true
  1675. },
  1676. modalId: {
  1677. type: String,
  1678. required: true
  1679. }
  1680. },
  1681. data: function data() {
  1682. return {
  1683. // Essentially makes a copy of the object. Otherwise
  1684. // We would have a reference to the exising object causing
  1685. // unwanted mutations in the parent component.
  1686. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1687. assetSaving: false
  1688. };
  1689. },
  1690. methods: {
  1691. updateAsset: function updateAsset() {
  1692. var _this = this;
  1693. this.assetSaving = true;
  1694. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1695. _this.assetSaving = false;
  1696. $("#".concat(_this.modalId)).modal('hide');
  1697. })["catch"](function (error) {
  1698. _this.assetSaving = false;
  1699. });
  1700. }
  1701. }
  1702. });
  1703. /***/ }),
  1704. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1705. /*!*************************************************************************************************************************************************************************************!*\
  1706. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  1707. \*************************************************************************************************************************************************************************************/
  1708. /*! exports provided: default */
  1709. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1710. "use strict";
  1711. __webpack_require__.r(__webpack_exports__);
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. /* harmony default export */ __webpack_exports__["default"] = ({
  1734. props: {
  1735. value: null,
  1736. // An object with the following format
  1737. // {
  1738. // key: value,
  1739. // key: value,
  1740. // }
  1741. options: {
  1742. type: Object,
  1743. required: true
  1744. },
  1745. allowCustom: {
  1746. type: Boolean,
  1747. "default": false
  1748. }
  1749. },
  1750. data: function data() {
  1751. return {
  1752. searchText: '',
  1753. selectedOption: null,
  1754. open: false,
  1755. // allows for checking whether button was clicked or text was typed.
  1756. // If button was clicked, we show all options without having to clear
  1757. // out any searchText that was autofilled when page loaded.
  1758. isSearching: false
  1759. };
  1760. },
  1761. computed: {
  1762. matches: function matches() {
  1763. var _this = this;
  1764. // If button was clicked, show all options, if typing, filter
  1765. // options based on searchText
  1766. return Object.entries(this.options).filter(function (option) {
  1767. var optionText = option[1].toUpperCase();
  1768. if (_this.isSearching) {
  1769. return optionText.match(_this.searchText.toUpperCase());
  1770. } else {
  1771. return optionText.match('');
  1772. }
  1773. });
  1774. }
  1775. },
  1776. methods: {
  1777. // if button is clicked, show all options
  1778. setOpen: function setOpen(isOpen) {
  1779. this.open = isOpen;
  1780. this.isSearching = false;
  1781. },
  1782. // if typing in the box, start filtering options
  1783. searchChanged: function searchChanged() {
  1784. if (!this.open) {
  1785. this.open = true;
  1786. }
  1787. if (!this.isSearching) {
  1788. this.isSearching = true;
  1789. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1790. if (this.allowCustom) {
  1791. this.$emit('input', {
  1792. 'id': 'custom',
  1793. 'name': this.searchText
  1794. });
  1795. }
  1796. },
  1797. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1798. // a suggestion is selected
  1799. suggestionSelected: function suggestionSelected(suggestion) {
  1800. this.open = false;
  1801. this.searchText = suggestion[1];
  1802. this.$emit('input', {
  1803. 'id': suggestion[0],
  1804. 'name': suggestion[1]
  1805. });
  1806. },
  1807. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1808. if (this.allowCustom) {
  1809. this.searchText = this.value.name;
  1810. } else {
  1811. if (newValue.id > -1) {
  1812. // Find the matching text for the supplied option value
  1813. for (var id in this.options) {
  1814. if (this.options.hasOwnProperty(id)) {
  1815. if (this.options[id] === this.options[newValue.id]) {
  1816. this.searchText = this.options[id];
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. },
  1824. mounted: function mounted() {
  1825. this.updateComponentWithValue(this.value);
  1826. },
  1827. watch: {
  1828. value: function value(newValue) {
  1829. this.updateComponentWithValue(newValue);
  1830. }
  1831. }
  1832. });
  1833. /***/ }),
  1834. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1835. /*!************************************************************************************************************************************************************************!*\
  1836. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  1837. \************************************************************************************************************************************************************************/
  1838. /*! exports provided: default */
  1839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1840. "use strict";
  1841. __webpack_require__.r(__webpack_exports__);
  1842. //
  1843. //
  1844. //
  1845. //
  1846. /* harmony default export */ __webpack_exports__["default"] = ({
  1847. name: 'IntersectingCirclesSpinner',
  1848. props: {
  1849. color: {
  1850. type: String,
  1851. "default": '#fff'
  1852. },
  1853. size: {
  1854. type: Number,
  1855. "default": 10
  1856. }
  1857. }
  1858. });
  1859. /***/ }),
  1860. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1861. /*!*********************************************************************************************************************************************************************!*\
  1862. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  1863. \*********************************************************************************************************************************************************************/
  1864. /*! exports provided: default */
  1865. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1866. "use strict";
  1867. __webpack_require__.r(__webpack_exports__);
  1868. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1869. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. /* harmony default export */ __webpack_exports__["default"] = ({
  1914. components: {
  1915. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1916. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1917. },
  1918. props: {
  1919. credential: {
  1920. type: Object,
  1921. required: true
  1922. },
  1923. descriptions: {
  1924. type: Object,
  1925. required: true
  1926. }
  1927. },
  1928. data: function data() {
  1929. return {
  1930. data: this.credential,
  1931. creddescList: this.descriptions
  1932. };
  1933. },
  1934. mounted: function mounted() {
  1935. var _this = this;
  1936. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  1937. _this.data = e.credential;
  1938. });
  1939. },
  1940. methods: {
  1941. deleteCredential: function deleteCredential() {
  1942. var _this2 = this;
  1943. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1944. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1945. })["catch"](function (error) {
  1946. console.error(error);
  1947. });
  1948. }
  1949. }
  1950. });
  1951. /***/ }),
  1952. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1953. /*!******************************************************************************************************************************************************************************!*\
  1954. !*** ./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& ***!
  1955. \******************************************************************************************************************************************************************************/
  1956. /*! exports provided: default */
  1957. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1958. "use strict";
  1959. __webpack_require__.r(__webpack_exports__);
  1960. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1961. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1962. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1993. components: {
  1994. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1995. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1996. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  1997. },
  1998. props: {
  1999. populateWith: {
  2000. type: Object,
  2001. "default": function _default() {
  2002. return {
  2003. creddesc: null,
  2004. creduser: null,
  2005. credpass: null,
  2006. groupid: null,
  2007. pcid: null,
  2008. credtype: null
  2009. };
  2010. }
  2011. },
  2012. modalId: {
  2013. type: String,
  2014. required: true
  2015. },
  2016. descriptions: {
  2017. type: Object,
  2018. required: true
  2019. },
  2020. create: {
  2021. type: Boolean
  2022. },
  2023. pcid: {
  2024. type: Number
  2025. },
  2026. groupid: {
  2027. type: Number
  2028. }
  2029. },
  2030. data: function data() {
  2031. return {
  2032. data: JSON.parse(JSON.stringify(this.populateWith)),
  2033. creddesc: {},
  2034. id: this.modalId,
  2035. errors: [],
  2036. credentialSaving: false
  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. this.credentialSaving = true;
  2060. if (this.creddesc.id === "custom") {
  2061. this.data.credtype = 1;
  2062. this.data.creddesc = this.creddesc.name;
  2063. } else {
  2064. this.data.credtype = this.creddesc.id;
  2065. this.data.creddesc = this.creddesc.name;
  2066. }
  2067. if (this.create) {
  2068. if (this.pcid) {
  2069. this.data.pcid = this.pcid;
  2070. }
  2071. if (this.groupid) {
  2072. this.data.groupid = this.groupid;
  2073. }
  2074. axios.post('/api/credentials/', this.data).then(function (response) {
  2075. _this.credentialSaving = false;
  2076. $('#' + _this.id).modal('hide');
  2077. })["catch"](function (error) {
  2078. _this.credentialSaving = false;
  2079. console.error(error);
  2080. });
  2081. } else {
  2082. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2083. _this.credentialSaving = false;
  2084. $('#' + _this.id).modal('hide');
  2085. })["catch"](function (error) {
  2086. _this.credentialSaving = false;
  2087. console.error(error);
  2088. });
  2089. }
  2090. }
  2091. }
  2092. });
  2093. /***/ }),
  2094. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2095. /*!*************************************************************************************************************************************************************************!*\
  2096. !*** ./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& ***!
  2097. \*************************************************************************************************************************************************************************/
  2098. /*! exports provided: default */
  2099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2100. "use strict";
  2101. __webpack_require__.r(__webpack_exports__);
  2102. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2103. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. /* harmony default export */ __webpack_exports__["default"] = ({
  2114. components: {
  2115. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2116. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2117. },
  2118. props: {
  2119. credentials: {
  2120. type: Array,
  2121. required: true
  2122. },
  2123. descriptions: {
  2124. type: Array,
  2125. required: true
  2126. },
  2127. pcid: {
  2128. type: Number
  2129. },
  2130. groupid: {
  2131. type: Number
  2132. }
  2133. },
  2134. computed: {
  2135. creddescList: function creddescList() {
  2136. var list = {};
  2137. this.descriptions.map(function (val) {
  2138. list[val.creddescid] = val.credtitle;
  2139. });
  2140. return list;
  2141. }
  2142. },
  2143. methods: {
  2144. deleteCred: function deleteCred(index) {
  2145. this.credentials.splice(index, 1);
  2146. }
  2147. },
  2148. mounted: function mounted() {
  2149. var _this = this;
  2150. if (this.pcid) {
  2151. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2152. var deletedCred = e.credential;
  2153. var index = _this.credentials.findIndex(function (credential) {
  2154. return credential.credid === deletedCred['credid'];
  2155. });
  2156. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2157. _this.deleteCred(index);
  2158. }).listen('CredentialAdded', function (e) {
  2159. _this.credentials.unshift(e.credential);
  2160. });
  2161. }
  2162. if (this.groupid) {
  2163. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2164. var deletedCred = e.credential;
  2165. var index = _this.credentials.findIndex(function (credential) {
  2166. return credential.groupid === deletedCred['groupid'];
  2167. });
  2168. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2169. _this.deleteCred(index);
  2170. }).listen('CredentialAdded', function (e) {
  2171. _this.credentials.unshift(e.credential);
  2172. });
  2173. }
  2174. }
  2175. });
  2176. /***/ }),
  2177. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  2178. /*!********************************************************************************************************************************************************************!*\
  2179. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  2180. \********************************************************************************************************************************************************************/
  2181. /*! exports provided: default */
  2182. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2183. "use strict";
  2184. __webpack_require__.r(__webpack_exports__);
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. /* harmony default export */ __webpack_exports__["default"] = ({
  2191. props: ['errors'],
  2192. data: function data() {
  2193. return {
  2194. errorList: this.errors
  2195. };
  2196. },
  2197. watch: {
  2198. errors: function errors(newErrors) {
  2199. this.errorList = newErrors;
  2200. }
  2201. }
  2202. });
  2203. /***/ }),
  2204. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2205. /*!************************************************************************************************************************************************************************!*\
  2206. !*** ./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& ***!
  2207. \************************************************************************************************************************************************************************/
  2208. /*! exports provided: default */
  2209. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2210. "use strict";
  2211. __webpack_require__.r(__webpack_exports__);
  2212. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. /* harmony default export */ __webpack_exports__["default"] = ({
  2231. components: {
  2232. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2233. },
  2234. props: {
  2235. populateWith: {
  2236. type: Object,
  2237. require: true
  2238. },
  2239. modalId: {
  2240. type: String,
  2241. require: true
  2242. },
  2243. noteType: {
  2244. type: Number
  2245. },
  2246. noteUser: {
  2247. type: String
  2248. },
  2249. woid: {
  2250. type: Number
  2251. }
  2252. },
  2253. data: function data() {
  2254. return {
  2255. note: JSON.parse(JSON.stringify(this.populateWith))
  2256. };
  2257. },
  2258. methods: {
  2259. updateNote: function updateNote(note) {
  2260. var _this = this;
  2261. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2262. _this.hideModal();
  2263. });
  2264. },
  2265. hideModal: function hideModal() {
  2266. $('#' + this.modalId).modal('hide');
  2267. }
  2268. }
  2269. });
  2270. /***/ }),
  2271. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2272. /*!****************************************************************************************************************************************************************!*\
  2273. !*** ./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& ***!
  2274. \****************************************************************************************************************************************************************/
  2275. /*! exports provided: default */
  2276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2277. "use strict";
  2278. __webpack_require__.r(__webpack_exports__);
  2279. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2280. /* harmony import */ var _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. /* harmony default export */ __webpack_exports__["default"] = ({
  2320. components: {
  2321. NoteFormModal: _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2322. },
  2323. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2324. props: {
  2325. notes: {
  2326. type: Array,
  2327. "default": []
  2328. },
  2329. authusername: {
  2330. type: String,
  2331. required: true
  2332. },
  2333. noteType: {
  2334. type: Number,
  2335. required: true
  2336. },
  2337. woid: {
  2338. type: String,
  2339. required: true
  2340. }
  2341. },
  2342. data: function data() {
  2343. return {
  2344. newNote: {
  2345. notetype: this.noteType,
  2346. thenote: '',
  2347. noteuser: this.authusername,
  2348. woid: this.woid
  2349. }
  2350. };
  2351. },
  2352. computed: {
  2353. noteOrders: function noteOrders() {
  2354. return this.getNoteOrders(this.notes);
  2355. }
  2356. },
  2357. methods: {
  2358. createNote: function createNote() {
  2359. var _this = this;
  2360. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2361. $('#note' + _this.noteType + 'add').collapse('hide');
  2362. _this.newNote.thenote = '';
  2363. });
  2364. },
  2365. getNoteOrders: function getNoteOrders(notes) {
  2366. var noteOrders = [];
  2367. notes.forEach(function (note, index) {
  2368. if (index === 0) {
  2369. noteOrders[index] = 'order-first';
  2370. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2371. if (noteOrders[index - 1] === 'order-first') {
  2372. noteOrders[index] = 'order-last';
  2373. } else {
  2374. noteOrders[index] = 'order-first';
  2375. }
  2376. } else {
  2377. noteOrders[index] = noteOrders[index - 1];
  2378. }
  2379. });
  2380. return noteOrders;
  2381. }
  2382. }
  2383. });
  2384. /***/ }),
  2385. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2386. /*!**************************************************************************************************************************************************************************!*\
  2387. !*** ./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& ***!
  2388. \**************************************************************************************************************************************************************************/
  2389. /*! exports provided: default */
  2390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2391. "use strict";
  2392. __webpack_require__.r(__webpack_exports__);
  2393. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2394. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2395. /* harmony import */ var _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/ErrorList.vue */ "./resources/js/components/ErrorList.vue");
  2396. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. //
  2421. //
  2422. //
  2423. //
  2424. //
  2425. //
  2426. //
  2427. //
  2428. //
  2429. //
  2430. //
  2431. //
  2432. //
  2433. /* harmony default export */ __webpack_exports__["default"] = ({
  2434. components: {
  2435. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2436. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2437. ErrorList: _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2438. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2439. },
  2440. props: {
  2441. populateWith: {
  2442. type: Object,
  2443. required: true
  2444. },
  2445. storeList: {
  2446. type: Object,
  2447. required: true
  2448. },
  2449. modalId: {
  2450. type: String,
  2451. required: true
  2452. }
  2453. },
  2454. data: function data() {
  2455. return {
  2456. // Copies object from prop, so it doesn't mutate the object
  2457. // from the parent component. Parent component will be updated via
  2458. // Websocket if updateWorkOrder is successful.
  2459. data: JSON.parse(JSON.stringify(this.populateWith)),
  2460. id: this.modalId,
  2461. store: {},
  2462. errors: [],
  2463. woInfoSaving: false
  2464. };
  2465. },
  2466. methods: {
  2467. updateWorkOrder: function updateWorkOrder() {
  2468. var _this = this;
  2469. this.woInfoSaving = true;
  2470. this.data.storeid = this.store.id;
  2471. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2472. _this.woInfoSaving = false;
  2473. $('#workordereditModal').modal('hide');
  2474. })["catch"](function (error) {
  2475. _this.woInfoSaving = false;
  2476. _this.errors = JSON.parse(error.response.request.response).errors;
  2477. });
  2478. }
  2479. },
  2480. mounted: function mounted() {
  2481. this.store = {
  2482. 'id': this.data.storeid,
  2483. 'name': this.storeList[this.data.storeid]
  2484. };
  2485. },
  2486. // This was originally here because the populateWith info would originally
  2487. // not necessarily be loaded when this component was mounted. That is no
  2488. // longer the case as I now don't render the parent component until the
  2489. // ajax request is finised. The watch statements are still here to cover
  2490. // the case where someone else updates the populateWith values while
  2491. // someone is editing, although it probably should be edited so it doesn't
  2492. // immediately overwrite the unsaved edits of the current user.
  2493. watch: {
  2494. populateWith: function populateWith(value) {
  2495. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2496. this.store = {
  2497. 'id': this.data.storeid,
  2498. 'name': this.storeList[this.data.storeid]
  2499. };
  2500. },
  2501. storeList: function storeList(value) {
  2502. this.store = {
  2503. 'id': this.data.storeid,
  2504. 'name': this.storeList[this.data.storeid]
  2505. };
  2506. }
  2507. }
  2508. });
  2509. /***/ }),
  2510. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2511. /*!************************************************************************************************************************************************************************!*\
  2512. !*** ./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& ***!
  2513. \************************************************************************************************************************************************************************/
  2514. /*! exports provided: default */
  2515. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2516. "use strict";
  2517. __webpack_require__.r(__webpack_exports__);
  2518. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2519. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2520. //
  2521. //
  2522. //
  2523. //
  2524. //
  2525. //
  2526. //
  2527. //
  2528. //
  2529. //
  2530. //
  2531. //
  2532. //
  2533. //
  2534. //
  2535. //
  2536. //
  2537. //
  2538. //
  2539. //
  2540. /* harmony default export */ __webpack_exports__["default"] = ({
  2541. components: {
  2542. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2543. },
  2544. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2545. props: ['workOrder', 'stores'],
  2546. computed: {
  2547. storeList: function storeList() {
  2548. var list = {};
  2549. Object.values(this.stores).map(function (val) {
  2550. list[val.storeid] = val.storesname;
  2551. });
  2552. return list;
  2553. }
  2554. }
  2555. });
  2556. /***/ }),
  2557. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2558. /*!*********************************************************************************************************************************************************!*\
  2559. !*** ./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& ***!
  2560. \*********************************************************************************************************************************************************/
  2561. /*! exports provided: default */
  2562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2563. "use strict";
  2564. __webpack_require__.r(__webpack_exports__);
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. //
  2571. //
  2572. //
  2573. //
  2574. //
  2575. //
  2576. //
  2577. //
  2578. //
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. //
  2592. //
  2593. //
  2594. //
  2595. //
  2596. //
  2597. //
  2598. //
  2599. //
  2600. //
  2601. //
  2602. //
  2603. //
  2604. //
  2605. //
  2606. //
  2607. //
  2608. //
  2609. //
  2610. //
  2611. //
  2612. //
  2613. //
  2614. //
  2615. //
  2616. //
  2617. //
  2618. //
  2619. //
  2620. //
  2621. //
  2622. //
  2623. //
  2624. //
  2625. //
  2626. //
  2627. //
  2628. //
  2629. //
  2630. //
  2631. //
  2632. //
  2633. //
  2634. //
  2635. //
  2636. /* harmony default export */ __webpack_exports__["default"] = ({
  2637. data: function data() {
  2638. return {
  2639. isLoggedIn: null,
  2640. username: null
  2641. };
  2642. },
  2643. mounted: function mounted() {
  2644. this.isLoggedIn = localStorage.getItem('jwt');
  2645. this.username = localStorage.getItem('user');
  2646. }
  2647. });
  2648. /***/ }),
  2649. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2650. /*!***************************************************************************************************************************************************************!*\
  2651. !*** ./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& ***!
  2652. \***************************************************************************************************************************************************************/
  2653. /*! exports provided: default */
  2654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2655. "use strict";
  2656. __webpack_require__.r(__webpack_exports__);
  2657. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2658. //
  2659. //
  2660. //
  2661. //
  2662. //
  2663. //
  2664. //
  2665. //
  2666. //
  2667. //
  2668. //
  2669. //
  2670. //
  2671. //
  2672. //
  2673. //
  2674. //
  2675. //
  2676. //
  2677. //
  2678. //
  2679. //
  2680. //
  2681. //
  2682. //
  2683. //
  2684. /* harmony default export */ __webpack_exports__["default"] = ({
  2685. components: {
  2686. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2687. },
  2688. data: function data() {
  2689. return {
  2690. workOrders: [],
  2691. isLoading: true
  2692. };
  2693. },
  2694. mounted: function mounted() {
  2695. var _this = this;
  2696. var token = localStorage.getItem('jwt');
  2697. var user = localStorage.getItem('user');
  2698. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2699. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2700. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2701. _this.workOrders = response.data;
  2702. _this.isLoading = false;
  2703. })["catch"](function (error) {
  2704. console.log(error);
  2705. });
  2706. },
  2707. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2708. if (!localStorage.getItem('jwt')) {
  2709. return next('login');
  2710. }
  2711. next();
  2712. }
  2713. });
  2714. /***/ }),
  2715. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2716. /*!***********************************************************************************************************************************************************!*\
  2717. !*** ./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& ***!
  2718. \***********************************************************************************************************************************************************/
  2719. /*! exports provided: default */
  2720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2721. "use strict";
  2722. __webpack_require__.r(__webpack_exports__);
  2723. //
  2724. //
  2725. //
  2726. //
  2727. //
  2728. //
  2729. //
  2730. //
  2731. //
  2732. //
  2733. //
  2734. //
  2735. //
  2736. //
  2737. //
  2738. //
  2739. //
  2740. //
  2741. //
  2742. //
  2743. //
  2744. //
  2745. //
  2746. //
  2747. //
  2748. //
  2749. //
  2750. //
  2751. //
  2752. //
  2753. //
  2754. //
  2755. //
  2756. //
  2757. //
  2758. //
  2759. //
  2760. //
  2761. //
  2762. /* harmony default export */ __webpack_exports__["default"] = ({
  2763. data: function data() {
  2764. return {
  2765. username: "",
  2766. password: ""
  2767. };
  2768. },
  2769. methods: {
  2770. handleSubmit: function handleSubmit(e) {
  2771. var _this = this;
  2772. e.preventDefault();
  2773. if (this.password.length > 0) {
  2774. axios.post('api/login', {
  2775. username: this.username,
  2776. password: this.password
  2777. }).then(function (response) {
  2778. localStorage.setItem('user', response.data.success.username);
  2779. localStorage.setItem('jwt', response.data.success.token);
  2780. if (localStorage.getItem('jwt') != null) {
  2781. _this.$router.go('/dashboard');
  2782. }
  2783. })["catch"](function (error) {
  2784. console.error(error);
  2785. });
  2786. }
  2787. }
  2788. },
  2789. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2790. if (localStorage.getItem('jwt')) {
  2791. return next('dashboard');
  2792. }
  2793. next();
  2794. }
  2795. });
  2796. /***/ }),
  2797. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2798. /*!*************************************************************************************************************************************************************!*\
  2799. !*** ./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& ***!
  2800. \*************************************************************************************************************************************************************/
  2801. /*! exports provided: default */
  2802. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2803. "use strict";
  2804. __webpack_require__.r(__webpack_exports__);
  2805. //
  2806. //
  2807. //
  2808. //
  2809. //
  2810. //
  2811. //
  2812. //
  2813. //
  2814. //
  2815. //
  2816. //
  2817. //
  2818. //
  2819. //
  2820. //
  2821. //
  2822. //
  2823. //
  2824. //
  2825. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({});
  2857. /***/ }),
  2858. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2859. /*!***************************************************************************************************************************************************************!*\
  2860. !*** ./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& ***!
  2861. \***************************************************************************************************************************************************************/
  2862. /*! exports provided: default */
  2863. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2864. "use strict";
  2865. __webpack_require__.r(__webpack_exports__);
  2866. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2867. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2868. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2869. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2870. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  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. //
  2928. //
  2929. //
  2930. //
  2931. //
  2932. //
  2933. //
  2934. //
  2935. //
  2936. //
  2937. //
  2938. //
  2939. //
  2940. //
  2941. //
  2942. //
  2943. //
  2944. //
  2945. //
  2946. //
  2947. //
  2948. //
  2949. //
  2950. //
  2951. //
  2952. //
  2953. //
  2954. //
  2955. //
  2956. //
  2957. //
  2958. //
  2959. //
  2960. //
  2961. //
  2962. //
  2963. //
  2964. //
  2965. //
  2966. //
  2967. //
  2968. //
  2969. //
  2970. //
  2971. //
  2972. /* harmony default export */ __webpack_exports__["default"] = ({
  2973. components: {
  2974. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2975. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2976. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2977. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  2978. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  2979. },
  2980. props: {
  2981. id: {
  2982. type: String,
  2983. required: true
  2984. }
  2985. },
  2986. data: function data() {
  2987. return {
  2988. workOrder: {},
  2989. asset: {},
  2990. stores: {},
  2991. credentials: {},
  2992. credentialDescriptions: {},
  2993. workOrderNotes: [],
  2994. woLoading: true,
  2995. assetLoading: true,
  2996. storesLoading: true,
  2997. credentialsLoading: true,
  2998. credentialDescriptionsLoading: true,
  2999. workOrderNotesLoading: true,
  3000. authUser: localStorage.getItem('user')
  3001. };
  3002. },
  3003. computed: {
  3004. publicNotes: function publicNotes() {
  3005. var notes = [];
  3006. notes = this.workOrderNotes.filter(function (note) {
  3007. return note.notetype === 0;
  3008. });
  3009. return notes;
  3010. },
  3011. privateNotes: function privateNotes() {
  3012. var notes = [];
  3013. notes = this.workOrderNotes.filter(function (note) {
  3014. return note.notetype === 1;
  3015. });
  3016. return notes;
  3017. }
  3018. },
  3019. mounted: function mounted() {
  3020. var _this = this;
  3021. // Get authentication info from current user from local storage
  3022. var token = localStorage.getItem('jwt');
  3023. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3024. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3025. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3026. axios.get('/api/workorders/' + this.id).then(function (response) {
  3027. _this.workOrder = response.data;
  3028. _this.woLoading = false;
  3029. })["catch"](function (error) {
  3030. console.log(error);
  3031. }); // Get list of stores from API
  3032. axios.get('/api/stores/').then(function (response) {
  3033. _this.stores = response.data;
  3034. _this.storesLoading = false;
  3035. })["catch"](function (error) {
  3036. console.log(error);
  3037. }); // Get Asset from API (will most likely be replaced with list of assets
  3038. // in the future. Current each WO can only have one but that is likely
  3039. // to change)
  3040. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3041. _this.asset = response.data;
  3042. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3043. // Must be done here or we can't guarantee this.asset
  3044. // exists by the time we execute this code.
  3045. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3046. _this.asset = e.data;
  3047. }); // Get Credentials for this asset. May be relocated to be part of asset
  3048. // Component when WOs can have more than one asset.
  3049. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3050. _this.credentials = response.data;
  3051. _this.credentialsLoading = false;
  3052. })["catch"](function (error) {
  3053. console.log(error);
  3054. }); // Get default list of Credential Descriptions. May be relocated along with
  3055. // the above.
  3056. axios.get('/api/credentials/descriptions').then(function (response) {
  3057. _this.credentialDescriptions = response.data;
  3058. _this.credentialDescriptionsLoading = false;
  3059. })["catch"](function (error) {
  3060. console.log(error);
  3061. });
  3062. })["catch"](function (error) {
  3063. console.log(error);
  3064. });
  3065. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3066. _this.workOrderNotes = response.data;
  3067. _this.workOrderNotesLoading = false;
  3068. })["catch"](function (error) {
  3069. console.log(error);
  3070. });
  3071. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3072. _this.workOrder = e.data;
  3073. });
  3074. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3075. _this.workOrderNotes.push(e.note);
  3076. }).listen('WorkOrderNoteUpdated', function (e) {
  3077. var index = _this.workOrderNotes.findIndex(function (note) {
  3078. return note.noteid === e.note.noteid;
  3079. }); // Note has to be edited this way, or else Vue cannot
  3080. // see it to recompute the computed values.
  3081. _this.workOrderNotes.splice(index, 1, e.note);
  3082. }).listen('WorkOrderNoteDeleted', function (e) {
  3083. var index = _this.notes.findIndex(function (note) {
  3084. return note.noteid === e.noteid;
  3085. });
  3086. _this.notes.splice(index, 1);
  3087. });
  3088. }
  3089. });
  3090. /***/ }),
  3091. /***/ "./node_modules/base64-js/index.js":
  3092. /*!*****************************************!*\
  3093. !*** ./node_modules/base64-js/index.js ***!
  3094. \*****************************************/
  3095. /*! no static exports found */
  3096. /***/ (function(module, exports, __webpack_require__) {
  3097. "use strict";
  3098. exports.byteLength = byteLength
  3099. exports.toByteArray = toByteArray
  3100. exports.fromByteArray = fromByteArray
  3101. var lookup = []
  3102. var revLookup = []
  3103. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3104. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3105. for (var i = 0, len = code.length; i < len; ++i) {
  3106. lookup[i] = code[i]
  3107. revLookup[code.charCodeAt(i)] = i
  3108. }
  3109. // Support decoding URL-safe base64 strings, as Node.js does.
  3110. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3111. revLookup['-'.charCodeAt(0)] = 62
  3112. revLookup['_'.charCodeAt(0)] = 63
  3113. function getLens (b64) {
  3114. var len = b64.length
  3115. if (len % 4 > 0) {
  3116. throw new Error('Invalid string. Length must be a multiple of 4')
  3117. }
  3118. // Trim off extra bytes after placeholder bytes are found
  3119. // See: https://github.com/beatgammit/base64-js/issues/42
  3120. var validLen = b64.indexOf('=')
  3121. if (validLen === -1) validLen = len
  3122. var placeHoldersLen = validLen === len
  3123. ? 0
  3124. : 4 - (validLen % 4)
  3125. return [validLen, placeHoldersLen]
  3126. }
  3127. // base64 is 4/3 + up to two characters of the original data
  3128. function byteLength (b64) {
  3129. var lens = getLens(b64)
  3130. var validLen = lens[0]
  3131. var placeHoldersLen = lens[1]
  3132. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3133. }
  3134. function _byteLength (b64, validLen, placeHoldersLen) {
  3135. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3136. }
  3137. function toByteArray (b64) {
  3138. var tmp
  3139. var lens = getLens(b64)
  3140. var validLen = lens[0]
  3141. var placeHoldersLen = lens[1]
  3142. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3143. var curByte = 0
  3144. // if there are placeholders, only get up to the last complete 4 chars
  3145. var len = placeHoldersLen > 0
  3146. ? validLen - 4
  3147. : validLen
  3148. var i
  3149. for (i = 0; i < len; i += 4) {
  3150. tmp =
  3151. (revLookup[b64.charCodeAt(i)] << 18) |
  3152. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3153. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3154. revLookup[b64.charCodeAt(i + 3)]
  3155. arr[curByte++] = (tmp >> 16) & 0xFF
  3156. arr[curByte++] = (tmp >> 8) & 0xFF
  3157. arr[curByte++] = tmp & 0xFF
  3158. }
  3159. if (placeHoldersLen === 2) {
  3160. tmp =
  3161. (revLookup[b64.charCodeAt(i)] << 2) |
  3162. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3163. arr[curByte++] = tmp & 0xFF
  3164. }
  3165. if (placeHoldersLen === 1) {
  3166. tmp =
  3167. (revLookup[b64.charCodeAt(i)] << 10) |
  3168. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3169. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3170. arr[curByte++] = (tmp >> 8) & 0xFF
  3171. arr[curByte++] = tmp & 0xFF
  3172. }
  3173. return arr
  3174. }
  3175. function tripletToBase64 (num) {
  3176. return lookup[num >> 18 & 0x3F] +
  3177. lookup[num >> 12 & 0x3F] +
  3178. lookup[num >> 6 & 0x3F] +
  3179. lookup[num & 0x3F]
  3180. }
  3181. function encodeChunk (uint8, start, end) {
  3182. var tmp
  3183. var output = []
  3184. for (var i = start; i < end; i += 3) {
  3185. tmp =
  3186. ((uint8[i] << 16) & 0xFF0000) +
  3187. ((uint8[i + 1] << 8) & 0xFF00) +
  3188. (uint8[i + 2] & 0xFF)
  3189. output.push(tripletToBase64(tmp))
  3190. }
  3191. return output.join('')
  3192. }
  3193. function fromByteArray (uint8) {
  3194. var tmp
  3195. var len = uint8.length
  3196. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3197. var parts = []
  3198. var maxChunkLength = 16383 // must be multiple of 3
  3199. // go through the array every three bytes, we'll deal with trailing stuff later
  3200. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3201. parts.push(encodeChunk(
  3202. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3203. ))
  3204. }
  3205. // pad the end with zeros, but make sure to not forget the extra bytes
  3206. if (extraBytes === 1) {
  3207. tmp = uint8[len - 1]
  3208. parts.push(
  3209. lookup[tmp >> 2] +
  3210. lookup[(tmp << 4) & 0x3F] +
  3211. '=='
  3212. )
  3213. } else if (extraBytes === 2) {
  3214. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3215. parts.push(
  3216. lookup[tmp >> 10] +
  3217. lookup[(tmp >> 4) & 0x3F] +
  3218. lookup[(tmp << 2) & 0x3F] +
  3219. '='
  3220. )
  3221. }
  3222. return parts.join('')
  3223. }
  3224. /***/ }),
  3225. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3226. /*!*****************************************************!*\
  3227. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3228. \*****************************************************/
  3229. /*! no static exports found */
  3230. /***/ (function(module, exports, __webpack_require__) {
  3231. /*!
  3232. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3233. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3234. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3235. */
  3236. (function (global, factory) {
  3237. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3238. undefined;
  3239. }(this, (function (exports, $, Popper) { 'use strict';
  3240. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3241. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3242. function _defineProperties(target, props) {
  3243. for (var i = 0; i < props.length; i++) {
  3244. var descriptor = props[i];
  3245. descriptor.enumerable = descriptor.enumerable || false;
  3246. descriptor.configurable = true;
  3247. if ("value" in descriptor) descriptor.writable = true;
  3248. Object.defineProperty(target, descriptor.key, descriptor);
  3249. }
  3250. }
  3251. function _createClass(Constructor, protoProps, staticProps) {
  3252. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3253. if (staticProps) _defineProperties(Constructor, staticProps);
  3254. return Constructor;
  3255. }
  3256. function _defineProperty(obj, key, value) {
  3257. if (key in obj) {
  3258. Object.defineProperty(obj, key, {
  3259. value: value,
  3260. enumerable: true,
  3261. configurable: true,
  3262. writable: true
  3263. });
  3264. } else {
  3265. obj[key] = value;
  3266. }
  3267. return obj;
  3268. }
  3269. function ownKeys(object, enumerableOnly) {
  3270. var keys = Object.keys(object);
  3271. if (Object.getOwnPropertySymbols) {
  3272. var symbols = Object.getOwnPropertySymbols(object);
  3273. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3274. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3275. });
  3276. keys.push.apply(keys, symbols);
  3277. }
  3278. return keys;
  3279. }
  3280. function _objectSpread2(target) {
  3281. for (var i = 1; i < arguments.length; i++) {
  3282. var source = arguments[i] != null ? arguments[i] : {};
  3283. if (i % 2) {
  3284. ownKeys(Object(source), true).forEach(function (key) {
  3285. _defineProperty(target, key, source[key]);
  3286. });
  3287. } else if (Object.getOwnPropertyDescriptors) {
  3288. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3289. } else {
  3290. ownKeys(Object(source)).forEach(function (key) {
  3291. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3292. });
  3293. }
  3294. }
  3295. return target;
  3296. }
  3297. function _inheritsLoose(subClass, superClass) {
  3298. subClass.prototype = Object.create(superClass.prototype);
  3299. subClass.prototype.constructor = subClass;
  3300. subClass.__proto__ = superClass;
  3301. }
  3302. /**
  3303. * --------------------------------------------------------------------------
  3304. * Bootstrap (v4.4.1): util.js
  3305. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3306. * --------------------------------------------------------------------------
  3307. */
  3308. /**
  3309. * ------------------------------------------------------------------------
  3310. * Private TransitionEnd Helpers
  3311. * ------------------------------------------------------------------------
  3312. */
  3313. var TRANSITION_END = 'transitionend';
  3314. var MAX_UID = 1000000;
  3315. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3316. function toType(obj) {
  3317. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3318. }
  3319. function getSpecialTransitionEndEvent() {
  3320. return {
  3321. bindType: TRANSITION_END,
  3322. delegateType: TRANSITION_END,
  3323. handle: function handle(event) {
  3324. if ($(event.target).is(this)) {
  3325. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3326. }
  3327. return undefined; // eslint-disable-line no-undefined
  3328. }
  3329. };
  3330. }
  3331. function transitionEndEmulator(duration) {
  3332. var _this = this;
  3333. var called = false;
  3334. $(this).one(Util.TRANSITION_END, function () {
  3335. called = true;
  3336. });
  3337. setTimeout(function () {
  3338. if (!called) {
  3339. Util.triggerTransitionEnd(_this);
  3340. }
  3341. }, duration);
  3342. return this;
  3343. }
  3344. function setTransitionEndSupport() {
  3345. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3346. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3347. }
  3348. /**
  3349. * --------------------------------------------------------------------------
  3350. * Public Util Api
  3351. * --------------------------------------------------------------------------
  3352. */
  3353. var Util = {
  3354. TRANSITION_END: 'bsTransitionEnd',
  3355. getUID: function getUID(prefix) {
  3356. do {
  3357. // eslint-disable-next-line no-bitwise
  3358. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3359. } while (document.getElementById(prefix));
  3360. return prefix;
  3361. },
  3362. getSelectorFromElement: function getSelectorFromElement(element) {
  3363. var selector = element.getAttribute('data-target');
  3364. if (!selector || selector === '#') {
  3365. var hrefAttr = element.getAttribute('href');
  3366. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3367. }
  3368. try {
  3369. return document.querySelector(selector) ? selector : null;
  3370. } catch (err) {
  3371. return null;
  3372. }
  3373. },
  3374. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3375. if (!element) {
  3376. return 0;
  3377. } // Get transition-duration of the element
  3378. var transitionDuration = $(element).css('transition-duration');
  3379. var transitionDelay = $(element).css('transition-delay');
  3380. var floatTransitionDuration = parseFloat(transitionDuration);
  3381. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3382. if (!floatTransitionDuration && !floatTransitionDelay) {
  3383. return 0;
  3384. } // If multiple durations are defined, take the first
  3385. transitionDuration = transitionDuration.split(',')[0];
  3386. transitionDelay = transitionDelay.split(',')[0];
  3387. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3388. },
  3389. reflow: function reflow(element) {
  3390. return element.offsetHeight;
  3391. },
  3392. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3393. $(element).trigger(TRANSITION_END);
  3394. },
  3395. // TODO: Remove in v5
  3396. supportsTransitionEnd: function supportsTransitionEnd() {
  3397. return Boolean(TRANSITION_END);
  3398. },
  3399. isElement: function isElement(obj) {
  3400. return (obj[0] || obj).nodeType;
  3401. },
  3402. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3403. for (var property in configTypes) {
  3404. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3405. var expectedTypes = configTypes[property];
  3406. var value = config[property];
  3407. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3408. if (!new RegExp(expectedTypes).test(valueType)) {
  3409. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3410. }
  3411. }
  3412. }
  3413. },
  3414. findShadowRoot: function findShadowRoot(element) {
  3415. if (!document.documentElement.attachShadow) {
  3416. return null;
  3417. } // Can find the shadow root otherwise it'll return the document
  3418. if (typeof element.getRootNode === 'function') {
  3419. var root = element.getRootNode();
  3420. return root instanceof ShadowRoot ? root : null;
  3421. }
  3422. if (element instanceof ShadowRoot) {
  3423. return element;
  3424. } // when we don't find a shadow root
  3425. if (!element.parentNode) {
  3426. return null;
  3427. }
  3428. return Util.findShadowRoot(element.parentNode);
  3429. },
  3430. jQueryDetection: function jQueryDetection() {
  3431. if (typeof $ === 'undefined') {
  3432. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3433. }
  3434. var version = $.fn.jquery.split(' ')[0].split('.');
  3435. var minMajor = 1;
  3436. var ltMajor = 2;
  3437. var minMinor = 9;
  3438. var minPatch = 1;
  3439. var maxMajor = 4;
  3440. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3441. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3442. }
  3443. }
  3444. };
  3445. Util.jQueryDetection();
  3446. setTransitionEndSupport();
  3447. /**
  3448. * ------------------------------------------------------------------------
  3449. * Constants
  3450. * ------------------------------------------------------------------------
  3451. */
  3452. var NAME = 'alert';
  3453. var VERSION = '4.4.1';
  3454. var DATA_KEY = 'bs.alert';
  3455. var EVENT_KEY = "." + DATA_KEY;
  3456. var DATA_API_KEY = '.data-api';
  3457. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3458. var Selector = {
  3459. DISMISS: '[data-dismiss="alert"]'
  3460. };
  3461. var Event = {
  3462. CLOSE: "close" + EVENT_KEY,
  3463. CLOSED: "closed" + EVENT_KEY,
  3464. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3465. };
  3466. var ClassName = {
  3467. ALERT: 'alert',
  3468. FADE: 'fade',
  3469. SHOW: 'show'
  3470. };
  3471. /**
  3472. * ------------------------------------------------------------------------
  3473. * Class Definition
  3474. * ------------------------------------------------------------------------
  3475. */
  3476. var Alert =
  3477. /*#__PURE__*/
  3478. function () {
  3479. function Alert(element) {
  3480. this._element = element;
  3481. } // Getters
  3482. var _proto = Alert.prototype;
  3483. // Public
  3484. _proto.close = function close(element) {
  3485. var rootElement = this._element;
  3486. if (element) {
  3487. rootElement = this._getRootElement(element);
  3488. }
  3489. var customEvent = this._triggerCloseEvent(rootElement);
  3490. if (customEvent.isDefaultPrevented()) {
  3491. return;
  3492. }
  3493. this._removeElement(rootElement);
  3494. };
  3495. _proto.dispose = function dispose() {
  3496. $.removeData(this._element, DATA_KEY);
  3497. this._element = null;
  3498. } // Private
  3499. ;
  3500. _proto._getRootElement = function _getRootElement(element) {
  3501. var selector = Util.getSelectorFromElement(element);
  3502. var parent = false;
  3503. if (selector) {
  3504. parent = document.querySelector(selector);
  3505. }
  3506. if (!parent) {
  3507. parent = $(element).closest("." + ClassName.ALERT)[0];
  3508. }
  3509. return parent;
  3510. };
  3511. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3512. var closeEvent = $.Event(Event.CLOSE);
  3513. $(element).trigger(closeEvent);
  3514. return closeEvent;
  3515. };
  3516. _proto._removeElement = function _removeElement(element) {
  3517. var _this = this;
  3518. $(element).removeClass(ClassName.SHOW);
  3519. if (!$(element).hasClass(ClassName.FADE)) {
  3520. this._destroyElement(element);
  3521. return;
  3522. }
  3523. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3524. $(element).one(Util.TRANSITION_END, function (event) {
  3525. return _this._destroyElement(element, event);
  3526. }).emulateTransitionEnd(transitionDuration);
  3527. };
  3528. _proto._destroyElement = function _destroyElement(element) {
  3529. $(element).detach().trigger(Event.CLOSED).remove();
  3530. } // Static
  3531. ;
  3532. Alert._jQueryInterface = function _jQueryInterface(config) {
  3533. return this.each(function () {
  3534. var $element = $(this);
  3535. var data = $element.data(DATA_KEY);
  3536. if (!data) {
  3537. data = new Alert(this);
  3538. $element.data(DATA_KEY, data);
  3539. }
  3540. if (config === 'close') {
  3541. data[config](this);
  3542. }
  3543. });
  3544. };
  3545. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3546. return function (event) {
  3547. if (event) {
  3548. event.preventDefault();
  3549. }
  3550. alertInstance.close(this);
  3551. };
  3552. };
  3553. _createClass(Alert, null, [{
  3554. key: "VERSION",
  3555. get: function get() {
  3556. return VERSION;
  3557. }
  3558. }]);
  3559. return Alert;
  3560. }();
  3561. /**
  3562. * ------------------------------------------------------------------------
  3563. * Data Api implementation
  3564. * ------------------------------------------------------------------------
  3565. */
  3566. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3567. /**
  3568. * ------------------------------------------------------------------------
  3569. * jQuery
  3570. * ------------------------------------------------------------------------
  3571. */
  3572. $.fn[NAME] = Alert._jQueryInterface;
  3573. $.fn[NAME].Constructor = Alert;
  3574. $.fn[NAME].noConflict = function () {
  3575. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3576. return Alert._jQueryInterface;
  3577. };
  3578. /**
  3579. * ------------------------------------------------------------------------
  3580. * Constants
  3581. * ------------------------------------------------------------------------
  3582. */
  3583. var NAME$1 = 'button';
  3584. var VERSION$1 = '4.4.1';
  3585. var DATA_KEY$1 = 'bs.button';
  3586. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3587. var DATA_API_KEY$1 = '.data-api';
  3588. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3589. var ClassName$1 = {
  3590. ACTIVE: 'active',
  3591. BUTTON: 'btn',
  3592. FOCUS: 'focus'
  3593. };
  3594. var Selector$1 = {
  3595. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3596. DATA_TOGGLES: '[data-toggle="buttons"]',
  3597. DATA_TOGGLE: '[data-toggle="button"]',
  3598. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3599. INPUT: 'input:not([type="hidden"])',
  3600. ACTIVE: '.active',
  3601. BUTTON: '.btn'
  3602. };
  3603. var Event$1 = {
  3604. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3605. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3606. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3607. };
  3608. /**
  3609. * ------------------------------------------------------------------------
  3610. * Class Definition
  3611. * ------------------------------------------------------------------------
  3612. */
  3613. var Button =
  3614. /*#__PURE__*/
  3615. function () {
  3616. function Button(element) {
  3617. this._element = element;
  3618. } // Getters
  3619. var _proto = Button.prototype;
  3620. // Public
  3621. _proto.toggle = function toggle() {
  3622. var triggerChangeEvent = true;
  3623. var addAriaPressed = true;
  3624. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3625. if (rootElement) {
  3626. var input = this._element.querySelector(Selector$1.INPUT);
  3627. if (input) {
  3628. if (input.type === 'radio') {
  3629. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3630. triggerChangeEvent = false;
  3631. } else {
  3632. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3633. if (activeElement) {
  3634. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3635. }
  3636. }
  3637. } else if (input.type === 'checkbox') {
  3638. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3639. triggerChangeEvent = false;
  3640. }
  3641. } else {
  3642. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3643. triggerChangeEvent = false;
  3644. }
  3645. if (triggerChangeEvent) {
  3646. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3647. $(input).trigger('change');
  3648. }
  3649. input.focus();
  3650. addAriaPressed = false;
  3651. }
  3652. }
  3653. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3654. if (addAriaPressed) {
  3655. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3656. }
  3657. if (triggerChangeEvent) {
  3658. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3659. }
  3660. }
  3661. };
  3662. _proto.dispose = function dispose() {
  3663. $.removeData(this._element, DATA_KEY$1);
  3664. this._element = null;
  3665. } // Static
  3666. ;
  3667. Button._jQueryInterface = function _jQueryInterface(config) {
  3668. return this.each(function () {
  3669. var data = $(this).data(DATA_KEY$1);
  3670. if (!data) {
  3671. data = new Button(this);
  3672. $(this).data(DATA_KEY$1, data);
  3673. }
  3674. if (config === 'toggle') {
  3675. data[config]();
  3676. }
  3677. });
  3678. };
  3679. _createClass(Button, null, [{
  3680. key: "VERSION",
  3681. get: function get() {
  3682. return VERSION$1;
  3683. }
  3684. }]);
  3685. return Button;
  3686. }();
  3687. /**
  3688. * ------------------------------------------------------------------------
  3689. * Data Api implementation
  3690. * ------------------------------------------------------------------------
  3691. */
  3692. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3693. var button = event.target;
  3694. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3695. button = $(button).closest(Selector$1.BUTTON)[0];
  3696. }
  3697. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3698. event.preventDefault(); // work around Firefox bug #1540995
  3699. } else {
  3700. var inputBtn = button.querySelector(Selector$1.INPUT);
  3701. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3702. event.preventDefault(); // work around Firefox bug #1540995
  3703. return;
  3704. }
  3705. Button._jQueryInterface.call($(button), 'toggle');
  3706. }
  3707. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3708. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3709. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3710. });
  3711. $(window).on(Event$1.LOAD_DATA_API, function () {
  3712. // ensure correct active class is set to match the controls' actual values/states
  3713. // find all checkboxes/readio buttons inside data-toggle groups
  3714. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3715. for (var i = 0, len = buttons.length; i < len; i++) {
  3716. var button = buttons[i];
  3717. var input = button.querySelector(Selector$1.INPUT);
  3718. if (input.checked || input.hasAttribute('checked')) {
  3719. button.classList.add(ClassName$1.ACTIVE);
  3720. } else {
  3721. button.classList.remove(ClassName$1.ACTIVE);
  3722. }
  3723. } // find all button toggles
  3724. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3725. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3726. var _button = buttons[_i];
  3727. if (_button.getAttribute('aria-pressed') === 'true') {
  3728. _button.classList.add(ClassName$1.ACTIVE);
  3729. } else {
  3730. _button.classList.remove(ClassName$1.ACTIVE);
  3731. }
  3732. }
  3733. });
  3734. /**
  3735. * ------------------------------------------------------------------------
  3736. * jQuery
  3737. * ------------------------------------------------------------------------
  3738. */
  3739. $.fn[NAME$1] = Button._jQueryInterface;
  3740. $.fn[NAME$1].Constructor = Button;
  3741. $.fn[NAME$1].noConflict = function () {
  3742. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3743. return Button._jQueryInterface;
  3744. };
  3745. /**
  3746. * ------------------------------------------------------------------------
  3747. * Constants
  3748. * ------------------------------------------------------------------------
  3749. */
  3750. var NAME$2 = 'carousel';
  3751. var VERSION$2 = '4.4.1';
  3752. var DATA_KEY$2 = 'bs.carousel';
  3753. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3754. var DATA_API_KEY$2 = '.data-api';
  3755. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3756. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3757. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3758. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3759. var SWIPE_THRESHOLD = 40;
  3760. var Default = {
  3761. interval: 5000,
  3762. keyboard: true,
  3763. slide: false,
  3764. pause: 'hover',
  3765. wrap: true,
  3766. touch: true
  3767. };
  3768. var DefaultType = {
  3769. interval: '(number|boolean)',
  3770. keyboard: 'boolean',
  3771. slide: '(boolean|string)',
  3772. pause: '(string|boolean)',
  3773. wrap: 'boolean',
  3774. touch: 'boolean'
  3775. };
  3776. var Direction = {
  3777. NEXT: 'next',
  3778. PREV: 'prev',
  3779. LEFT: 'left',
  3780. RIGHT: 'right'
  3781. };
  3782. var Event$2 = {
  3783. SLIDE: "slide" + EVENT_KEY$2,
  3784. SLID: "slid" + EVENT_KEY$2,
  3785. KEYDOWN: "keydown" + EVENT_KEY$2,
  3786. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3787. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3788. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3789. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3790. TOUCHEND: "touchend" + EVENT_KEY$2,
  3791. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3792. POINTERUP: "pointerup" + EVENT_KEY$2,
  3793. DRAG_START: "dragstart" + EVENT_KEY$2,
  3794. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3795. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3796. };
  3797. var ClassName$2 = {
  3798. CAROUSEL: 'carousel',
  3799. ACTIVE: 'active',
  3800. SLIDE: 'slide',
  3801. RIGHT: 'carousel-item-right',
  3802. LEFT: 'carousel-item-left',
  3803. NEXT: 'carousel-item-next',
  3804. PREV: 'carousel-item-prev',
  3805. ITEM: 'carousel-item',
  3806. POINTER_EVENT: 'pointer-event'
  3807. };
  3808. var Selector$2 = {
  3809. ACTIVE: '.active',
  3810. ACTIVE_ITEM: '.active.carousel-item',
  3811. ITEM: '.carousel-item',
  3812. ITEM_IMG: '.carousel-item img',
  3813. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3814. INDICATORS: '.carousel-indicators',
  3815. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3816. DATA_RIDE: '[data-ride="carousel"]'
  3817. };
  3818. var PointerType = {
  3819. TOUCH: 'touch',
  3820. PEN: 'pen'
  3821. };
  3822. /**
  3823. * ------------------------------------------------------------------------
  3824. * Class Definition
  3825. * ------------------------------------------------------------------------
  3826. */
  3827. var Carousel =
  3828. /*#__PURE__*/
  3829. function () {
  3830. function Carousel(element, config) {
  3831. this._items = null;
  3832. this._interval = null;
  3833. this._activeElement = null;
  3834. this._isPaused = false;
  3835. this._isSliding = false;
  3836. this.touchTimeout = null;
  3837. this.touchStartX = 0;
  3838. this.touchDeltaX = 0;
  3839. this._config = this._getConfig(config);
  3840. this._element = element;
  3841. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3842. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3843. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3844. this._addEventListeners();
  3845. } // Getters
  3846. var _proto = Carousel.prototype;
  3847. // Public
  3848. _proto.next = function next() {
  3849. if (!this._isSliding) {
  3850. this._slide(Direction.NEXT);
  3851. }
  3852. };
  3853. _proto.nextWhenVisible = function nextWhenVisible() {
  3854. // Don't call next when the page isn't visible
  3855. // or the carousel or its parent isn't visible
  3856. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3857. this.next();
  3858. }
  3859. };
  3860. _proto.prev = function prev() {
  3861. if (!this._isSliding) {
  3862. this._slide(Direction.PREV);
  3863. }
  3864. };
  3865. _proto.pause = function pause(event) {
  3866. if (!event) {
  3867. this._isPaused = true;
  3868. }
  3869. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3870. Util.triggerTransitionEnd(this._element);
  3871. this.cycle(true);
  3872. }
  3873. clearInterval(this._interval);
  3874. this._interval = null;
  3875. };
  3876. _proto.cycle = function cycle(event) {
  3877. if (!event) {
  3878. this._isPaused = false;
  3879. }
  3880. if (this._interval) {
  3881. clearInterval(this._interval);
  3882. this._interval = null;
  3883. }
  3884. if (this._config.interval && !this._isPaused) {
  3885. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3886. }
  3887. };
  3888. _proto.to = function to(index) {
  3889. var _this = this;
  3890. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3891. var activeIndex = this._getItemIndex(this._activeElement);
  3892. if (index > this._items.length - 1 || index < 0) {
  3893. return;
  3894. }
  3895. if (this._isSliding) {
  3896. $(this._element).one(Event$2.SLID, function () {
  3897. return _this.to(index);
  3898. });
  3899. return;
  3900. }
  3901. if (activeIndex === index) {
  3902. this.pause();
  3903. this.cycle();
  3904. return;
  3905. }
  3906. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3907. this._slide(direction, this._items[index]);
  3908. };
  3909. _proto.dispose = function dispose() {
  3910. $(this._element).off(EVENT_KEY$2);
  3911. $.removeData(this._element, DATA_KEY$2);
  3912. this._items = null;
  3913. this._config = null;
  3914. this._element = null;
  3915. this._interval = null;
  3916. this._isPaused = null;
  3917. this._isSliding = null;
  3918. this._activeElement = null;
  3919. this._indicatorsElement = null;
  3920. } // Private
  3921. ;
  3922. _proto._getConfig = function _getConfig(config) {
  3923. config = _objectSpread2({}, Default, {}, config);
  3924. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3925. return config;
  3926. };
  3927. _proto._handleSwipe = function _handleSwipe() {
  3928. var absDeltax = Math.abs(this.touchDeltaX);
  3929. if (absDeltax <= SWIPE_THRESHOLD) {
  3930. return;
  3931. }
  3932. var direction = absDeltax / this.touchDeltaX;
  3933. this.touchDeltaX = 0; // swipe left
  3934. if (direction > 0) {
  3935. this.prev();
  3936. } // swipe right
  3937. if (direction < 0) {
  3938. this.next();
  3939. }
  3940. };
  3941. _proto._addEventListeners = function _addEventListeners() {
  3942. var _this2 = this;
  3943. if (this._config.keyboard) {
  3944. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3945. return _this2._keydown(event);
  3946. });
  3947. }
  3948. if (this._config.pause === 'hover') {
  3949. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3950. return _this2.pause(event);
  3951. }).on(Event$2.MOUSELEAVE, function (event) {
  3952. return _this2.cycle(event);
  3953. });
  3954. }
  3955. if (this._config.touch) {
  3956. this._addTouchEventListeners();
  3957. }
  3958. };
  3959. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3960. var _this3 = this;
  3961. if (!this._touchSupported) {
  3962. return;
  3963. }
  3964. var start = function start(event) {
  3965. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3966. _this3.touchStartX = event.originalEvent.clientX;
  3967. } else if (!_this3._pointerEvent) {
  3968. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3969. }
  3970. };
  3971. var move = function move(event) {
  3972. // ensure swiping with one touch and not pinching
  3973. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3974. _this3.touchDeltaX = 0;
  3975. } else {
  3976. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3977. }
  3978. };
  3979. var end = function end(event) {
  3980. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3981. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3982. }
  3983. _this3._handleSwipe();
  3984. if (_this3._config.pause === 'hover') {
  3985. // If it's a touch-enabled device, mouseenter/leave are fired as
  3986. // part of the mouse compatibility events on first tap - the carousel
  3987. // would stop cycling until user tapped out of it;
  3988. // here, we listen for touchend, explicitly pause the carousel
  3989. // (as if it's the second time we tap on it, mouseenter compat event
  3990. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3991. // events to fire) we explicitly restart cycling
  3992. _this3.pause();
  3993. if (_this3.touchTimeout) {
  3994. clearTimeout(_this3.touchTimeout);
  3995. }
  3996. _this3.touchTimeout = setTimeout(function (event) {
  3997. return _this3.cycle(event);
  3998. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3999. }
  4000. };
  4001. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  4002. return e.preventDefault();
  4003. });
  4004. if (this._pointerEvent) {
  4005. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  4006. return start(event);
  4007. });
  4008. $(this._element).on(Event$2.POINTERUP, function (event) {
  4009. return end(event);
  4010. });
  4011. this._element.classList.add(ClassName$2.POINTER_EVENT);
  4012. } else {
  4013. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4014. return start(event);
  4015. });
  4016. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4017. return move(event);
  4018. });
  4019. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4020. return end(event);
  4021. });
  4022. }
  4023. };
  4024. _proto._keydown = function _keydown(event) {
  4025. if (/input|textarea/i.test(event.target.tagName)) {
  4026. return;
  4027. }
  4028. switch (event.which) {
  4029. case ARROW_LEFT_KEYCODE:
  4030. event.preventDefault();
  4031. this.prev();
  4032. break;
  4033. case ARROW_RIGHT_KEYCODE:
  4034. event.preventDefault();
  4035. this.next();
  4036. break;
  4037. }
  4038. };
  4039. _proto._getItemIndex = function _getItemIndex(element) {
  4040. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4041. return this._items.indexOf(element);
  4042. };
  4043. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4044. var isNextDirection = direction === Direction.NEXT;
  4045. var isPrevDirection = direction === Direction.PREV;
  4046. var activeIndex = this._getItemIndex(activeElement);
  4047. var lastItemIndex = this._items.length - 1;
  4048. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4049. if (isGoingToWrap && !this._config.wrap) {
  4050. return activeElement;
  4051. }
  4052. var delta = direction === Direction.PREV ? -1 : 1;
  4053. var itemIndex = (activeIndex + delta) % this._items.length;
  4054. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4055. };
  4056. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4057. var targetIndex = this._getItemIndex(relatedTarget);
  4058. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4059. var slideEvent = $.Event(Event$2.SLIDE, {
  4060. relatedTarget: relatedTarget,
  4061. direction: eventDirectionName,
  4062. from: fromIndex,
  4063. to: targetIndex
  4064. });
  4065. $(this._element).trigger(slideEvent);
  4066. return slideEvent;
  4067. };
  4068. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4069. if (this._indicatorsElement) {
  4070. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4071. $(indicators).removeClass(ClassName$2.ACTIVE);
  4072. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4073. if (nextIndicator) {
  4074. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4075. }
  4076. }
  4077. };
  4078. _proto._slide = function _slide(direction, element) {
  4079. var _this4 = this;
  4080. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4081. var activeElementIndex = this._getItemIndex(activeElement);
  4082. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4083. var nextElementIndex = this._getItemIndex(nextElement);
  4084. var isCycling = Boolean(this._interval);
  4085. var directionalClassName;
  4086. var orderClassName;
  4087. var eventDirectionName;
  4088. if (direction === Direction.NEXT) {
  4089. directionalClassName = ClassName$2.LEFT;
  4090. orderClassName = ClassName$2.NEXT;
  4091. eventDirectionName = Direction.LEFT;
  4092. } else {
  4093. directionalClassName = ClassName$2.RIGHT;
  4094. orderClassName = ClassName$2.PREV;
  4095. eventDirectionName = Direction.RIGHT;
  4096. }
  4097. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4098. this._isSliding = false;
  4099. return;
  4100. }
  4101. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4102. if (slideEvent.isDefaultPrevented()) {
  4103. return;
  4104. }
  4105. if (!activeElement || !nextElement) {
  4106. // Some weirdness is happening, so we bail
  4107. return;
  4108. }
  4109. this._isSliding = true;
  4110. if (isCycling) {
  4111. this.pause();
  4112. }
  4113. this._setActiveIndicatorElement(nextElement);
  4114. var slidEvent = $.Event(Event$2.SLID, {
  4115. relatedTarget: nextElement,
  4116. direction: eventDirectionName,
  4117. from: activeElementIndex,
  4118. to: nextElementIndex
  4119. });
  4120. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4121. $(nextElement).addClass(orderClassName);
  4122. Util.reflow(nextElement);
  4123. $(activeElement).addClass(directionalClassName);
  4124. $(nextElement).addClass(directionalClassName);
  4125. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4126. if (nextElementInterval) {
  4127. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4128. this._config.interval = nextElementInterval;
  4129. } else {
  4130. this._config.interval = this._config.defaultInterval || this._config.interval;
  4131. }
  4132. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4133. $(activeElement).one(Util.TRANSITION_END, function () {
  4134. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4135. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4136. _this4._isSliding = false;
  4137. setTimeout(function () {
  4138. return $(_this4._element).trigger(slidEvent);
  4139. }, 0);
  4140. }).emulateTransitionEnd(transitionDuration);
  4141. } else {
  4142. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4143. $(nextElement).addClass(ClassName$2.ACTIVE);
  4144. this._isSliding = false;
  4145. $(this._element).trigger(slidEvent);
  4146. }
  4147. if (isCycling) {
  4148. this.cycle();
  4149. }
  4150. } // Static
  4151. ;
  4152. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4153. return this.each(function () {
  4154. var data = $(this).data(DATA_KEY$2);
  4155. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4156. if (typeof config === 'object') {
  4157. _config = _objectSpread2({}, _config, {}, config);
  4158. }
  4159. var action = typeof config === 'string' ? config : _config.slide;
  4160. if (!data) {
  4161. data = new Carousel(this, _config);
  4162. $(this).data(DATA_KEY$2, data);
  4163. }
  4164. if (typeof config === 'number') {
  4165. data.to(config);
  4166. } else if (typeof action === 'string') {
  4167. if (typeof data[action] === 'undefined') {
  4168. throw new TypeError("No method named \"" + action + "\"");
  4169. }
  4170. data[action]();
  4171. } else if (_config.interval && _config.ride) {
  4172. data.pause();
  4173. data.cycle();
  4174. }
  4175. });
  4176. };
  4177. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4178. var selector = Util.getSelectorFromElement(this);
  4179. if (!selector) {
  4180. return;
  4181. }
  4182. var target = $(selector)[0];
  4183. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4184. return;
  4185. }
  4186. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4187. var slideIndex = this.getAttribute('data-slide-to');
  4188. if (slideIndex) {
  4189. config.interval = false;
  4190. }
  4191. Carousel._jQueryInterface.call($(target), config);
  4192. if (slideIndex) {
  4193. $(target).data(DATA_KEY$2).to(slideIndex);
  4194. }
  4195. event.preventDefault();
  4196. };
  4197. _createClass(Carousel, null, [{
  4198. key: "VERSION",
  4199. get: function get() {
  4200. return VERSION$2;
  4201. }
  4202. }, {
  4203. key: "Default",
  4204. get: function get() {
  4205. return Default;
  4206. }
  4207. }]);
  4208. return Carousel;
  4209. }();
  4210. /**
  4211. * ------------------------------------------------------------------------
  4212. * Data Api implementation
  4213. * ------------------------------------------------------------------------
  4214. */
  4215. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4216. $(window).on(Event$2.LOAD_DATA_API, function () {
  4217. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4218. for (var i = 0, len = carousels.length; i < len; i++) {
  4219. var $carousel = $(carousels[i]);
  4220. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4221. }
  4222. });
  4223. /**
  4224. * ------------------------------------------------------------------------
  4225. * jQuery
  4226. * ------------------------------------------------------------------------
  4227. */
  4228. $.fn[NAME$2] = Carousel._jQueryInterface;
  4229. $.fn[NAME$2].Constructor = Carousel;
  4230. $.fn[NAME$2].noConflict = function () {
  4231. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4232. return Carousel._jQueryInterface;
  4233. };
  4234. /**
  4235. * ------------------------------------------------------------------------
  4236. * Constants
  4237. * ------------------------------------------------------------------------
  4238. */
  4239. var NAME$3 = 'collapse';
  4240. var VERSION$3 = '4.4.1';
  4241. var DATA_KEY$3 = 'bs.collapse';
  4242. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4243. var DATA_API_KEY$3 = '.data-api';
  4244. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4245. var Default$1 = {
  4246. toggle: true,
  4247. parent: ''
  4248. };
  4249. var DefaultType$1 = {
  4250. toggle: 'boolean',
  4251. parent: '(string|element)'
  4252. };
  4253. var Event$3 = {
  4254. SHOW: "show" + EVENT_KEY$3,
  4255. SHOWN: "shown" + EVENT_KEY$3,
  4256. HIDE: "hide" + EVENT_KEY$3,
  4257. HIDDEN: "hidden" + EVENT_KEY$3,
  4258. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4259. };
  4260. var ClassName$3 = {
  4261. SHOW: 'show',
  4262. COLLAPSE: 'collapse',
  4263. COLLAPSING: 'collapsing',
  4264. COLLAPSED: 'collapsed'
  4265. };
  4266. var Dimension = {
  4267. WIDTH: 'width',
  4268. HEIGHT: 'height'
  4269. };
  4270. var Selector$3 = {
  4271. ACTIVES: '.show, .collapsing',
  4272. DATA_TOGGLE: '[data-toggle="collapse"]'
  4273. };
  4274. /**
  4275. * ------------------------------------------------------------------------
  4276. * Class Definition
  4277. * ------------------------------------------------------------------------
  4278. */
  4279. var Collapse =
  4280. /*#__PURE__*/
  4281. function () {
  4282. function Collapse(element, config) {
  4283. this._isTransitioning = false;
  4284. this._element = element;
  4285. this._config = this._getConfig(config);
  4286. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4287. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4288. for (var i = 0, len = toggleList.length; i < len; i++) {
  4289. var elem = toggleList[i];
  4290. var selector = Util.getSelectorFromElement(elem);
  4291. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4292. return foundElem === element;
  4293. });
  4294. if (selector !== null && filterElement.length > 0) {
  4295. this._selector = selector;
  4296. this._triggerArray.push(elem);
  4297. }
  4298. }
  4299. this._parent = this._config.parent ? this._getParent() : null;
  4300. if (!this._config.parent) {
  4301. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4302. }
  4303. if (this._config.toggle) {
  4304. this.toggle();
  4305. }
  4306. } // Getters
  4307. var _proto = Collapse.prototype;
  4308. // Public
  4309. _proto.toggle = function toggle() {
  4310. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4311. this.hide();
  4312. } else {
  4313. this.show();
  4314. }
  4315. };
  4316. _proto.show = function show() {
  4317. var _this = this;
  4318. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4319. return;
  4320. }
  4321. var actives;
  4322. var activesData;
  4323. if (this._parent) {
  4324. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4325. if (typeof _this._config.parent === 'string') {
  4326. return elem.getAttribute('data-parent') === _this._config.parent;
  4327. }
  4328. return elem.classList.contains(ClassName$3.COLLAPSE);
  4329. });
  4330. if (actives.length === 0) {
  4331. actives = null;
  4332. }
  4333. }
  4334. if (actives) {
  4335. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4336. if (activesData && activesData._isTransitioning) {
  4337. return;
  4338. }
  4339. }
  4340. var startEvent = $.Event(Event$3.SHOW);
  4341. $(this._element).trigger(startEvent);
  4342. if (startEvent.isDefaultPrevented()) {
  4343. return;
  4344. }
  4345. if (actives) {
  4346. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4347. if (!activesData) {
  4348. $(actives).data(DATA_KEY$3, null);
  4349. }
  4350. }
  4351. var dimension = this._getDimension();
  4352. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4353. this._element.style[dimension] = 0;
  4354. if (this._triggerArray.length) {
  4355. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4356. }
  4357. this.setTransitioning(true);
  4358. var complete = function complete() {
  4359. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4360. _this._element.style[dimension] = '';
  4361. _this.setTransitioning(false);
  4362. $(_this._element).trigger(Event$3.SHOWN);
  4363. };
  4364. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4365. var scrollSize = "scroll" + capitalizedDimension;
  4366. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4367. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4368. this._element.style[dimension] = this._element[scrollSize] + "px";
  4369. };
  4370. _proto.hide = function hide() {
  4371. var _this2 = this;
  4372. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4373. return;
  4374. }
  4375. var startEvent = $.Event(Event$3.HIDE);
  4376. $(this._element).trigger(startEvent);
  4377. if (startEvent.isDefaultPrevented()) {
  4378. return;
  4379. }
  4380. var dimension = this._getDimension();
  4381. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4382. Util.reflow(this._element);
  4383. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4384. var triggerArrayLength = this._triggerArray.length;
  4385. if (triggerArrayLength > 0) {
  4386. for (var i = 0; i < triggerArrayLength; i++) {
  4387. var trigger = this._triggerArray[i];
  4388. var selector = Util.getSelectorFromElement(trigger);
  4389. if (selector !== null) {
  4390. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4391. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4392. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4393. }
  4394. }
  4395. }
  4396. }
  4397. this.setTransitioning(true);
  4398. var complete = function complete() {
  4399. _this2.setTransitioning(false);
  4400. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4401. };
  4402. this._element.style[dimension] = '';
  4403. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4404. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4405. };
  4406. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4407. this._isTransitioning = isTransitioning;
  4408. };
  4409. _proto.dispose = function dispose() {
  4410. $.removeData(this._element, DATA_KEY$3);
  4411. this._config = null;
  4412. this._parent = null;
  4413. this._element = null;
  4414. this._triggerArray = null;
  4415. this._isTransitioning = null;
  4416. } // Private
  4417. ;
  4418. _proto._getConfig = function _getConfig(config) {
  4419. config = _objectSpread2({}, Default$1, {}, config);
  4420. config.toggle = Boolean(config.toggle); // Coerce string values
  4421. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4422. return config;
  4423. };
  4424. _proto._getDimension = function _getDimension() {
  4425. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4426. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4427. };
  4428. _proto._getParent = function _getParent() {
  4429. var _this3 = this;
  4430. var parent;
  4431. if (Util.isElement(this._config.parent)) {
  4432. parent = this._config.parent; // It's a jQuery object
  4433. if (typeof this._config.parent.jquery !== 'undefined') {
  4434. parent = this._config.parent[0];
  4435. }
  4436. } else {
  4437. parent = document.querySelector(this._config.parent);
  4438. }
  4439. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4440. var children = [].slice.call(parent.querySelectorAll(selector));
  4441. $(children).each(function (i, element) {
  4442. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4443. });
  4444. return parent;
  4445. };
  4446. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4447. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4448. if (triggerArray.length) {
  4449. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4450. }
  4451. } // Static
  4452. ;
  4453. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4454. var selector = Util.getSelectorFromElement(element);
  4455. return selector ? document.querySelector(selector) : null;
  4456. };
  4457. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4458. return this.each(function () {
  4459. var $this = $(this);
  4460. var data = $this.data(DATA_KEY$3);
  4461. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4462. if (!data && _config.toggle && /show|hide/.test(config)) {
  4463. _config.toggle = false;
  4464. }
  4465. if (!data) {
  4466. data = new Collapse(this, _config);
  4467. $this.data(DATA_KEY$3, data);
  4468. }
  4469. if (typeof config === 'string') {
  4470. if (typeof data[config] === 'undefined') {
  4471. throw new TypeError("No method named \"" + config + "\"");
  4472. }
  4473. data[config]();
  4474. }
  4475. });
  4476. };
  4477. _createClass(Collapse, null, [{
  4478. key: "VERSION",
  4479. get: function get() {
  4480. return VERSION$3;
  4481. }
  4482. }, {
  4483. key: "Default",
  4484. get: function get() {
  4485. return Default$1;
  4486. }
  4487. }]);
  4488. return Collapse;
  4489. }();
  4490. /**
  4491. * ------------------------------------------------------------------------
  4492. * Data Api implementation
  4493. * ------------------------------------------------------------------------
  4494. */
  4495. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4496. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4497. if (event.currentTarget.tagName === 'A') {
  4498. event.preventDefault();
  4499. }
  4500. var $trigger = $(this);
  4501. var selector = Util.getSelectorFromElement(this);
  4502. var selectors = [].slice.call(document.querySelectorAll(selector));
  4503. $(selectors).each(function () {
  4504. var $target = $(this);
  4505. var data = $target.data(DATA_KEY$3);
  4506. var config = data ? 'toggle' : $trigger.data();
  4507. Collapse._jQueryInterface.call($target, config);
  4508. });
  4509. });
  4510. /**
  4511. * ------------------------------------------------------------------------
  4512. * jQuery
  4513. * ------------------------------------------------------------------------
  4514. */
  4515. $.fn[NAME$3] = Collapse._jQueryInterface;
  4516. $.fn[NAME$3].Constructor = Collapse;
  4517. $.fn[NAME$3].noConflict = function () {
  4518. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4519. return Collapse._jQueryInterface;
  4520. };
  4521. /**
  4522. * ------------------------------------------------------------------------
  4523. * Constants
  4524. * ------------------------------------------------------------------------
  4525. */
  4526. var NAME$4 = 'dropdown';
  4527. var VERSION$4 = '4.4.1';
  4528. var DATA_KEY$4 = 'bs.dropdown';
  4529. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4530. var DATA_API_KEY$4 = '.data-api';
  4531. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4532. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4533. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4534. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4535. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4536. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4537. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4538. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4539. var Event$4 = {
  4540. HIDE: "hide" + EVENT_KEY$4,
  4541. HIDDEN: "hidden" + EVENT_KEY$4,
  4542. SHOW: "show" + EVENT_KEY$4,
  4543. SHOWN: "shown" + EVENT_KEY$4,
  4544. CLICK: "click" + EVENT_KEY$4,
  4545. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4546. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4547. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4548. };
  4549. var ClassName$4 = {
  4550. DISABLED: 'disabled',
  4551. SHOW: 'show',
  4552. DROPUP: 'dropup',
  4553. DROPRIGHT: 'dropright',
  4554. DROPLEFT: 'dropleft',
  4555. MENURIGHT: 'dropdown-menu-right',
  4556. MENULEFT: 'dropdown-menu-left',
  4557. POSITION_STATIC: 'position-static'
  4558. };
  4559. var Selector$4 = {
  4560. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4561. FORM_CHILD: '.dropdown form',
  4562. MENU: '.dropdown-menu',
  4563. NAVBAR_NAV: '.navbar-nav',
  4564. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4565. };
  4566. var AttachmentMap = {
  4567. TOP: 'top-start',
  4568. TOPEND: 'top-end',
  4569. BOTTOM: 'bottom-start',
  4570. BOTTOMEND: 'bottom-end',
  4571. RIGHT: 'right-start',
  4572. RIGHTEND: 'right-end',
  4573. LEFT: 'left-start',
  4574. LEFTEND: 'left-end'
  4575. };
  4576. var Default$2 = {
  4577. offset: 0,
  4578. flip: true,
  4579. boundary: 'scrollParent',
  4580. reference: 'toggle',
  4581. display: 'dynamic',
  4582. popperConfig: null
  4583. };
  4584. var DefaultType$2 = {
  4585. offset: '(number|string|function)',
  4586. flip: 'boolean',
  4587. boundary: '(string|element)',
  4588. reference: '(string|element)',
  4589. display: 'string',
  4590. popperConfig: '(null|object)'
  4591. };
  4592. /**
  4593. * ------------------------------------------------------------------------
  4594. * Class Definition
  4595. * ------------------------------------------------------------------------
  4596. */
  4597. var Dropdown =
  4598. /*#__PURE__*/
  4599. function () {
  4600. function Dropdown(element, config) {
  4601. this._element = element;
  4602. this._popper = null;
  4603. this._config = this._getConfig(config);
  4604. this._menu = this._getMenuElement();
  4605. this._inNavbar = this._detectNavbar();
  4606. this._addEventListeners();
  4607. } // Getters
  4608. var _proto = Dropdown.prototype;
  4609. // Public
  4610. _proto.toggle = function toggle() {
  4611. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4612. return;
  4613. }
  4614. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4615. Dropdown._clearMenus();
  4616. if (isActive) {
  4617. return;
  4618. }
  4619. this.show(true);
  4620. };
  4621. _proto.show = function show(usePopper) {
  4622. if (usePopper === void 0) {
  4623. usePopper = false;
  4624. }
  4625. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4626. return;
  4627. }
  4628. var relatedTarget = {
  4629. relatedTarget: this._element
  4630. };
  4631. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4632. var parent = Dropdown._getParentFromElement(this._element);
  4633. $(parent).trigger(showEvent);
  4634. if (showEvent.isDefaultPrevented()) {
  4635. return;
  4636. } // Disable totally Popper.js for Dropdown in Navbar
  4637. if (!this._inNavbar && usePopper) {
  4638. /**
  4639. * Check for Popper dependency
  4640. * Popper - https://popper.js.org
  4641. */
  4642. if (typeof Popper === 'undefined') {
  4643. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4644. }
  4645. var referenceElement = this._element;
  4646. if (this._config.reference === 'parent') {
  4647. referenceElement = parent;
  4648. } else if (Util.isElement(this._config.reference)) {
  4649. referenceElement = this._config.reference; // Check if it's jQuery element
  4650. if (typeof this._config.reference.jquery !== 'undefined') {
  4651. referenceElement = this._config.reference[0];
  4652. }
  4653. } // If boundary is not `scrollParent`, then set position to `static`
  4654. // to allow the menu to "escape" the scroll parent's boundaries
  4655. // https://github.com/twbs/bootstrap/issues/24251
  4656. if (this._config.boundary !== 'scrollParent') {
  4657. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4658. }
  4659. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4660. } // If this is a touch-enabled device we add extra
  4661. // empty mouseover listeners to the body's immediate children;
  4662. // only needed because of broken event delegation on iOS
  4663. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4664. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4665. $(document.body).children().on('mouseover', null, $.noop);
  4666. }
  4667. this._element.focus();
  4668. this._element.setAttribute('aria-expanded', true);
  4669. $(this._menu).toggleClass(ClassName$4.SHOW);
  4670. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4671. };
  4672. _proto.hide = function hide() {
  4673. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4674. return;
  4675. }
  4676. var relatedTarget = {
  4677. relatedTarget: this._element
  4678. };
  4679. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4680. var parent = Dropdown._getParentFromElement(this._element);
  4681. $(parent).trigger(hideEvent);
  4682. if (hideEvent.isDefaultPrevented()) {
  4683. return;
  4684. }
  4685. if (this._popper) {
  4686. this._popper.destroy();
  4687. }
  4688. $(this._menu).toggleClass(ClassName$4.SHOW);
  4689. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4690. };
  4691. _proto.dispose = function dispose() {
  4692. $.removeData(this._element, DATA_KEY$4);
  4693. $(this._element).off(EVENT_KEY$4);
  4694. this._element = null;
  4695. this._menu = null;
  4696. if (this._popper !== null) {
  4697. this._popper.destroy();
  4698. this._popper = null;
  4699. }
  4700. };
  4701. _proto.update = function update() {
  4702. this._inNavbar = this._detectNavbar();
  4703. if (this._popper !== null) {
  4704. this._popper.scheduleUpdate();
  4705. }
  4706. } // Private
  4707. ;
  4708. _proto._addEventListeners = function _addEventListeners() {
  4709. var _this = this;
  4710. $(this._element).on(Event$4.CLICK, function (event) {
  4711. event.preventDefault();
  4712. event.stopPropagation();
  4713. _this.toggle();
  4714. });
  4715. };
  4716. _proto._getConfig = function _getConfig(config) {
  4717. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4718. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4719. return config;
  4720. };
  4721. _proto._getMenuElement = function _getMenuElement() {
  4722. if (!this._menu) {
  4723. var parent = Dropdown._getParentFromElement(this._element);
  4724. if (parent) {
  4725. this._menu = parent.querySelector(Selector$4.MENU);
  4726. }
  4727. }
  4728. return this._menu;
  4729. };
  4730. _proto._getPlacement = function _getPlacement() {
  4731. var $parentDropdown = $(this._element.parentNode);
  4732. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4733. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4734. placement = AttachmentMap.TOP;
  4735. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4736. placement = AttachmentMap.TOPEND;
  4737. }
  4738. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4739. placement = AttachmentMap.RIGHT;
  4740. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4741. placement = AttachmentMap.LEFT;
  4742. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4743. placement = AttachmentMap.BOTTOMEND;
  4744. }
  4745. return placement;
  4746. };
  4747. _proto._detectNavbar = function _detectNavbar() {
  4748. return $(this._element).closest('.navbar').length > 0;
  4749. };
  4750. _proto._getOffset = function _getOffset() {
  4751. var _this2 = this;
  4752. var offset = {};
  4753. if (typeof this._config.offset === 'function') {
  4754. offset.fn = function (data) {
  4755. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4756. return data;
  4757. };
  4758. } else {
  4759. offset.offset = this._config.offset;
  4760. }
  4761. return offset;
  4762. };
  4763. _proto._getPopperConfig = function _getPopperConfig() {
  4764. var popperConfig = {
  4765. placement: this._getPlacement(),
  4766. modifiers: {
  4767. offset: this._getOffset(),
  4768. flip: {
  4769. enabled: this._config.flip
  4770. },
  4771. preventOverflow: {
  4772. boundariesElement: this._config.boundary
  4773. }
  4774. }
  4775. }; // Disable Popper.js if we have a static display
  4776. if (this._config.display === 'static') {
  4777. popperConfig.modifiers.applyStyle = {
  4778. enabled: false
  4779. };
  4780. }
  4781. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4782. } // Static
  4783. ;
  4784. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4785. return this.each(function () {
  4786. var data = $(this).data(DATA_KEY$4);
  4787. var _config = typeof config === 'object' ? config : null;
  4788. if (!data) {
  4789. data = new Dropdown(this, _config);
  4790. $(this).data(DATA_KEY$4, data);
  4791. }
  4792. if (typeof config === 'string') {
  4793. if (typeof data[config] === 'undefined') {
  4794. throw new TypeError("No method named \"" + config + "\"");
  4795. }
  4796. data[config]();
  4797. }
  4798. });
  4799. };
  4800. Dropdown._clearMenus = function _clearMenus(event) {
  4801. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4802. return;
  4803. }
  4804. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4805. for (var i = 0, len = toggles.length; i < len; i++) {
  4806. var parent = Dropdown._getParentFromElement(toggles[i]);
  4807. var context = $(toggles[i]).data(DATA_KEY$4);
  4808. var relatedTarget = {
  4809. relatedTarget: toggles[i]
  4810. };
  4811. if (event && event.type === 'click') {
  4812. relatedTarget.clickEvent = event;
  4813. }
  4814. if (!context) {
  4815. continue;
  4816. }
  4817. var dropdownMenu = context._menu;
  4818. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4819. continue;
  4820. }
  4821. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4822. continue;
  4823. }
  4824. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4825. $(parent).trigger(hideEvent);
  4826. if (hideEvent.isDefaultPrevented()) {
  4827. continue;
  4828. } // If this is a touch-enabled device we remove the extra
  4829. // empty mouseover listeners we added for iOS support
  4830. if ('ontouchstart' in document.documentElement) {
  4831. $(document.body).children().off('mouseover', null, $.noop);
  4832. }
  4833. toggles[i].setAttribute('aria-expanded', 'false');
  4834. if (context._popper) {
  4835. context._popper.destroy();
  4836. }
  4837. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4838. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4839. }
  4840. };
  4841. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4842. var parent;
  4843. var selector = Util.getSelectorFromElement(element);
  4844. if (selector) {
  4845. parent = document.querySelector(selector);
  4846. }
  4847. return parent || element.parentNode;
  4848. } // eslint-disable-next-line complexity
  4849. ;
  4850. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4851. // If not input/textarea:
  4852. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4853. // If input/textarea:
  4854. // - If space key => not a dropdown command
  4855. // - If key is other than escape
  4856. // - If key is not up or down => not a dropdown command
  4857. // - If trigger inside the menu => not a dropdown command
  4858. 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)) {
  4859. return;
  4860. }
  4861. event.preventDefault();
  4862. event.stopPropagation();
  4863. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4864. return;
  4865. }
  4866. var parent = Dropdown._getParentFromElement(this);
  4867. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4868. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4869. return;
  4870. }
  4871. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4872. if (event.which === ESCAPE_KEYCODE) {
  4873. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4874. $(toggle).trigger('focus');
  4875. }
  4876. $(this).trigger('click');
  4877. return;
  4878. }
  4879. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4880. return $(item).is(':visible');
  4881. });
  4882. if (items.length === 0) {
  4883. return;
  4884. }
  4885. var index = items.indexOf(event.target);
  4886. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4887. // Up
  4888. index--;
  4889. }
  4890. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4891. // Down
  4892. index++;
  4893. }
  4894. if (index < 0) {
  4895. index = 0;
  4896. }
  4897. items[index].focus();
  4898. };
  4899. _createClass(Dropdown, null, [{
  4900. key: "VERSION",
  4901. get: function get() {
  4902. return VERSION$4;
  4903. }
  4904. }, {
  4905. key: "Default",
  4906. get: function get() {
  4907. return Default$2;
  4908. }
  4909. }, {
  4910. key: "DefaultType",
  4911. get: function get() {
  4912. return DefaultType$2;
  4913. }
  4914. }]);
  4915. return Dropdown;
  4916. }();
  4917. /**
  4918. * ------------------------------------------------------------------------
  4919. * Data Api implementation
  4920. * ------------------------------------------------------------------------
  4921. */
  4922. $(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) {
  4923. event.preventDefault();
  4924. event.stopPropagation();
  4925. Dropdown._jQueryInterface.call($(this), 'toggle');
  4926. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4927. e.stopPropagation();
  4928. });
  4929. /**
  4930. * ------------------------------------------------------------------------
  4931. * jQuery
  4932. * ------------------------------------------------------------------------
  4933. */
  4934. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4935. $.fn[NAME$4].Constructor = Dropdown;
  4936. $.fn[NAME$4].noConflict = function () {
  4937. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4938. return Dropdown._jQueryInterface;
  4939. };
  4940. /**
  4941. * ------------------------------------------------------------------------
  4942. * Constants
  4943. * ------------------------------------------------------------------------
  4944. */
  4945. var NAME$5 = 'modal';
  4946. var VERSION$5 = '4.4.1';
  4947. var DATA_KEY$5 = 'bs.modal';
  4948. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4949. var DATA_API_KEY$5 = '.data-api';
  4950. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4951. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4952. var Default$3 = {
  4953. backdrop: true,
  4954. keyboard: true,
  4955. focus: true,
  4956. show: true
  4957. };
  4958. var DefaultType$3 = {
  4959. backdrop: '(boolean|string)',
  4960. keyboard: 'boolean',
  4961. focus: 'boolean',
  4962. show: 'boolean'
  4963. };
  4964. var Event$5 = {
  4965. HIDE: "hide" + EVENT_KEY$5,
  4966. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4967. HIDDEN: "hidden" + EVENT_KEY$5,
  4968. SHOW: "show" + EVENT_KEY$5,
  4969. SHOWN: "shown" + EVENT_KEY$5,
  4970. FOCUSIN: "focusin" + EVENT_KEY$5,
  4971. RESIZE: "resize" + EVENT_KEY$5,
  4972. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4973. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4974. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4975. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4976. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4977. };
  4978. var ClassName$5 = {
  4979. SCROLLABLE: 'modal-dialog-scrollable',
  4980. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4981. BACKDROP: 'modal-backdrop',
  4982. OPEN: 'modal-open',
  4983. FADE: 'fade',
  4984. SHOW: 'show',
  4985. STATIC: 'modal-static'
  4986. };
  4987. var Selector$5 = {
  4988. DIALOG: '.modal-dialog',
  4989. MODAL_BODY: '.modal-body',
  4990. DATA_TOGGLE: '[data-toggle="modal"]',
  4991. DATA_DISMISS: '[data-dismiss="modal"]',
  4992. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4993. STICKY_CONTENT: '.sticky-top'
  4994. };
  4995. /**
  4996. * ------------------------------------------------------------------------
  4997. * Class Definition
  4998. * ------------------------------------------------------------------------
  4999. */
  5000. var Modal =
  5001. /*#__PURE__*/
  5002. function () {
  5003. function Modal(element, config) {
  5004. this._config = this._getConfig(config);
  5005. this._element = element;
  5006. this._dialog = element.querySelector(Selector$5.DIALOG);
  5007. this._backdrop = null;
  5008. this._isShown = false;
  5009. this._isBodyOverflowing = false;
  5010. this._ignoreBackdropClick = false;
  5011. this._isTransitioning = false;
  5012. this._scrollbarWidth = 0;
  5013. } // Getters
  5014. var _proto = Modal.prototype;
  5015. // Public
  5016. _proto.toggle = function toggle(relatedTarget) {
  5017. return this._isShown ? this.hide() : this.show(relatedTarget);
  5018. };
  5019. _proto.show = function show(relatedTarget) {
  5020. var _this = this;
  5021. if (this._isShown || this._isTransitioning) {
  5022. return;
  5023. }
  5024. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5025. this._isTransitioning = true;
  5026. }
  5027. var showEvent = $.Event(Event$5.SHOW, {
  5028. relatedTarget: relatedTarget
  5029. });
  5030. $(this._element).trigger(showEvent);
  5031. if (this._isShown || showEvent.isDefaultPrevented()) {
  5032. return;
  5033. }
  5034. this._isShown = true;
  5035. this._checkScrollbar();
  5036. this._setScrollbar();
  5037. this._adjustDialog();
  5038. this._setEscapeEvent();
  5039. this._setResizeEvent();
  5040. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5041. return _this.hide(event);
  5042. });
  5043. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5044. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5045. if ($(event.target).is(_this._element)) {
  5046. _this._ignoreBackdropClick = true;
  5047. }
  5048. });
  5049. });
  5050. this._showBackdrop(function () {
  5051. return _this._showElement(relatedTarget);
  5052. });
  5053. };
  5054. _proto.hide = function hide(event) {
  5055. var _this2 = this;
  5056. if (event) {
  5057. event.preventDefault();
  5058. }
  5059. if (!this._isShown || this._isTransitioning) {
  5060. return;
  5061. }
  5062. var hideEvent = $.Event(Event$5.HIDE);
  5063. $(this._element).trigger(hideEvent);
  5064. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5065. return;
  5066. }
  5067. this._isShown = false;
  5068. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5069. if (transition) {
  5070. this._isTransitioning = true;
  5071. }
  5072. this._setEscapeEvent();
  5073. this._setResizeEvent();
  5074. $(document).off(Event$5.FOCUSIN);
  5075. $(this._element).removeClass(ClassName$5.SHOW);
  5076. $(this._element).off(Event$5.CLICK_DISMISS);
  5077. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5078. if (transition) {
  5079. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5080. $(this._element).one(Util.TRANSITION_END, function (event) {
  5081. return _this2._hideModal(event);
  5082. }).emulateTransitionEnd(transitionDuration);
  5083. } else {
  5084. this._hideModal();
  5085. }
  5086. };
  5087. _proto.dispose = function dispose() {
  5088. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5089. return $(htmlElement).off(EVENT_KEY$5);
  5090. });
  5091. /**
  5092. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5093. * Do not move `document` in `htmlElements` array
  5094. * It will remove `Event.CLICK_DATA_API` event that should remain
  5095. */
  5096. $(document).off(Event$5.FOCUSIN);
  5097. $.removeData(this._element, DATA_KEY$5);
  5098. this._config = null;
  5099. this._element = null;
  5100. this._dialog = null;
  5101. this._backdrop = null;
  5102. this._isShown = null;
  5103. this._isBodyOverflowing = null;
  5104. this._ignoreBackdropClick = null;
  5105. this._isTransitioning = null;
  5106. this._scrollbarWidth = null;
  5107. };
  5108. _proto.handleUpdate = function handleUpdate() {
  5109. this._adjustDialog();
  5110. } // Private
  5111. ;
  5112. _proto._getConfig = function _getConfig(config) {
  5113. config = _objectSpread2({}, Default$3, {}, config);
  5114. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5115. return config;
  5116. };
  5117. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5118. var _this3 = this;
  5119. if (this._config.backdrop === 'static') {
  5120. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5121. $(this._element).trigger(hideEventPrevented);
  5122. if (hideEventPrevented.defaultPrevented) {
  5123. return;
  5124. }
  5125. this._element.classList.add(ClassName$5.STATIC);
  5126. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5127. $(this._element).one(Util.TRANSITION_END, function () {
  5128. _this3._element.classList.remove(ClassName$5.STATIC);
  5129. }).emulateTransitionEnd(modalTransitionDuration);
  5130. this._element.focus();
  5131. } else {
  5132. this.hide();
  5133. }
  5134. };
  5135. _proto._showElement = function _showElement(relatedTarget) {
  5136. var _this4 = this;
  5137. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5138. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5139. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5140. // Don't move modal's DOM position
  5141. document.body.appendChild(this._element);
  5142. }
  5143. this._element.style.display = 'block';
  5144. this._element.removeAttribute('aria-hidden');
  5145. this._element.setAttribute('aria-modal', true);
  5146. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5147. modalBody.scrollTop = 0;
  5148. } else {
  5149. this._element.scrollTop = 0;
  5150. }
  5151. if (transition) {
  5152. Util.reflow(this._element);
  5153. }
  5154. $(this._element).addClass(ClassName$5.SHOW);
  5155. if (this._config.focus) {
  5156. this._enforceFocus();
  5157. }
  5158. var shownEvent = $.Event(Event$5.SHOWN, {
  5159. relatedTarget: relatedTarget
  5160. });
  5161. var transitionComplete = function transitionComplete() {
  5162. if (_this4._config.focus) {
  5163. _this4._element.focus();
  5164. }
  5165. _this4._isTransitioning = false;
  5166. $(_this4._element).trigger(shownEvent);
  5167. };
  5168. if (transition) {
  5169. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5170. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5171. } else {
  5172. transitionComplete();
  5173. }
  5174. };
  5175. _proto._enforceFocus = function _enforceFocus() {
  5176. var _this5 = this;
  5177. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5178. .on(Event$5.FOCUSIN, function (event) {
  5179. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5180. _this5._element.focus();
  5181. }
  5182. });
  5183. };
  5184. _proto._setEscapeEvent = function _setEscapeEvent() {
  5185. var _this6 = this;
  5186. if (this._isShown && this._config.keyboard) {
  5187. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5188. if (event.which === ESCAPE_KEYCODE$1) {
  5189. _this6._triggerBackdropTransition();
  5190. }
  5191. });
  5192. } else if (!this._isShown) {
  5193. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5194. }
  5195. };
  5196. _proto._setResizeEvent = function _setResizeEvent() {
  5197. var _this7 = this;
  5198. if (this._isShown) {
  5199. $(window).on(Event$5.RESIZE, function (event) {
  5200. return _this7.handleUpdate(event);
  5201. });
  5202. } else {
  5203. $(window).off(Event$5.RESIZE);
  5204. }
  5205. };
  5206. _proto._hideModal = function _hideModal() {
  5207. var _this8 = this;
  5208. this._element.style.display = 'none';
  5209. this._element.setAttribute('aria-hidden', true);
  5210. this._element.removeAttribute('aria-modal');
  5211. this._isTransitioning = false;
  5212. this._showBackdrop(function () {
  5213. $(document.body).removeClass(ClassName$5.OPEN);
  5214. _this8._resetAdjustments();
  5215. _this8._resetScrollbar();
  5216. $(_this8._element).trigger(Event$5.HIDDEN);
  5217. });
  5218. };
  5219. _proto._removeBackdrop = function _removeBackdrop() {
  5220. if (this._backdrop) {
  5221. $(this._backdrop).remove();
  5222. this._backdrop = null;
  5223. }
  5224. };
  5225. _proto._showBackdrop = function _showBackdrop(callback) {
  5226. var _this9 = this;
  5227. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5228. if (this._isShown && this._config.backdrop) {
  5229. this._backdrop = document.createElement('div');
  5230. this._backdrop.className = ClassName$5.BACKDROP;
  5231. if (animate) {
  5232. this._backdrop.classList.add(animate);
  5233. }
  5234. $(this._backdrop).appendTo(document.body);
  5235. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5236. if (_this9._ignoreBackdropClick) {
  5237. _this9._ignoreBackdropClick = false;
  5238. return;
  5239. }
  5240. if (event.target !== event.currentTarget) {
  5241. return;
  5242. }
  5243. _this9._triggerBackdropTransition();
  5244. });
  5245. if (animate) {
  5246. Util.reflow(this._backdrop);
  5247. }
  5248. $(this._backdrop).addClass(ClassName$5.SHOW);
  5249. if (!callback) {
  5250. return;
  5251. }
  5252. if (!animate) {
  5253. callback();
  5254. return;
  5255. }
  5256. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5257. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5258. } else if (!this._isShown && this._backdrop) {
  5259. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5260. var callbackRemove = function callbackRemove() {
  5261. _this9._removeBackdrop();
  5262. if (callback) {
  5263. callback();
  5264. }
  5265. };
  5266. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5267. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5268. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5269. } else {
  5270. callbackRemove();
  5271. }
  5272. } else if (callback) {
  5273. callback();
  5274. }
  5275. } // ----------------------------------------------------------------------
  5276. // the following methods are used to handle overflowing modals
  5277. // todo (fat): these should probably be refactored out of modal.js
  5278. // ----------------------------------------------------------------------
  5279. ;
  5280. _proto._adjustDialog = function _adjustDialog() {
  5281. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5282. if (!this._isBodyOverflowing && isModalOverflowing) {
  5283. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5284. }
  5285. if (this._isBodyOverflowing && !isModalOverflowing) {
  5286. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5287. }
  5288. };
  5289. _proto._resetAdjustments = function _resetAdjustments() {
  5290. this._element.style.paddingLeft = '';
  5291. this._element.style.paddingRight = '';
  5292. };
  5293. _proto._checkScrollbar = function _checkScrollbar() {
  5294. var rect = document.body.getBoundingClientRect();
  5295. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5296. this._scrollbarWidth = this._getScrollbarWidth();
  5297. };
  5298. _proto._setScrollbar = function _setScrollbar() {
  5299. var _this10 = this;
  5300. if (this._isBodyOverflowing) {
  5301. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5302. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5303. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5304. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5305. $(fixedContent).each(function (index, element) {
  5306. var actualPadding = element.style.paddingRight;
  5307. var calculatedPadding = $(element).css('padding-right');
  5308. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5309. }); // Adjust sticky content margin
  5310. $(stickyContent).each(function (index, element) {
  5311. var actualMargin = element.style.marginRight;
  5312. var calculatedMargin = $(element).css('margin-right');
  5313. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5314. }); // Adjust body padding
  5315. var actualPadding = document.body.style.paddingRight;
  5316. var calculatedPadding = $(document.body).css('padding-right');
  5317. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5318. }
  5319. $(document.body).addClass(ClassName$5.OPEN);
  5320. };
  5321. _proto._resetScrollbar = function _resetScrollbar() {
  5322. // Restore fixed content padding
  5323. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5324. $(fixedContent).each(function (index, element) {
  5325. var padding = $(element).data('padding-right');
  5326. $(element).removeData('padding-right');
  5327. element.style.paddingRight = padding ? padding : '';
  5328. }); // Restore sticky content
  5329. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5330. $(elements).each(function (index, element) {
  5331. var margin = $(element).data('margin-right');
  5332. if (typeof margin !== 'undefined') {
  5333. $(element).css('margin-right', margin).removeData('margin-right');
  5334. }
  5335. }); // Restore body padding
  5336. var padding = $(document.body).data('padding-right');
  5337. $(document.body).removeData('padding-right');
  5338. document.body.style.paddingRight = padding ? padding : '';
  5339. };
  5340. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5341. // thx d.walsh
  5342. var scrollDiv = document.createElement('div');
  5343. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5344. document.body.appendChild(scrollDiv);
  5345. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5346. document.body.removeChild(scrollDiv);
  5347. return scrollbarWidth;
  5348. } // Static
  5349. ;
  5350. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5351. return this.each(function () {
  5352. var data = $(this).data(DATA_KEY$5);
  5353. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5354. if (!data) {
  5355. data = new Modal(this, _config);
  5356. $(this).data(DATA_KEY$5, data);
  5357. }
  5358. if (typeof config === 'string') {
  5359. if (typeof data[config] === 'undefined') {
  5360. throw new TypeError("No method named \"" + config + "\"");
  5361. }
  5362. data[config](relatedTarget);
  5363. } else if (_config.show) {
  5364. data.show(relatedTarget);
  5365. }
  5366. });
  5367. };
  5368. _createClass(Modal, null, [{
  5369. key: "VERSION",
  5370. get: function get() {
  5371. return VERSION$5;
  5372. }
  5373. }, {
  5374. key: "Default",
  5375. get: function get() {
  5376. return Default$3;
  5377. }
  5378. }]);
  5379. return Modal;
  5380. }();
  5381. /**
  5382. * ------------------------------------------------------------------------
  5383. * Data Api implementation
  5384. * ------------------------------------------------------------------------
  5385. */
  5386. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5387. var _this11 = this;
  5388. var target;
  5389. var selector = Util.getSelectorFromElement(this);
  5390. if (selector) {
  5391. target = document.querySelector(selector);
  5392. }
  5393. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5394. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5395. event.preventDefault();
  5396. }
  5397. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5398. if (showEvent.isDefaultPrevented()) {
  5399. // Only register focus restorer if modal will actually get shown
  5400. return;
  5401. }
  5402. $target.one(Event$5.HIDDEN, function () {
  5403. if ($(_this11).is(':visible')) {
  5404. _this11.focus();
  5405. }
  5406. });
  5407. });
  5408. Modal._jQueryInterface.call($(target), config, this);
  5409. });
  5410. /**
  5411. * ------------------------------------------------------------------------
  5412. * jQuery
  5413. * ------------------------------------------------------------------------
  5414. */
  5415. $.fn[NAME$5] = Modal._jQueryInterface;
  5416. $.fn[NAME$5].Constructor = Modal;
  5417. $.fn[NAME$5].noConflict = function () {
  5418. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5419. return Modal._jQueryInterface;
  5420. };
  5421. /**
  5422. * --------------------------------------------------------------------------
  5423. * Bootstrap (v4.4.1): tools/sanitizer.js
  5424. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5425. * --------------------------------------------------------------------------
  5426. */
  5427. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5428. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5429. var DefaultWhitelist = {
  5430. // Global attributes allowed on any supplied element below.
  5431. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5432. a: ['target', 'href', 'title', 'rel'],
  5433. area: [],
  5434. b: [],
  5435. br: [],
  5436. col: [],
  5437. code: [],
  5438. div: [],
  5439. em: [],
  5440. hr: [],
  5441. h1: [],
  5442. h2: [],
  5443. h3: [],
  5444. h4: [],
  5445. h5: [],
  5446. h6: [],
  5447. i: [],
  5448. img: ['src', 'alt', 'title', 'width', 'height'],
  5449. li: [],
  5450. ol: [],
  5451. p: [],
  5452. pre: [],
  5453. s: [],
  5454. small: [],
  5455. span: [],
  5456. sub: [],
  5457. sup: [],
  5458. strong: [],
  5459. u: [],
  5460. ul: []
  5461. };
  5462. /**
  5463. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5464. *
  5465. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5466. */
  5467. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5468. /**
  5469. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5470. *
  5471. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5472. */
  5473. 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;
  5474. function allowedAttribute(attr, allowedAttributeList) {
  5475. var attrName = attr.nodeName.toLowerCase();
  5476. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5477. if (uriAttrs.indexOf(attrName) !== -1) {
  5478. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5479. }
  5480. return true;
  5481. }
  5482. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5483. return attrRegex instanceof RegExp;
  5484. }); // Check if a regular expression validates the attribute.
  5485. for (var i = 0, l = regExp.length; i < l; i++) {
  5486. if (attrName.match(regExp[i])) {
  5487. return true;
  5488. }
  5489. }
  5490. return false;
  5491. }
  5492. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5493. if (unsafeHtml.length === 0) {
  5494. return unsafeHtml;
  5495. }
  5496. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5497. return sanitizeFn(unsafeHtml);
  5498. }
  5499. var domParser = new window.DOMParser();
  5500. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5501. var whitelistKeys = Object.keys(whiteList);
  5502. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5503. var _loop = function _loop(i, len) {
  5504. var el = elements[i];
  5505. var elName = el.nodeName.toLowerCase();
  5506. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5507. el.parentNode.removeChild(el);
  5508. return "continue";
  5509. }
  5510. var attributeList = [].slice.call(el.attributes);
  5511. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5512. attributeList.forEach(function (attr) {
  5513. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5514. el.removeAttribute(attr.nodeName);
  5515. }
  5516. });
  5517. };
  5518. for (var i = 0, len = elements.length; i < len; i++) {
  5519. var _ret = _loop(i);
  5520. if (_ret === "continue") continue;
  5521. }
  5522. return createdDocument.body.innerHTML;
  5523. }
  5524. /**
  5525. * ------------------------------------------------------------------------
  5526. * Constants
  5527. * ------------------------------------------------------------------------
  5528. */
  5529. var NAME$6 = 'tooltip';
  5530. var VERSION$6 = '4.4.1';
  5531. var DATA_KEY$6 = 'bs.tooltip';
  5532. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5533. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5534. var CLASS_PREFIX = 'bs-tooltip';
  5535. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5536. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5537. var DefaultType$4 = {
  5538. animation: 'boolean',
  5539. template: 'string',
  5540. title: '(string|element|function)',
  5541. trigger: 'string',
  5542. delay: '(number|object)',
  5543. html: 'boolean',
  5544. selector: '(string|boolean)',
  5545. placement: '(string|function)',
  5546. offset: '(number|string|function)',
  5547. container: '(string|element|boolean)',
  5548. fallbackPlacement: '(string|array)',
  5549. boundary: '(string|element)',
  5550. sanitize: 'boolean',
  5551. sanitizeFn: '(null|function)',
  5552. whiteList: 'object',
  5553. popperConfig: '(null|object)'
  5554. };
  5555. var AttachmentMap$1 = {
  5556. AUTO: 'auto',
  5557. TOP: 'top',
  5558. RIGHT: 'right',
  5559. BOTTOM: 'bottom',
  5560. LEFT: 'left'
  5561. };
  5562. var Default$4 = {
  5563. animation: true,
  5564. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5565. trigger: 'hover focus',
  5566. title: '',
  5567. delay: 0,
  5568. html: false,
  5569. selector: false,
  5570. placement: 'top',
  5571. offset: 0,
  5572. container: false,
  5573. fallbackPlacement: 'flip',
  5574. boundary: 'scrollParent',
  5575. sanitize: true,
  5576. sanitizeFn: null,
  5577. whiteList: DefaultWhitelist,
  5578. popperConfig: null
  5579. };
  5580. var HoverState = {
  5581. SHOW: 'show',
  5582. OUT: 'out'
  5583. };
  5584. var Event$6 = {
  5585. HIDE: "hide" + EVENT_KEY$6,
  5586. HIDDEN: "hidden" + EVENT_KEY$6,
  5587. SHOW: "show" + EVENT_KEY$6,
  5588. SHOWN: "shown" + EVENT_KEY$6,
  5589. INSERTED: "inserted" + EVENT_KEY$6,
  5590. CLICK: "click" + EVENT_KEY$6,
  5591. FOCUSIN: "focusin" + EVENT_KEY$6,
  5592. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5593. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5594. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5595. };
  5596. var ClassName$6 = {
  5597. FADE: 'fade',
  5598. SHOW: 'show'
  5599. };
  5600. var Selector$6 = {
  5601. TOOLTIP: '.tooltip',
  5602. TOOLTIP_INNER: '.tooltip-inner',
  5603. ARROW: '.arrow'
  5604. };
  5605. var Trigger = {
  5606. HOVER: 'hover',
  5607. FOCUS: 'focus',
  5608. CLICK: 'click',
  5609. MANUAL: 'manual'
  5610. };
  5611. /**
  5612. * ------------------------------------------------------------------------
  5613. * Class Definition
  5614. * ------------------------------------------------------------------------
  5615. */
  5616. var Tooltip =
  5617. /*#__PURE__*/
  5618. function () {
  5619. function Tooltip(element, config) {
  5620. if (typeof Popper === 'undefined') {
  5621. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5622. } // private
  5623. this._isEnabled = true;
  5624. this._timeout = 0;
  5625. this._hoverState = '';
  5626. this._activeTrigger = {};
  5627. this._popper = null; // Protected
  5628. this.element = element;
  5629. this.config = this._getConfig(config);
  5630. this.tip = null;
  5631. this._setListeners();
  5632. } // Getters
  5633. var _proto = Tooltip.prototype;
  5634. // Public
  5635. _proto.enable = function enable() {
  5636. this._isEnabled = true;
  5637. };
  5638. _proto.disable = function disable() {
  5639. this._isEnabled = false;
  5640. };
  5641. _proto.toggleEnabled = function toggleEnabled() {
  5642. this._isEnabled = !this._isEnabled;
  5643. };
  5644. _proto.toggle = function toggle(event) {
  5645. if (!this._isEnabled) {
  5646. return;
  5647. }
  5648. if (event) {
  5649. var dataKey = this.constructor.DATA_KEY;
  5650. var context = $(event.currentTarget).data(dataKey);
  5651. if (!context) {
  5652. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5653. $(event.currentTarget).data(dataKey, context);
  5654. }
  5655. context._activeTrigger.click = !context._activeTrigger.click;
  5656. if (context._isWithActiveTrigger()) {
  5657. context._enter(null, context);
  5658. } else {
  5659. context._leave(null, context);
  5660. }
  5661. } else {
  5662. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5663. this._leave(null, this);
  5664. return;
  5665. }
  5666. this._enter(null, this);
  5667. }
  5668. };
  5669. _proto.dispose = function dispose() {
  5670. clearTimeout(this._timeout);
  5671. $.removeData(this.element, this.constructor.DATA_KEY);
  5672. $(this.element).off(this.constructor.EVENT_KEY);
  5673. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5674. if (this.tip) {
  5675. $(this.tip).remove();
  5676. }
  5677. this._isEnabled = null;
  5678. this._timeout = null;
  5679. this._hoverState = null;
  5680. this._activeTrigger = null;
  5681. if (this._popper) {
  5682. this._popper.destroy();
  5683. }
  5684. this._popper = null;
  5685. this.element = null;
  5686. this.config = null;
  5687. this.tip = null;
  5688. };
  5689. _proto.show = function show() {
  5690. var _this = this;
  5691. if ($(this.element).css('display') === 'none') {
  5692. throw new Error('Please use show on visible elements');
  5693. }
  5694. var showEvent = $.Event(this.constructor.Event.SHOW);
  5695. if (this.isWithContent() && this._isEnabled) {
  5696. $(this.element).trigger(showEvent);
  5697. var shadowRoot = Util.findShadowRoot(this.element);
  5698. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5699. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5700. return;
  5701. }
  5702. var tip = this.getTipElement();
  5703. var tipId = Util.getUID(this.constructor.NAME);
  5704. tip.setAttribute('id', tipId);
  5705. this.element.setAttribute('aria-describedby', tipId);
  5706. this.setContent();
  5707. if (this.config.animation) {
  5708. $(tip).addClass(ClassName$6.FADE);
  5709. }
  5710. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5711. var attachment = this._getAttachment(placement);
  5712. this.addAttachmentClass(attachment);
  5713. var container = this._getContainer();
  5714. $(tip).data(this.constructor.DATA_KEY, this);
  5715. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5716. $(tip).appendTo(container);
  5717. }
  5718. $(this.element).trigger(this.constructor.Event.INSERTED);
  5719. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5720. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5721. // empty mouseover listeners to the body's immediate children;
  5722. // only needed because of broken event delegation on iOS
  5723. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5724. if ('ontouchstart' in document.documentElement) {
  5725. $(document.body).children().on('mouseover', null, $.noop);
  5726. }
  5727. var complete = function complete() {
  5728. if (_this.config.animation) {
  5729. _this._fixTransition();
  5730. }
  5731. var prevHoverState = _this._hoverState;
  5732. _this._hoverState = null;
  5733. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5734. if (prevHoverState === HoverState.OUT) {
  5735. _this._leave(null, _this);
  5736. }
  5737. };
  5738. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5739. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5740. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5741. } else {
  5742. complete();
  5743. }
  5744. }
  5745. };
  5746. _proto.hide = function hide(callback) {
  5747. var _this2 = this;
  5748. var tip = this.getTipElement();
  5749. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5750. var complete = function complete() {
  5751. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5752. tip.parentNode.removeChild(tip);
  5753. }
  5754. _this2._cleanTipClass();
  5755. _this2.element.removeAttribute('aria-describedby');
  5756. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5757. if (_this2._popper !== null) {
  5758. _this2._popper.destroy();
  5759. }
  5760. if (callback) {
  5761. callback();
  5762. }
  5763. };
  5764. $(this.element).trigger(hideEvent);
  5765. if (hideEvent.isDefaultPrevented()) {
  5766. return;
  5767. }
  5768. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5769. // empty mouseover listeners we added for iOS support
  5770. if ('ontouchstart' in document.documentElement) {
  5771. $(document.body).children().off('mouseover', null, $.noop);
  5772. }
  5773. this._activeTrigger[Trigger.CLICK] = false;
  5774. this._activeTrigger[Trigger.FOCUS] = false;
  5775. this._activeTrigger[Trigger.HOVER] = false;
  5776. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5777. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5778. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5779. } else {
  5780. complete();
  5781. }
  5782. this._hoverState = '';
  5783. };
  5784. _proto.update = function update() {
  5785. if (this._popper !== null) {
  5786. this._popper.scheduleUpdate();
  5787. }
  5788. } // Protected
  5789. ;
  5790. _proto.isWithContent = function isWithContent() {
  5791. return Boolean(this.getTitle());
  5792. };
  5793. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5794. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5795. };
  5796. _proto.getTipElement = function getTipElement() {
  5797. this.tip = this.tip || $(this.config.template)[0];
  5798. return this.tip;
  5799. };
  5800. _proto.setContent = function setContent() {
  5801. var tip = this.getTipElement();
  5802. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5803. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5804. };
  5805. _proto.setElementContent = function setElementContent($element, content) {
  5806. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5807. // Content is a DOM node or a jQuery
  5808. if (this.config.html) {
  5809. if (!$(content).parent().is($element)) {
  5810. $element.empty().append(content);
  5811. }
  5812. } else {
  5813. $element.text($(content).text());
  5814. }
  5815. return;
  5816. }
  5817. if (this.config.html) {
  5818. if (this.config.sanitize) {
  5819. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5820. }
  5821. $element.html(content);
  5822. } else {
  5823. $element.text(content);
  5824. }
  5825. };
  5826. _proto.getTitle = function getTitle() {
  5827. var title = this.element.getAttribute('data-original-title');
  5828. if (!title) {
  5829. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5830. }
  5831. return title;
  5832. } // Private
  5833. ;
  5834. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5835. var _this3 = this;
  5836. var defaultBsConfig = {
  5837. placement: attachment,
  5838. modifiers: {
  5839. offset: this._getOffset(),
  5840. flip: {
  5841. behavior: this.config.fallbackPlacement
  5842. },
  5843. arrow: {
  5844. element: Selector$6.ARROW
  5845. },
  5846. preventOverflow: {
  5847. boundariesElement: this.config.boundary
  5848. }
  5849. },
  5850. onCreate: function onCreate(data) {
  5851. if (data.originalPlacement !== data.placement) {
  5852. _this3._handlePopperPlacementChange(data);
  5853. }
  5854. },
  5855. onUpdate: function onUpdate(data) {
  5856. return _this3._handlePopperPlacementChange(data);
  5857. }
  5858. };
  5859. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5860. };
  5861. _proto._getOffset = function _getOffset() {
  5862. var _this4 = this;
  5863. var offset = {};
  5864. if (typeof this.config.offset === 'function') {
  5865. offset.fn = function (data) {
  5866. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5867. return data;
  5868. };
  5869. } else {
  5870. offset.offset = this.config.offset;
  5871. }
  5872. return offset;
  5873. };
  5874. _proto._getContainer = function _getContainer() {
  5875. if (this.config.container === false) {
  5876. return document.body;
  5877. }
  5878. if (Util.isElement(this.config.container)) {
  5879. return $(this.config.container);
  5880. }
  5881. return $(document).find(this.config.container);
  5882. };
  5883. _proto._getAttachment = function _getAttachment(placement) {
  5884. return AttachmentMap$1[placement.toUpperCase()];
  5885. };
  5886. _proto._setListeners = function _setListeners() {
  5887. var _this5 = this;
  5888. var triggers = this.config.trigger.split(' ');
  5889. triggers.forEach(function (trigger) {
  5890. if (trigger === 'click') {
  5891. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5892. return _this5.toggle(event);
  5893. });
  5894. } else if (trigger !== Trigger.MANUAL) {
  5895. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5896. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5897. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5898. return _this5._enter(event);
  5899. }).on(eventOut, _this5.config.selector, function (event) {
  5900. return _this5._leave(event);
  5901. });
  5902. }
  5903. });
  5904. this._hideModalHandler = function () {
  5905. if (_this5.element) {
  5906. _this5.hide();
  5907. }
  5908. };
  5909. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5910. if (this.config.selector) {
  5911. this.config = _objectSpread2({}, this.config, {
  5912. trigger: 'manual',
  5913. selector: ''
  5914. });
  5915. } else {
  5916. this._fixTitle();
  5917. }
  5918. };
  5919. _proto._fixTitle = function _fixTitle() {
  5920. var titleType = typeof this.element.getAttribute('data-original-title');
  5921. if (this.element.getAttribute('title') || titleType !== 'string') {
  5922. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5923. this.element.setAttribute('title', '');
  5924. }
  5925. };
  5926. _proto._enter = function _enter(event, context) {
  5927. var dataKey = this.constructor.DATA_KEY;
  5928. context = context || $(event.currentTarget).data(dataKey);
  5929. if (!context) {
  5930. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5931. $(event.currentTarget).data(dataKey, context);
  5932. }
  5933. if (event) {
  5934. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5935. }
  5936. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5937. context._hoverState = HoverState.SHOW;
  5938. return;
  5939. }
  5940. clearTimeout(context._timeout);
  5941. context._hoverState = HoverState.SHOW;
  5942. if (!context.config.delay || !context.config.delay.show) {
  5943. context.show();
  5944. return;
  5945. }
  5946. context._timeout = setTimeout(function () {
  5947. if (context._hoverState === HoverState.SHOW) {
  5948. context.show();
  5949. }
  5950. }, context.config.delay.show);
  5951. };
  5952. _proto._leave = function _leave(event, context) {
  5953. var dataKey = this.constructor.DATA_KEY;
  5954. context = context || $(event.currentTarget).data(dataKey);
  5955. if (!context) {
  5956. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5957. $(event.currentTarget).data(dataKey, context);
  5958. }
  5959. if (event) {
  5960. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5961. }
  5962. if (context._isWithActiveTrigger()) {
  5963. return;
  5964. }
  5965. clearTimeout(context._timeout);
  5966. context._hoverState = HoverState.OUT;
  5967. if (!context.config.delay || !context.config.delay.hide) {
  5968. context.hide();
  5969. return;
  5970. }
  5971. context._timeout = setTimeout(function () {
  5972. if (context._hoverState === HoverState.OUT) {
  5973. context.hide();
  5974. }
  5975. }, context.config.delay.hide);
  5976. };
  5977. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5978. for (var trigger in this._activeTrigger) {
  5979. if (this._activeTrigger[trigger]) {
  5980. return true;
  5981. }
  5982. }
  5983. return false;
  5984. };
  5985. _proto._getConfig = function _getConfig(config) {
  5986. var dataAttributes = $(this.element).data();
  5987. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5988. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5989. delete dataAttributes[dataAttr];
  5990. }
  5991. });
  5992. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5993. if (typeof config.delay === 'number') {
  5994. config.delay = {
  5995. show: config.delay,
  5996. hide: config.delay
  5997. };
  5998. }
  5999. if (typeof config.title === 'number') {
  6000. config.title = config.title.toString();
  6001. }
  6002. if (typeof config.content === 'number') {
  6003. config.content = config.content.toString();
  6004. }
  6005. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  6006. if (config.sanitize) {
  6007. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  6008. }
  6009. return config;
  6010. };
  6011. _proto._getDelegateConfig = function _getDelegateConfig() {
  6012. var config = {};
  6013. if (this.config) {
  6014. for (var key in this.config) {
  6015. if (this.constructor.Default[key] !== this.config[key]) {
  6016. config[key] = this.config[key];
  6017. }
  6018. }
  6019. }
  6020. return config;
  6021. };
  6022. _proto._cleanTipClass = function _cleanTipClass() {
  6023. var $tip = $(this.getTipElement());
  6024. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6025. if (tabClass !== null && tabClass.length) {
  6026. $tip.removeClass(tabClass.join(''));
  6027. }
  6028. };
  6029. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6030. var popperInstance = popperData.instance;
  6031. this.tip = popperInstance.popper;
  6032. this._cleanTipClass();
  6033. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6034. };
  6035. _proto._fixTransition = function _fixTransition() {
  6036. var tip = this.getTipElement();
  6037. var initConfigAnimation = this.config.animation;
  6038. if (tip.getAttribute('x-placement') !== null) {
  6039. return;
  6040. }
  6041. $(tip).removeClass(ClassName$6.FADE);
  6042. this.config.animation = false;
  6043. this.hide();
  6044. this.show();
  6045. this.config.animation = initConfigAnimation;
  6046. } // Static
  6047. ;
  6048. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6049. return this.each(function () {
  6050. var data = $(this).data(DATA_KEY$6);
  6051. var _config = typeof config === 'object' && config;
  6052. if (!data && /dispose|hide/.test(config)) {
  6053. return;
  6054. }
  6055. if (!data) {
  6056. data = new Tooltip(this, _config);
  6057. $(this).data(DATA_KEY$6, data);
  6058. }
  6059. if (typeof config === 'string') {
  6060. if (typeof data[config] === 'undefined') {
  6061. throw new TypeError("No method named \"" + config + "\"");
  6062. }
  6063. data[config]();
  6064. }
  6065. });
  6066. };
  6067. _createClass(Tooltip, null, [{
  6068. key: "VERSION",
  6069. get: function get() {
  6070. return VERSION$6;
  6071. }
  6072. }, {
  6073. key: "Default",
  6074. get: function get() {
  6075. return Default$4;
  6076. }
  6077. }, {
  6078. key: "NAME",
  6079. get: function get() {
  6080. return NAME$6;
  6081. }
  6082. }, {
  6083. key: "DATA_KEY",
  6084. get: function get() {
  6085. return DATA_KEY$6;
  6086. }
  6087. }, {
  6088. key: "Event",
  6089. get: function get() {
  6090. return Event$6;
  6091. }
  6092. }, {
  6093. key: "EVENT_KEY",
  6094. get: function get() {
  6095. return EVENT_KEY$6;
  6096. }
  6097. }, {
  6098. key: "DefaultType",
  6099. get: function get() {
  6100. return DefaultType$4;
  6101. }
  6102. }]);
  6103. return Tooltip;
  6104. }();
  6105. /**
  6106. * ------------------------------------------------------------------------
  6107. * jQuery
  6108. * ------------------------------------------------------------------------
  6109. */
  6110. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6111. $.fn[NAME$6].Constructor = Tooltip;
  6112. $.fn[NAME$6].noConflict = function () {
  6113. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6114. return Tooltip._jQueryInterface;
  6115. };
  6116. /**
  6117. * ------------------------------------------------------------------------
  6118. * Constants
  6119. * ------------------------------------------------------------------------
  6120. */
  6121. var NAME$7 = 'popover';
  6122. var VERSION$7 = '4.4.1';
  6123. var DATA_KEY$7 = 'bs.popover';
  6124. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6125. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6126. var CLASS_PREFIX$1 = 'bs-popover';
  6127. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6128. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6129. placement: 'right',
  6130. trigger: 'click',
  6131. content: '',
  6132. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6133. });
  6134. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6135. content: '(string|element|function)'
  6136. });
  6137. var ClassName$7 = {
  6138. FADE: 'fade',
  6139. SHOW: 'show'
  6140. };
  6141. var Selector$7 = {
  6142. TITLE: '.popover-header',
  6143. CONTENT: '.popover-body'
  6144. };
  6145. var Event$7 = {
  6146. HIDE: "hide" + EVENT_KEY$7,
  6147. HIDDEN: "hidden" + EVENT_KEY$7,
  6148. SHOW: "show" + EVENT_KEY$7,
  6149. SHOWN: "shown" + EVENT_KEY$7,
  6150. INSERTED: "inserted" + EVENT_KEY$7,
  6151. CLICK: "click" + EVENT_KEY$7,
  6152. FOCUSIN: "focusin" + EVENT_KEY$7,
  6153. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6154. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6155. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6156. };
  6157. /**
  6158. * ------------------------------------------------------------------------
  6159. * Class Definition
  6160. * ------------------------------------------------------------------------
  6161. */
  6162. var Popover =
  6163. /*#__PURE__*/
  6164. function (_Tooltip) {
  6165. _inheritsLoose(Popover, _Tooltip);
  6166. function Popover() {
  6167. return _Tooltip.apply(this, arguments) || this;
  6168. }
  6169. var _proto = Popover.prototype;
  6170. // Overrides
  6171. _proto.isWithContent = function isWithContent() {
  6172. return this.getTitle() || this._getContent();
  6173. };
  6174. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6175. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6176. };
  6177. _proto.getTipElement = function getTipElement() {
  6178. this.tip = this.tip || $(this.config.template)[0];
  6179. return this.tip;
  6180. };
  6181. _proto.setContent = function setContent() {
  6182. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6183. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6184. var content = this._getContent();
  6185. if (typeof content === 'function') {
  6186. content = content.call(this.element);
  6187. }
  6188. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6189. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6190. } // Private
  6191. ;
  6192. _proto._getContent = function _getContent() {
  6193. return this.element.getAttribute('data-content') || this.config.content;
  6194. };
  6195. _proto._cleanTipClass = function _cleanTipClass() {
  6196. var $tip = $(this.getTipElement());
  6197. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6198. if (tabClass !== null && tabClass.length > 0) {
  6199. $tip.removeClass(tabClass.join(''));
  6200. }
  6201. } // Static
  6202. ;
  6203. Popover._jQueryInterface = function _jQueryInterface(config) {
  6204. return this.each(function () {
  6205. var data = $(this).data(DATA_KEY$7);
  6206. var _config = typeof config === 'object' ? config : null;
  6207. if (!data && /dispose|hide/.test(config)) {
  6208. return;
  6209. }
  6210. if (!data) {
  6211. data = new Popover(this, _config);
  6212. $(this).data(DATA_KEY$7, data);
  6213. }
  6214. if (typeof config === 'string') {
  6215. if (typeof data[config] === 'undefined') {
  6216. throw new TypeError("No method named \"" + config + "\"");
  6217. }
  6218. data[config]();
  6219. }
  6220. });
  6221. };
  6222. _createClass(Popover, null, [{
  6223. key: "VERSION",
  6224. // Getters
  6225. get: function get() {
  6226. return VERSION$7;
  6227. }
  6228. }, {
  6229. key: "Default",
  6230. get: function get() {
  6231. return Default$5;
  6232. }
  6233. }, {
  6234. key: "NAME",
  6235. get: function get() {
  6236. return NAME$7;
  6237. }
  6238. }, {
  6239. key: "DATA_KEY",
  6240. get: function get() {
  6241. return DATA_KEY$7;
  6242. }
  6243. }, {
  6244. key: "Event",
  6245. get: function get() {
  6246. return Event$7;
  6247. }
  6248. }, {
  6249. key: "EVENT_KEY",
  6250. get: function get() {
  6251. return EVENT_KEY$7;
  6252. }
  6253. }, {
  6254. key: "DefaultType",
  6255. get: function get() {
  6256. return DefaultType$5;
  6257. }
  6258. }]);
  6259. return Popover;
  6260. }(Tooltip);
  6261. /**
  6262. * ------------------------------------------------------------------------
  6263. * jQuery
  6264. * ------------------------------------------------------------------------
  6265. */
  6266. $.fn[NAME$7] = Popover._jQueryInterface;
  6267. $.fn[NAME$7].Constructor = Popover;
  6268. $.fn[NAME$7].noConflict = function () {
  6269. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6270. return Popover._jQueryInterface;
  6271. };
  6272. /**
  6273. * ------------------------------------------------------------------------
  6274. * Constants
  6275. * ------------------------------------------------------------------------
  6276. */
  6277. var NAME$8 = 'scrollspy';
  6278. var VERSION$8 = '4.4.1';
  6279. var DATA_KEY$8 = 'bs.scrollspy';
  6280. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6281. var DATA_API_KEY$6 = '.data-api';
  6282. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6283. var Default$6 = {
  6284. offset: 10,
  6285. method: 'auto',
  6286. target: ''
  6287. };
  6288. var DefaultType$6 = {
  6289. offset: 'number',
  6290. method: 'string',
  6291. target: '(string|element)'
  6292. };
  6293. var Event$8 = {
  6294. ACTIVATE: "activate" + EVENT_KEY$8,
  6295. SCROLL: "scroll" + EVENT_KEY$8,
  6296. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6297. };
  6298. var ClassName$8 = {
  6299. DROPDOWN_ITEM: 'dropdown-item',
  6300. DROPDOWN_MENU: 'dropdown-menu',
  6301. ACTIVE: 'active'
  6302. };
  6303. var Selector$8 = {
  6304. DATA_SPY: '[data-spy="scroll"]',
  6305. ACTIVE: '.active',
  6306. NAV_LIST_GROUP: '.nav, .list-group',
  6307. NAV_LINKS: '.nav-link',
  6308. NAV_ITEMS: '.nav-item',
  6309. LIST_ITEMS: '.list-group-item',
  6310. DROPDOWN: '.dropdown',
  6311. DROPDOWN_ITEMS: '.dropdown-item',
  6312. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6313. };
  6314. var OffsetMethod = {
  6315. OFFSET: 'offset',
  6316. POSITION: 'position'
  6317. };
  6318. /**
  6319. * ------------------------------------------------------------------------
  6320. * Class Definition
  6321. * ------------------------------------------------------------------------
  6322. */
  6323. var ScrollSpy =
  6324. /*#__PURE__*/
  6325. function () {
  6326. function ScrollSpy(element, config) {
  6327. var _this = this;
  6328. this._element = element;
  6329. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6330. this._config = this._getConfig(config);
  6331. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6332. this._offsets = [];
  6333. this._targets = [];
  6334. this._activeTarget = null;
  6335. this._scrollHeight = 0;
  6336. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6337. return _this._process(event);
  6338. });
  6339. this.refresh();
  6340. this._process();
  6341. } // Getters
  6342. var _proto = ScrollSpy.prototype;
  6343. // Public
  6344. _proto.refresh = function refresh() {
  6345. var _this2 = this;
  6346. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6347. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6348. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6349. this._offsets = [];
  6350. this._targets = [];
  6351. this._scrollHeight = this._getScrollHeight();
  6352. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6353. targets.map(function (element) {
  6354. var target;
  6355. var targetSelector = Util.getSelectorFromElement(element);
  6356. if (targetSelector) {
  6357. target = document.querySelector(targetSelector);
  6358. }
  6359. if (target) {
  6360. var targetBCR = target.getBoundingClientRect();
  6361. if (targetBCR.width || targetBCR.height) {
  6362. // TODO (fat): remove sketch reliance on jQuery position/offset
  6363. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6364. }
  6365. }
  6366. return null;
  6367. }).filter(function (item) {
  6368. return item;
  6369. }).sort(function (a, b) {
  6370. return a[0] - b[0];
  6371. }).forEach(function (item) {
  6372. _this2._offsets.push(item[0]);
  6373. _this2._targets.push(item[1]);
  6374. });
  6375. };
  6376. _proto.dispose = function dispose() {
  6377. $.removeData(this._element, DATA_KEY$8);
  6378. $(this._scrollElement).off(EVENT_KEY$8);
  6379. this._element = null;
  6380. this._scrollElement = null;
  6381. this._config = null;
  6382. this._selector = null;
  6383. this._offsets = null;
  6384. this._targets = null;
  6385. this._activeTarget = null;
  6386. this._scrollHeight = null;
  6387. } // Private
  6388. ;
  6389. _proto._getConfig = function _getConfig(config) {
  6390. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6391. if (typeof config.target !== 'string') {
  6392. var id = $(config.target).attr('id');
  6393. if (!id) {
  6394. id = Util.getUID(NAME$8);
  6395. $(config.target).attr('id', id);
  6396. }
  6397. config.target = "#" + id;
  6398. }
  6399. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6400. return config;
  6401. };
  6402. _proto._getScrollTop = function _getScrollTop() {
  6403. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6404. };
  6405. _proto._getScrollHeight = function _getScrollHeight() {
  6406. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6407. };
  6408. _proto._getOffsetHeight = function _getOffsetHeight() {
  6409. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6410. };
  6411. _proto._process = function _process() {
  6412. var scrollTop = this._getScrollTop() + this._config.offset;
  6413. var scrollHeight = this._getScrollHeight();
  6414. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6415. if (this._scrollHeight !== scrollHeight) {
  6416. this.refresh();
  6417. }
  6418. if (scrollTop >= maxScroll) {
  6419. var target = this._targets[this._targets.length - 1];
  6420. if (this._activeTarget !== target) {
  6421. this._activate(target);
  6422. }
  6423. return;
  6424. }
  6425. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6426. this._activeTarget = null;
  6427. this._clear();
  6428. return;
  6429. }
  6430. var offsetLength = this._offsets.length;
  6431. for (var i = offsetLength; i--;) {
  6432. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6433. if (isActiveTarget) {
  6434. this._activate(this._targets[i]);
  6435. }
  6436. }
  6437. };
  6438. _proto._activate = function _activate(target) {
  6439. this._activeTarget = target;
  6440. this._clear();
  6441. var queries = this._selector.split(',').map(function (selector) {
  6442. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6443. });
  6444. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6445. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6446. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6447. $link.addClass(ClassName$8.ACTIVE);
  6448. } else {
  6449. // Set triggered link as active
  6450. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6451. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6452. $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
  6453. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6454. }
  6455. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6456. relatedTarget: target
  6457. });
  6458. };
  6459. _proto._clear = function _clear() {
  6460. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6461. return node.classList.contains(ClassName$8.ACTIVE);
  6462. }).forEach(function (node) {
  6463. return node.classList.remove(ClassName$8.ACTIVE);
  6464. });
  6465. } // Static
  6466. ;
  6467. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6468. return this.each(function () {
  6469. var data = $(this).data(DATA_KEY$8);
  6470. var _config = typeof config === 'object' && config;
  6471. if (!data) {
  6472. data = new ScrollSpy(this, _config);
  6473. $(this).data(DATA_KEY$8, data);
  6474. }
  6475. if (typeof config === 'string') {
  6476. if (typeof data[config] === 'undefined') {
  6477. throw new TypeError("No method named \"" + config + "\"");
  6478. }
  6479. data[config]();
  6480. }
  6481. });
  6482. };
  6483. _createClass(ScrollSpy, null, [{
  6484. key: "VERSION",
  6485. get: function get() {
  6486. return VERSION$8;
  6487. }
  6488. }, {
  6489. key: "Default",
  6490. get: function get() {
  6491. return Default$6;
  6492. }
  6493. }]);
  6494. return ScrollSpy;
  6495. }();
  6496. /**
  6497. * ------------------------------------------------------------------------
  6498. * Data Api implementation
  6499. * ------------------------------------------------------------------------
  6500. */
  6501. $(window).on(Event$8.LOAD_DATA_API, function () {
  6502. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6503. var scrollSpysLength = scrollSpys.length;
  6504. for (var i = scrollSpysLength; i--;) {
  6505. var $spy = $(scrollSpys[i]);
  6506. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6507. }
  6508. });
  6509. /**
  6510. * ------------------------------------------------------------------------
  6511. * jQuery
  6512. * ------------------------------------------------------------------------
  6513. */
  6514. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6515. $.fn[NAME$8].Constructor = ScrollSpy;
  6516. $.fn[NAME$8].noConflict = function () {
  6517. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6518. return ScrollSpy._jQueryInterface;
  6519. };
  6520. /**
  6521. * ------------------------------------------------------------------------
  6522. * Constants
  6523. * ------------------------------------------------------------------------
  6524. */
  6525. var NAME$9 = 'tab';
  6526. var VERSION$9 = '4.4.1';
  6527. var DATA_KEY$9 = 'bs.tab';
  6528. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6529. var DATA_API_KEY$7 = '.data-api';
  6530. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6531. var Event$9 = {
  6532. HIDE: "hide" + EVENT_KEY$9,
  6533. HIDDEN: "hidden" + EVENT_KEY$9,
  6534. SHOW: "show" + EVENT_KEY$9,
  6535. SHOWN: "shown" + EVENT_KEY$9,
  6536. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6537. };
  6538. var ClassName$9 = {
  6539. DROPDOWN_MENU: 'dropdown-menu',
  6540. ACTIVE: 'active',
  6541. DISABLED: 'disabled',
  6542. FADE: 'fade',
  6543. SHOW: 'show'
  6544. };
  6545. var Selector$9 = {
  6546. DROPDOWN: '.dropdown',
  6547. NAV_LIST_GROUP: '.nav, .list-group',
  6548. ACTIVE: '.active',
  6549. ACTIVE_UL: '> li > .active',
  6550. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6551. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6552. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6553. };
  6554. /**
  6555. * ------------------------------------------------------------------------
  6556. * Class Definition
  6557. * ------------------------------------------------------------------------
  6558. */
  6559. var Tab =
  6560. /*#__PURE__*/
  6561. function () {
  6562. function Tab(element) {
  6563. this._element = element;
  6564. } // Getters
  6565. var _proto = Tab.prototype;
  6566. // Public
  6567. _proto.show = function show() {
  6568. var _this = this;
  6569. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6570. return;
  6571. }
  6572. var target;
  6573. var previous;
  6574. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6575. var selector = Util.getSelectorFromElement(this._element);
  6576. if (listElement) {
  6577. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6578. previous = $.makeArray($(listElement).find(itemSelector));
  6579. previous = previous[previous.length - 1];
  6580. }
  6581. var hideEvent = $.Event(Event$9.HIDE, {
  6582. relatedTarget: this._element
  6583. });
  6584. var showEvent = $.Event(Event$9.SHOW, {
  6585. relatedTarget: previous
  6586. });
  6587. if (previous) {
  6588. $(previous).trigger(hideEvent);
  6589. }
  6590. $(this._element).trigger(showEvent);
  6591. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6592. return;
  6593. }
  6594. if (selector) {
  6595. target = document.querySelector(selector);
  6596. }
  6597. this._activate(this._element, listElement);
  6598. var complete = function complete() {
  6599. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6600. relatedTarget: _this._element
  6601. });
  6602. var shownEvent = $.Event(Event$9.SHOWN, {
  6603. relatedTarget: previous
  6604. });
  6605. $(previous).trigger(hiddenEvent);
  6606. $(_this._element).trigger(shownEvent);
  6607. };
  6608. if (target) {
  6609. this._activate(target, target.parentNode, complete);
  6610. } else {
  6611. complete();
  6612. }
  6613. };
  6614. _proto.dispose = function dispose() {
  6615. $.removeData(this._element, DATA_KEY$9);
  6616. this._element = null;
  6617. } // Private
  6618. ;
  6619. _proto._activate = function _activate(element, container, callback) {
  6620. var _this2 = this;
  6621. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6622. var active = activeElements[0];
  6623. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6624. var complete = function complete() {
  6625. return _this2._transitionComplete(element, active, callback);
  6626. };
  6627. if (active && isTransitioning) {
  6628. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6629. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6630. } else {
  6631. complete();
  6632. }
  6633. };
  6634. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6635. if (active) {
  6636. $(active).removeClass(ClassName$9.ACTIVE);
  6637. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6638. if (dropdownChild) {
  6639. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6640. }
  6641. if (active.getAttribute('role') === 'tab') {
  6642. active.setAttribute('aria-selected', false);
  6643. }
  6644. }
  6645. $(element).addClass(ClassName$9.ACTIVE);
  6646. if (element.getAttribute('role') === 'tab') {
  6647. element.setAttribute('aria-selected', true);
  6648. }
  6649. Util.reflow(element);
  6650. if (element.classList.contains(ClassName$9.FADE)) {
  6651. element.classList.add(ClassName$9.SHOW);
  6652. }
  6653. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6654. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6655. if (dropdownElement) {
  6656. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6657. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6658. }
  6659. element.setAttribute('aria-expanded', true);
  6660. }
  6661. if (callback) {
  6662. callback();
  6663. }
  6664. } // Static
  6665. ;
  6666. Tab._jQueryInterface = function _jQueryInterface(config) {
  6667. return this.each(function () {
  6668. var $this = $(this);
  6669. var data = $this.data(DATA_KEY$9);
  6670. if (!data) {
  6671. data = new Tab(this);
  6672. $this.data(DATA_KEY$9, data);
  6673. }
  6674. if (typeof config === 'string') {
  6675. if (typeof data[config] === 'undefined') {
  6676. throw new TypeError("No method named \"" + config + "\"");
  6677. }
  6678. data[config]();
  6679. }
  6680. });
  6681. };
  6682. _createClass(Tab, null, [{
  6683. key: "VERSION",
  6684. get: function get() {
  6685. return VERSION$9;
  6686. }
  6687. }]);
  6688. return Tab;
  6689. }();
  6690. /**
  6691. * ------------------------------------------------------------------------
  6692. * Data Api implementation
  6693. * ------------------------------------------------------------------------
  6694. */
  6695. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6696. event.preventDefault();
  6697. Tab._jQueryInterface.call($(this), 'show');
  6698. });
  6699. /**
  6700. * ------------------------------------------------------------------------
  6701. * jQuery
  6702. * ------------------------------------------------------------------------
  6703. */
  6704. $.fn[NAME$9] = Tab._jQueryInterface;
  6705. $.fn[NAME$9].Constructor = Tab;
  6706. $.fn[NAME$9].noConflict = function () {
  6707. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6708. return Tab._jQueryInterface;
  6709. };
  6710. /**
  6711. * ------------------------------------------------------------------------
  6712. * Constants
  6713. * ------------------------------------------------------------------------
  6714. */
  6715. var NAME$a = 'toast';
  6716. var VERSION$a = '4.4.1';
  6717. var DATA_KEY$a = 'bs.toast';
  6718. var EVENT_KEY$a = "." + DATA_KEY$a;
  6719. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6720. var Event$a = {
  6721. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6722. HIDE: "hide" + EVENT_KEY$a,
  6723. HIDDEN: "hidden" + EVENT_KEY$a,
  6724. SHOW: "show" + EVENT_KEY$a,
  6725. SHOWN: "shown" + EVENT_KEY$a
  6726. };
  6727. var ClassName$a = {
  6728. FADE: 'fade',
  6729. HIDE: 'hide',
  6730. SHOW: 'show',
  6731. SHOWING: 'showing'
  6732. };
  6733. var DefaultType$7 = {
  6734. animation: 'boolean',
  6735. autohide: 'boolean',
  6736. delay: 'number'
  6737. };
  6738. var Default$7 = {
  6739. animation: true,
  6740. autohide: true,
  6741. delay: 500
  6742. };
  6743. var Selector$a = {
  6744. DATA_DISMISS: '[data-dismiss="toast"]'
  6745. };
  6746. /**
  6747. * ------------------------------------------------------------------------
  6748. * Class Definition
  6749. * ------------------------------------------------------------------------
  6750. */
  6751. var Toast =
  6752. /*#__PURE__*/
  6753. function () {
  6754. function Toast(element, config) {
  6755. this._element = element;
  6756. this._config = this._getConfig(config);
  6757. this._timeout = null;
  6758. this._setListeners();
  6759. } // Getters
  6760. var _proto = Toast.prototype;
  6761. // Public
  6762. _proto.show = function show() {
  6763. var _this = this;
  6764. var showEvent = $.Event(Event$a.SHOW);
  6765. $(this._element).trigger(showEvent);
  6766. if (showEvent.isDefaultPrevented()) {
  6767. return;
  6768. }
  6769. if (this._config.animation) {
  6770. this._element.classList.add(ClassName$a.FADE);
  6771. }
  6772. var complete = function complete() {
  6773. _this._element.classList.remove(ClassName$a.SHOWING);
  6774. _this._element.classList.add(ClassName$a.SHOW);
  6775. $(_this._element).trigger(Event$a.SHOWN);
  6776. if (_this._config.autohide) {
  6777. _this._timeout = setTimeout(function () {
  6778. _this.hide();
  6779. }, _this._config.delay);
  6780. }
  6781. };
  6782. this._element.classList.remove(ClassName$a.HIDE);
  6783. Util.reflow(this._element);
  6784. this._element.classList.add(ClassName$a.SHOWING);
  6785. if (this._config.animation) {
  6786. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6787. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6788. } else {
  6789. complete();
  6790. }
  6791. };
  6792. _proto.hide = function hide() {
  6793. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6794. return;
  6795. }
  6796. var hideEvent = $.Event(Event$a.HIDE);
  6797. $(this._element).trigger(hideEvent);
  6798. if (hideEvent.isDefaultPrevented()) {
  6799. return;
  6800. }
  6801. this._close();
  6802. };
  6803. _proto.dispose = function dispose() {
  6804. clearTimeout(this._timeout);
  6805. this._timeout = null;
  6806. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6807. this._element.classList.remove(ClassName$a.SHOW);
  6808. }
  6809. $(this._element).off(Event$a.CLICK_DISMISS);
  6810. $.removeData(this._element, DATA_KEY$a);
  6811. this._element = null;
  6812. this._config = null;
  6813. } // Private
  6814. ;
  6815. _proto._getConfig = function _getConfig(config) {
  6816. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6817. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6818. return config;
  6819. };
  6820. _proto._setListeners = function _setListeners() {
  6821. var _this2 = this;
  6822. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6823. return _this2.hide();
  6824. });
  6825. };
  6826. _proto._close = function _close() {
  6827. var _this3 = this;
  6828. var complete = function complete() {
  6829. _this3._element.classList.add(ClassName$a.HIDE);
  6830. $(_this3._element).trigger(Event$a.HIDDEN);
  6831. };
  6832. this._element.classList.remove(ClassName$a.SHOW);
  6833. if (this._config.animation) {
  6834. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6835. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6836. } else {
  6837. complete();
  6838. }
  6839. } // Static
  6840. ;
  6841. Toast._jQueryInterface = function _jQueryInterface(config) {
  6842. return this.each(function () {
  6843. var $element = $(this);
  6844. var data = $element.data(DATA_KEY$a);
  6845. var _config = typeof config === 'object' && config;
  6846. if (!data) {
  6847. data = new Toast(this, _config);
  6848. $element.data(DATA_KEY$a, data);
  6849. }
  6850. if (typeof config === 'string') {
  6851. if (typeof data[config] === 'undefined') {
  6852. throw new TypeError("No method named \"" + config + "\"");
  6853. }
  6854. data[config](this);
  6855. }
  6856. });
  6857. };
  6858. _createClass(Toast, null, [{
  6859. key: "VERSION",
  6860. get: function get() {
  6861. return VERSION$a;
  6862. }
  6863. }, {
  6864. key: "DefaultType",
  6865. get: function get() {
  6866. return DefaultType$7;
  6867. }
  6868. }, {
  6869. key: "Default",
  6870. get: function get() {
  6871. return Default$7;
  6872. }
  6873. }]);
  6874. return Toast;
  6875. }();
  6876. /**
  6877. * ------------------------------------------------------------------------
  6878. * jQuery
  6879. * ------------------------------------------------------------------------
  6880. */
  6881. $.fn[NAME$a] = Toast._jQueryInterface;
  6882. $.fn[NAME$a].Constructor = Toast;
  6883. $.fn[NAME$a].noConflict = function () {
  6884. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6885. return Toast._jQueryInterface;
  6886. };
  6887. exports.Alert = Alert;
  6888. exports.Button = Button;
  6889. exports.Carousel = Carousel;
  6890. exports.Collapse = Collapse;
  6891. exports.Dropdown = Dropdown;
  6892. exports.Modal = Modal;
  6893. exports.Popover = Popover;
  6894. exports.Scrollspy = ScrollSpy;
  6895. exports.Tab = Tab;
  6896. exports.Toast = Toast;
  6897. exports.Tooltip = Tooltip;
  6898. exports.Util = Util;
  6899. Object.defineProperty(exports, '__esModule', { value: true });
  6900. })));
  6901. //# sourceMappingURL=bootstrap.js.map
  6902. /***/ }),
  6903. /***/ "./node_modules/buffer/index.js":
  6904. /*!**************************************!*\
  6905. !*** ./node_modules/buffer/index.js ***!
  6906. \**************************************/
  6907. /*! no static exports found */
  6908. /***/ (function(module, exports, __webpack_require__) {
  6909. "use strict";
  6910. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6911. * The buffer module from node.js, for the browser.
  6912. *
  6913. * @author Feross Aboukhadijeh <http://feross.org>
  6914. * @license MIT
  6915. */
  6916. /* eslint-disable no-proto */
  6917. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6918. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6919. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6920. exports.Buffer = Buffer
  6921. exports.SlowBuffer = SlowBuffer
  6922. exports.INSPECT_MAX_BYTES = 50
  6923. /**
  6924. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6925. * === true Use Uint8Array implementation (fastest)
  6926. * === false Use Object implementation (most compatible, even IE6)
  6927. *
  6928. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6929. * Opera 11.6+, iOS 4.2+.
  6930. *
  6931. * Due to various browser bugs, sometimes the Object implementation will be used even
  6932. * when the browser supports typed arrays.
  6933. *
  6934. * Note:
  6935. *
  6936. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6937. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6938. *
  6939. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6940. *
  6941. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6942. * incorrect length in some situations.
  6943. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6944. * get the Object implementation, which is slower but behaves correctly.
  6945. */
  6946. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6947. ? global.TYPED_ARRAY_SUPPORT
  6948. : typedArraySupport()
  6949. /*
  6950. * Export kMaxLength after typed array support is determined.
  6951. */
  6952. exports.kMaxLength = kMaxLength()
  6953. function typedArraySupport () {
  6954. try {
  6955. var arr = new Uint8Array(1)
  6956. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6957. return arr.foo() === 42 && // typed array instances can be augmented
  6958. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6959. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6960. } catch (e) {
  6961. return false
  6962. }
  6963. }
  6964. function kMaxLength () {
  6965. return Buffer.TYPED_ARRAY_SUPPORT
  6966. ? 0x7fffffff
  6967. : 0x3fffffff
  6968. }
  6969. function createBuffer (that, length) {
  6970. if (kMaxLength() < length) {
  6971. throw new RangeError('Invalid typed array length')
  6972. }
  6973. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6974. // Return an augmented `Uint8Array` instance, for best performance
  6975. that = new Uint8Array(length)
  6976. that.__proto__ = Buffer.prototype
  6977. } else {
  6978. // Fallback: Return an object instance of the Buffer class
  6979. if (that === null) {
  6980. that = new Buffer(length)
  6981. }
  6982. that.length = length
  6983. }
  6984. return that
  6985. }
  6986. /**
  6987. * The Buffer constructor returns instances of `Uint8Array` that have their
  6988. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6989. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6990. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6991. * returns a single octet.
  6992. *
  6993. * The `Uint8Array` prototype remains unmodified.
  6994. */
  6995. function Buffer (arg, encodingOrOffset, length) {
  6996. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6997. return new Buffer(arg, encodingOrOffset, length)
  6998. }
  6999. // Common case.
  7000. if (typeof arg === 'number') {
  7001. if (typeof encodingOrOffset === 'string') {
  7002. throw new Error(
  7003. 'If encoding is specified then the first argument must be a string'
  7004. )
  7005. }
  7006. return allocUnsafe(this, arg)
  7007. }
  7008. return from(this, arg, encodingOrOffset, length)
  7009. }
  7010. Buffer.poolSize = 8192 // not used by this implementation
  7011. // TODO: Legacy, not needed anymore. Remove in next major version.
  7012. Buffer._augment = function (arr) {
  7013. arr.__proto__ = Buffer.prototype
  7014. return arr
  7015. }
  7016. function from (that, value, encodingOrOffset, length) {
  7017. if (typeof value === 'number') {
  7018. throw new TypeError('"value" argument must not be a number')
  7019. }
  7020. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7021. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7022. }
  7023. if (typeof value === 'string') {
  7024. return fromString(that, value, encodingOrOffset)
  7025. }
  7026. return fromObject(that, value)
  7027. }
  7028. /**
  7029. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7030. * if value is a number.
  7031. * Buffer.from(str[, encoding])
  7032. * Buffer.from(array)
  7033. * Buffer.from(buffer)
  7034. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7035. **/
  7036. Buffer.from = function (value, encodingOrOffset, length) {
  7037. return from(null, value, encodingOrOffset, length)
  7038. }
  7039. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7040. Buffer.prototype.__proto__ = Uint8Array.prototype
  7041. Buffer.__proto__ = Uint8Array
  7042. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7043. Buffer[Symbol.species] === Buffer) {
  7044. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7045. Object.defineProperty(Buffer, Symbol.species, {
  7046. value: null,
  7047. configurable: true
  7048. })
  7049. }
  7050. }
  7051. function assertSize (size) {
  7052. if (typeof size !== 'number') {
  7053. throw new TypeError('"size" argument must be a number')
  7054. } else if (size < 0) {
  7055. throw new RangeError('"size" argument must not be negative')
  7056. }
  7057. }
  7058. function alloc (that, size, fill, encoding) {
  7059. assertSize(size)
  7060. if (size <= 0) {
  7061. return createBuffer(that, size)
  7062. }
  7063. if (fill !== undefined) {
  7064. // Only pay attention to encoding if it's a string. This
  7065. // prevents accidentally sending in a number that would
  7066. // be interpretted as a start offset.
  7067. return typeof encoding === 'string'
  7068. ? createBuffer(that, size).fill(fill, encoding)
  7069. : createBuffer(that, size).fill(fill)
  7070. }
  7071. return createBuffer(that, size)
  7072. }
  7073. /**
  7074. * Creates a new filled Buffer instance.
  7075. * alloc(size[, fill[, encoding]])
  7076. **/
  7077. Buffer.alloc = function (size, fill, encoding) {
  7078. return alloc(null, size, fill, encoding)
  7079. }
  7080. function allocUnsafe (that, size) {
  7081. assertSize(size)
  7082. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7083. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7084. for (var i = 0; i < size; ++i) {
  7085. that[i] = 0
  7086. }
  7087. }
  7088. return that
  7089. }
  7090. /**
  7091. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7092. * */
  7093. Buffer.allocUnsafe = function (size) {
  7094. return allocUnsafe(null, size)
  7095. }
  7096. /**
  7097. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7098. */
  7099. Buffer.allocUnsafeSlow = function (size) {
  7100. return allocUnsafe(null, size)
  7101. }
  7102. function fromString (that, string, encoding) {
  7103. if (typeof encoding !== 'string' || encoding === '') {
  7104. encoding = 'utf8'
  7105. }
  7106. if (!Buffer.isEncoding(encoding)) {
  7107. throw new TypeError('"encoding" must be a valid string encoding')
  7108. }
  7109. var length = byteLength(string, encoding) | 0
  7110. that = createBuffer(that, length)
  7111. var actual = that.write(string, encoding)
  7112. if (actual !== length) {
  7113. // Writing a hex string, for example, that contains invalid characters will
  7114. // cause everything after the first invalid character to be ignored. (e.g.
  7115. // 'abxxcd' will be treated as 'ab')
  7116. that = that.slice(0, actual)
  7117. }
  7118. return that
  7119. }
  7120. function fromArrayLike (that, array) {
  7121. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7122. that = createBuffer(that, length)
  7123. for (var i = 0; i < length; i += 1) {
  7124. that[i] = array[i] & 255
  7125. }
  7126. return that
  7127. }
  7128. function fromArrayBuffer (that, array, byteOffset, length) {
  7129. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7130. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7131. throw new RangeError('\'offset\' is out of bounds')
  7132. }
  7133. if (array.byteLength < byteOffset + (length || 0)) {
  7134. throw new RangeError('\'length\' is out of bounds')
  7135. }
  7136. if (byteOffset === undefined && length === undefined) {
  7137. array = new Uint8Array(array)
  7138. } else if (length === undefined) {
  7139. array = new Uint8Array(array, byteOffset)
  7140. } else {
  7141. array = new Uint8Array(array, byteOffset, length)
  7142. }
  7143. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7144. // Return an augmented `Uint8Array` instance, for best performance
  7145. that = array
  7146. that.__proto__ = Buffer.prototype
  7147. } else {
  7148. // Fallback: Return an object instance of the Buffer class
  7149. that = fromArrayLike(that, array)
  7150. }
  7151. return that
  7152. }
  7153. function fromObject (that, obj) {
  7154. if (Buffer.isBuffer(obj)) {
  7155. var len = checked(obj.length) | 0
  7156. that = createBuffer(that, len)
  7157. if (that.length === 0) {
  7158. return that
  7159. }
  7160. obj.copy(that, 0, 0, len)
  7161. return that
  7162. }
  7163. if (obj) {
  7164. if ((typeof ArrayBuffer !== 'undefined' &&
  7165. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7166. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7167. return createBuffer(that, 0)
  7168. }
  7169. return fromArrayLike(that, obj)
  7170. }
  7171. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7172. return fromArrayLike(that, obj.data)
  7173. }
  7174. }
  7175. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7176. }
  7177. function checked (length) {
  7178. // Note: cannot use `length < kMaxLength()` here because that fails when
  7179. // length is NaN (which is otherwise coerced to zero.)
  7180. if (length >= kMaxLength()) {
  7181. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7182. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7183. }
  7184. return length | 0
  7185. }
  7186. function SlowBuffer (length) {
  7187. if (+length != length) { // eslint-disable-line eqeqeq
  7188. length = 0
  7189. }
  7190. return Buffer.alloc(+length)
  7191. }
  7192. Buffer.isBuffer = function isBuffer (b) {
  7193. return !!(b != null && b._isBuffer)
  7194. }
  7195. Buffer.compare = function compare (a, b) {
  7196. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7197. throw new TypeError('Arguments must be Buffers')
  7198. }
  7199. if (a === b) return 0
  7200. var x = a.length
  7201. var y = b.length
  7202. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7203. if (a[i] !== b[i]) {
  7204. x = a[i]
  7205. y = b[i]
  7206. break
  7207. }
  7208. }
  7209. if (x < y) return -1
  7210. if (y < x) return 1
  7211. return 0
  7212. }
  7213. Buffer.isEncoding = function isEncoding (encoding) {
  7214. switch (String(encoding).toLowerCase()) {
  7215. case 'hex':
  7216. case 'utf8':
  7217. case 'utf-8':
  7218. case 'ascii':
  7219. case 'latin1':
  7220. case 'binary':
  7221. case 'base64':
  7222. case 'ucs2':
  7223. case 'ucs-2':
  7224. case 'utf16le':
  7225. case 'utf-16le':
  7226. return true
  7227. default:
  7228. return false
  7229. }
  7230. }
  7231. Buffer.concat = function concat (list, length) {
  7232. if (!isArray(list)) {
  7233. throw new TypeError('"list" argument must be an Array of Buffers')
  7234. }
  7235. if (list.length === 0) {
  7236. return Buffer.alloc(0)
  7237. }
  7238. var i
  7239. if (length === undefined) {
  7240. length = 0
  7241. for (i = 0; i < list.length; ++i) {
  7242. length += list[i].length
  7243. }
  7244. }
  7245. var buffer = Buffer.allocUnsafe(length)
  7246. var pos = 0
  7247. for (i = 0; i < list.length; ++i) {
  7248. var buf = list[i]
  7249. if (!Buffer.isBuffer(buf)) {
  7250. throw new TypeError('"list" argument must be an Array of Buffers')
  7251. }
  7252. buf.copy(buffer, pos)
  7253. pos += buf.length
  7254. }
  7255. return buffer
  7256. }
  7257. function byteLength (string, encoding) {
  7258. if (Buffer.isBuffer(string)) {
  7259. return string.length
  7260. }
  7261. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7262. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7263. return string.byteLength
  7264. }
  7265. if (typeof string !== 'string') {
  7266. string = '' + string
  7267. }
  7268. var len = string.length
  7269. if (len === 0) return 0
  7270. // Use a for loop to avoid recursion
  7271. var loweredCase = false
  7272. for (;;) {
  7273. switch (encoding) {
  7274. case 'ascii':
  7275. case 'latin1':
  7276. case 'binary':
  7277. return len
  7278. case 'utf8':
  7279. case 'utf-8':
  7280. case undefined:
  7281. return utf8ToBytes(string).length
  7282. case 'ucs2':
  7283. case 'ucs-2':
  7284. case 'utf16le':
  7285. case 'utf-16le':
  7286. return len * 2
  7287. case 'hex':
  7288. return len >>> 1
  7289. case 'base64':
  7290. return base64ToBytes(string).length
  7291. default:
  7292. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7293. encoding = ('' + encoding).toLowerCase()
  7294. loweredCase = true
  7295. }
  7296. }
  7297. }
  7298. Buffer.byteLength = byteLength
  7299. function slowToString (encoding, start, end) {
  7300. var loweredCase = false
  7301. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7302. // property of a typed array.
  7303. // This behaves neither like String nor Uint8Array in that we set start/end
  7304. // to their upper/lower bounds if the value passed is out of range.
  7305. // undefined is handled specially as per ECMA-262 6th Edition,
  7306. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7307. if (start === undefined || start < 0) {
  7308. start = 0
  7309. }
  7310. // Return early if start > this.length. Done here to prevent potential uint32
  7311. // coercion fail below.
  7312. if (start > this.length) {
  7313. return ''
  7314. }
  7315. if (end === undefined || end > this.length) {
  7316. end = this.length
  7317. }
  7318. if (end <= 0) {
  7319. return ''
  7320. }
  7321. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7322. end >>>= 0
  7323. start >>>= 0
  7324. if (end <= start) {
  7325. return ''
  7326. }
  7327. if (!encoding) encoding = 'utf8'
  7328. while (true) {
  7329. switch (encoding) {
  7330. case 'hex':
  7331. return hexSlice(this, start, end)
  7332. case 'utf8':
  7333. case 'utf-8':
  7334. return utf8Slice(this, start, end)
  7335. case 'ascii':
  7336. return asciiSlice(this, start, end)
  7337. case 'latin1':
  7338. case 'binary':
  7339. return latin1Slice(this, start, end)
  7340. case 'base64':
  7341. return base64Slice(this, start, end)
  7342. case 'ucs2':
  7343. case 'ucs-2':
  7344. case 'utf16le':
  7345. case 'utf-16le':
  7346. return utf16leSlice(this, start, end)
  7347. default:
  7348. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7349. encoding = (encoding + '').toLowerCase()
  7350. loweredCase = true
  7351. }
  7352. }
  7353. }
  7354. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7355. // Buffer instances.
  7356. Buffer.prototype._isBuffer = true
  7357. function swap (b, n, m) {
  7358. var i = b[n]
  7359. b[n] = b[m]
  7360. b[m] = i
  7361. }
  7362. Buffer.prototype.swap16 = function swap16 () {
  7363. var len = this.length
  7364. if (len % 2 !== 0) {
  7365. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7366. }
  7367. for (var i = 0; i < len; i += 2) {
  7368. swap(this, i, i + 1)
  7369. }
  7370. return this
  7371. }
  7372. Buffer.prototype.swap32 = function swap32 () {
  7373. var len = this.length
  7374. if (len % 4 !== 0) {
  7375. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7376. }
  7377. for (var i = 0; i < len; i += 4) {
  7378. swap(this, i, i + 3)
  7379. swap(this, i + 1, i + 2)
  7380. }
  7381. return this
  7382. }
  7383. Buffer.prototype.swap64 = function swap64 () {
  7384. var len = this.length
  7385. if (len % 8 !== 0) {
  7386. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7387. }
  7388. for (var i = 0; i < len; i += 8) {
  7389. swap(this, i, i + 7)
  7390. swap(this, i + 1, i + 6)
  7391. swap(this, i + 2, i + 5)
  7392. swap(this, i + 3, i + 4)
  7393. }
  7394. return this
  7395. }
  7396. Buffer.prototype.toString = function toString () {
  7397. var length = this.length | 0
  7398. if (length === 0) return ''
  7399. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7400. return slowToString.apply(this, arguments)
  7401. }
  7402. Buffer.prototype.equals = function equals (b) {
  7403. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7404. if (this === b) return true
  7405. return Buffer.compare(this, b) === 0
  7406. }
  7407. Buffer.prototype.inspect = function inspect () {
  7408. var str = ''
  7409. var max = exports.INSPECT_MAX_BYTES
  7410. if (this.length > 0) {
  7411. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7412. if (this.length > max) str += ' ... '
  7413. }
  7414. return '<Buffer ' + str + '>'
  7415. }
  7416. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7417. if (!Buffer.isBuffer(target)) {
  7418. throw new TypeError('Argument must be a Buffer')
  7419. }
  7420. if (start === undefined) {
  7421. start = 0
  7422. }
  7423. if (end === undefined) {
  7424. end = target ? target.length : 0
  7425. }
  7426. if (thisStart === undefined) {
  7427. thisStart = 0
  7428. }
  7429. if (thisEnd === undefined) {
  7430. thisEnd = this.length
  7431. }
  7432. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7433. throw new RangeError('out of range index')
  7434. }
  7435. if (thisStart >= thisEnd && start >= end) {
  7436. return 0
  7437. }
  7438. if (thisStart >= thisEnd) {
  7439. return -1
  7440. }
  7441. if (start >= end) {
  7442. return 1
  7443. }
  7444. start >>>= 0
  7445. end >>>= 0
  7446. thisStart >>>= 0
  7447. thisEnd >>>= 0
  7448. if (this === target) return 0
  7449. var x = thisEnd - thisStart
  7450. var y = end - start
  7451. var len = Math.min(x, y)
  7452. var thisCopy = this.slice(thisStart, thisEnd)
  7453. var targetCopy = target.slice(start, end)
  7454. for (var i = 0; i < len; ++i) {
  7455. if (thisCopy[i] !== targetCopy[i]) {
  7456. x = thisCopy[i]
  7457. y = targetCopy[i]
  7458. break
  7459. }
  7460. }
  7461. if (x < y) return -1
  7462. if (y < x) return 1
  7463. return 0
  7464. }
  7465. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7466. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7467. //
  7468. // Arguments:
  7469. // - buffer - a Buffer to search
  7470. // - val - a string, Buffer, or number
  7471. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7472. // - encoding - an optional encoding, relevant is val is a string
  7473. // - dir - true for indexOf, false for lastIndexOf
  7474. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7475. // Empty buffer means no match
  7476. if (buffer.length === 0) return -1
  7477. // Normalize byteOffset
  7478. if (typeof byteOffset === 'string') {
  7479. encoding = byteOffset
  7480. byteOffset = 0
  7481. } else if (byteOffset > 0x7fffffff) {
  7482. byteOffset = 0x7fffffff
  7483. } else if (byteOffset < -0x80000000) {
  7484. byteOffset = -0x80000000
  7485. }
  7486. byteOffset = +byteOffset // Coerce to Number.
  7487. if (isNaN(byteOffset)) {
  7488. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7489. byteOffset = dir ? 0 : (buffer.length - 1)
  7490. }
  7491. // Normalize byteOffset: negative offsets start from the end of the buffer
  7492. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7493. if (byteOffset >= buffer.length) {
  7494. if (dir) return -1
  7495. else byteOffset = buffer.length - 1
  7496. } else if (byteOffset < 0) {
  7497. if (dir) byteOffset = 0
  7498. else return -1
  7499. }
  7500. // Normalize val
  7501. if (typeof val === 'string') {
  7502. val = Buffer.from(val, encoding)
  7503. }
  7504. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7505. if (Buffer.isBuffer(val)) {
  7506. // Special case: looking for empty string/buffer always fails
  7507. if (val.length === 0) {
  7508. return -1
  7509. }
  7510. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7511. } else if (typeof val === 'number') {
  7512. val = val & 0xFF // Search for a byte value [0-255]
  7513. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7514. typeof Uint8Array.prototype.indexOf === 'function') {
  7515. if (dir) {
  7516. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7517. } else {
  7518. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7519. }
  7520. }
  7521. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7522. }
  7523. throw new TypeError('val must be string, number or Buffer')
  7524. }
  7525. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7526. var indexSize = 1
  7527. var arrLength = arr.length
  7528. var valLength = val.length
  7529. if (encoding !== undefined) {
  7530. encoding = String(encoding).toLowerCase()
  7531. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7532. encoding === 'utf16le' || encoding === 'utf-16le') {
  7533. if (arr.length < 2 || val.length < 2) {
  7534. return -1
  7535. }
  7536. indexSize = 2
  7537. arrLength /= 2
  7538. valLength /= 2
  7539. byteOffset /= 2
  7540. }
  7541. }
  7542. function read (buf, i) {
  7543. if (indexSize === 1) {
  7544. return buf[i]
  7545. } else {
  7546. return buf.readUInt16BE(i * indexSize)
  7547. }
  7548. }
  7549. var i
  7550. if (dir) {
  7551. var foundIndex = -1
  7552. for (i = byteOffset; i < arrLength; i++) {
  7553. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7554. if (foundIndex === -1) foundIndex = i
  7555. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7556. } else {
  7557. if (foundIndex !== -1) i -= i - foundIndex
  7558. foundIndex = -1
  7559. }
  7560. }
  7561. } else {
  7562. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7563. for (i = byteOffset; i >= 0; i--) {
  7564. var found = true
  7565. for (var j = 0; j < valLength; j++) {
  7566. if (read(arr, i + j) !== read(val, j)) {
  7567. found = false
  7568. break
  7569. }
  7570. }
  7571. if (found) return i
  7572. }
  7573. }
  7574. return -1
  7575. }
  7576. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7577. return this.indexOf(val, byteOffset, encoding) !== -1
  7578. }
  7579. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7580. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7581. }
  7582. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7583. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7584. }
  7585. function hexWrite (buf, string, offset, length) {
  7586. offset = Number(offset) || 0
  7587. var remaining = buf.length - offset
  7588. if (!length) {
  7589. length = remaining
  7590. } else {
  7591. length = Number(length)
  7592. if (length > remaining) {
  7593. length = remaining
  7594. }
  7595. }
  7596. // must be an even number of digits
  7597. var strLen = string.length
  7598. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7599. if (length > strLen / 2) {
  7600. length = strLen / 2
  7601. }
  7602. for (var i = 0; i < length; ++i) {
  7603. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7604. if (isNaN(parsed)) return i
  7605. buf[offset + i] = parsed
  7606. }
  7607. return i
  7608. }
  7609. function utf8Write (buf, string, offset, length) {
  7610. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7611. }
  7612. function asciiWrite (buf, string, offset, length) {
  7613. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7614. }
  7615. function latin1Write (buf, string, offset, length) {
  7616. return asciiWrite(buf, string, offset, length)
  7617. }
  7618. function base64Write (buf, string, offset, length) {
  7619. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7620. }
  7621. function ucs2Write (buf, string, offset, length) {
  7622. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7623. }
  7624. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7625. // Buffer#write(string)
  7626. if (offset === undefined) {
  7627. encoding = 'utf8'
  7628. length = this.length
  7629. offset = 0
  7630. // Buffer#write(string, encoding)
  7631. } else if (length === undefined && typeof offset === 'string') {
  7632. encoding = offset
  7633. length = this.length
  7634. offset = 0
  7635. // Buffer#write(string, offset[, length][, encoding])
  7636. } else if (isFinite(offset)) {
  7637. offset = offset | 0
  7638. if (isFinite(length)) {
  7639. length = length | 0
  7640. if (encoding === undefined) encoding = 'utf8'
  7641. } else {
  7642. encoding = length
  7643. length = undefined
  7644. }
  7645. // legacy write(string, encoding, offset, length) - remove in v0.13
  7646. } else {
  7647. throw new Error(
  7648. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7649. )
  7650. }
  7651. var remaining = this.length - offset
  7652. if (length === undefined || length > remaining) length = remaining
  7653. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7654. throw new RangeError('Attempt to write outside buffer bounds')
  7655. }
  7656. if (!encoding) encoding = 'utf8'
  7657. var loweredCase = false
  7658. for (;;) {
  7659. switch (encoding) {
  7660. case 'hex':
  7661. return hexWrite(this, string, offset, length)
  7662. case 'utf8':
  7663. case 'utf-8':
  7664. return utf8Write(this, string, offset, length)
  7665. case 'ascii':
  7666. return asciiWrite(this, string, offset, length)
  7667. case 'latin1':
  7668. case 'binary':
  7669. return latin1Write(this, string, offset, length)
  7670. case 'base64':
  7671. // Warning: maxLength not taken into account in base64Write
  7672. return base64Write(this, string, offset, length)
  7673. case 'ucs2':
  7674. case 'ucs-2':
  7675. case 'utf16le':
  7676. case 'utf-16le':
  7677. return ucs2Write(this, string, offset, length)
  7678. default:
  7679. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7680. encoding = ('' + encoding).toLowerCase()
  7681. loweredCase = true
  7682. }
  7683. }
  7684. }
  7685. Buffer.prototype.toJSON = function toJSON () {
  7686. return {
  7687. type: 'Buffer',
  7688. data: Array.prototype.slice.call(this._arr || this, 0)
  7689. }
  7690. }
  7691. function base64Slice (buf, start, end) {
  7692. if (start === 0 && end === buf.length) {
  7693. return base64.fromByteArray(buf)
  7694. } else {
  7695. return base64.fromByteArray(buf.slice(start, end))
  7696. }
  7697. }
  7698. function utf8Slice (buf, start, end) {
  7699. end = Math.min(buf.length, end)
  7700. var res = []
  7701. var i = start
  7702. while (i < end) {
  7703. var firstByte = buf[i]
  7704. var codePoint = null
  7705. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7706. : (firstByte > 0xDF) ? 3
  7707. : (firstByte > 0xBF) ? 2
  7708. : 1
  7709. if (i + bytesPerSequence <= end) {
  7710. var secondByte, thirdByte, fourthByte, tempCodePoint
  7711. switch (bytesPerSequence) {
  7712. case 1:
  7713. if (firstByte < 0x80) {
  7714. codePoint = firstByte
  7715. }
  7716. break
  7717. case 2:
  7718. secondByte = buf[i + 1]
  7719. if ((secondByte & 0xC0) === 0x80) {
  7720. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7721. if (tempCodePoint > 0x7F) {
  7722. codePoint = tempCodePoint
  7723. }
  7724. }
  7725. break
  7726. case 3:
  7727. secondByte = buf[i + 1]
  7728. thirdByte = buf[i + 2]
  7729. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7730. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7731. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7732. codePoint = tempCodePoint
  7733. }
  7734. }
  7735. break
  7736. case 4:
  7737. secondByte = buf[i + 1]
  7738. thirdByte = buf[i + 2]
  7739. fourthByte = buf[i + 3]
  7740. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7741. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7742. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7743. codePoint = tempCodePoint
  7744. }
  7745. }
  7746. }
  7747. }
  7748. if (codePoint === null) {
  7749. // we did not generate a valid codePoint so insert a
  7750. // replacement char (U+FFFD) and advance only 1 byte
  7751. codePoint = 0xFFFD
  7752. bytesPerSequence = 1
  7753. } else if (codePoint > 0xFFFF) {
  7754. // encode to utf16 (surrogate pair dance)
  7755. codePoint -= 0x10000
  7756. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7757. codePoint = 0xDC00 | codePoint & 0x3FF
  7758. }
  7759. res.push(codePoint)
  7760. i += bytesPerSequence
  7761. }
  7762. return decodeCodePointsArray(res)
  7763. }
  7764. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7765. // the lowest limit is Chrome, with 0x10000 args.
  7766. // We go 1 magnitude less, for safety
  7767. var MAX_ARGUMENTS_LENGTH = 0x1000
  7768. function decodeCodePointsArray (codePoints) {
  7769. var len = codePoints.length
  7770. if (len <= MAX_ARGUMENTS_LENGTH) {
  7771. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7772. }
  7773. // Decode in chunks to avoid "call stack size exceeded".
  7774. var res = ''
  7775. var i = 0
  7776. while (i < len) {
  7777. res += String.fromCharCode.apply(
  7778. String,
  7779. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7780. )
  7781. }
  7782. return res
  7783. }
  7784. function asciiSlice (buf, start, end) {
  7785. var ret = ''
  7786. end = Math.min(buf.length, end)
  7787. for (var i = start; i < end; ++i) {
  7788. ret += String.fromCharCode(buf[i] & 0x7F)
  7789. }
  7790. return ret
  7791. }
  7792. function latin1Slice (buf, start, end) {
  7793. var ret = ''
  7794. end = Math.min(buf.length, end)
  7795. for (var i = start; i < end; ++i) {
  7796. ret += String.fromCharCode(buf[i])
  7797. }
  7798. return ret
  7799. }
  7800. function hexSlice (buf, start, end) {
  7801. var len = buf.length
  7802. if (!start || start < 0) start = 0
  7803. if (!end || end < 0 || end > len) end = len
  7804. var out = ''
  7805. for (var i = start; i < end; ++i) {
  7806. out += toHex(buf[i])
  7807. }
  7808. return out
  7809. }
  7810. function utf16leSlice (buf, start, end) {
  7811. var bytes = buf.slice(start, end)
  7812. var res = ''
  7813. for (var i = 0; i < bytes.length; i += 2) {
  7814. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7815. }
  7816. return res
  7817. }
  7818. Buffer.prototype.slice = function slice (start, end) {
  7819. var len = this.length
  7820. start = ~~start
  7821. end = end === undefined ? len : ~~end
  7822. if (start < 0) {
  7823. start += len
  7824. if (start < 0) start = 0
  7825. } else if (start > len) {
  7826. start = len
  7827. }
  7828. if (end < 0) {
  7829. end += len
  7830. if (end < 0) end = 0
  7831. } else if (end > len) {
  7832. end = len
  7833. }
  7834. if (end < start) end = start
  7835. var newBuf
  7836. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7837. newBuf = this.subarray(start, end)
  7838. newBuf.__proto__ = Buffer.prototype
  7839. } else {
  7840. var sliceLen = end - start
  7841. newBuf = new Buffer(sliceLen, undefined)
  7842. for (var i = 0; i < sliceLen; ++i) {
  7843. newBuf[i] = this[i + start]
  7844. }
  7845. }
  7846. return newBuf
  7847. }
  7848. /*
  7849. * Need to make sure that buffer isn't trying to write out of bounds.
  7850. */
  7851. function checkOffset (offset, ext, length) {
  7852. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7853. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7854. }
  7855. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7856. offset = offset | 0
  7857. byteLength = byteLength | 0
  7858. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7859. var val = this[offset]
  7860. var mul = 1
  7861. var i = 0
  7862. while (++i < byteLength && (mul *= 0x100)) {
  7863. val += this[offset + i] * mul
  7864. }
  7865. return val
  7866. }
  7867. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7868. offset = offset | 0
  7869. byteLength = byteLength | 0
  7870. if (!noAssert) {
  7871. checkOffset(offset, byteLength, this.length)
  7872. }
  7873. var val = this[offset + --byteLength]
  7874. var mul = 1
  7875. while (byteLength > 0 && (mul *= 0x100)) {
  7876. val += this[offset + --byteLength] * mul
  7877. }
  7878. return val
  7879. }
  7880. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7881. if (!noAssert) checkOffset(offset, 1, this.length)
  7882. return this[offset]
  7883. }
  7884. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7885. if (!noAssert) checkOffset(offset, 2, this.length)
  7886. return this[offset] | (this[offset + 1] << 8)
  7887. }
  7888. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7889. if (!noAssert) checkOffset(offset, 2, this.length)
  7890. return (this[offset] << 8) | this[offset + 1]
  7891. }
  7892. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7893. if (!noAssert) checkOffset(offset, 4, this.length)
  7894. return ((this[offset]) |
  7895. (this[offset + 1] << 8) |
  7896. (this[offset + 2] << 16)) +
  7897. (this[offset + 3] * 0x1000000)
  7898. }
  7899. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7900. if (!noAssert) checkOffset(offset, 4, this.length)
  7901. return (this[offset] * 0x1000000) +
  7902. ((this[offset + 1] << 16) |
  7903. (this[offset + 2] << 8) |
  7904. this[offset + 3])
  7905. }
  7906. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7907. offset = offset | 0
  7908. byteLength = byteLength | 0
  7909. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7910. var val = this[offset]
  7911. var mul = 1
  7912. var i = 0
  7913. while (++i < byteLength && (mul *= 0x100)) {
  7914. val += this[offset + i] * mul
  7915. }
  7916. mul *= 0x80
  7917. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7918. return val
  7919. }
  7920. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7921. offset = offset | 0
  7922. byteLength = byteLength | 0
  7923. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7924. var i = byteLength
  7925. var mul = 1
  7926. var val = this[offset + --i]
  7927. while (i > 0 && (mul *= 0x100)) {
  7928. val += this[offset + --i] * mul
  7929. }
  7930. mul *= 0x80
  7931. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7932. return val
  7933. }
  7934. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7935. if (!noAssert) checkOffset(offset, 1, this.length)
  7936. if (!(this[offset] & 0x80)) return (this[offset])
  7937. return ((0xff - this[offset] + 1) * -1)
  7938. }
  7939. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7940. if (!noAssert) checkOffset(offset, 2, this.length)
  7941. var val = this[offset] | (this[offset + 1] << 8)
  7942. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7943. }
  7944. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7945. if (!noAssert) checkOffset(offset, 2, this.length)
  7946. var val = this[offset + 1] | (this[offset] << 8)
  7947. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7948. }
  7949. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7950. if (!noAssert) checkOffset(offset, 4, this.length)
  7951. return (this[offset]) |
  7952. (this[offset + 1] << 8) |
  7953. (this[offset + 2] << 16) |
  7954. (this[offset + 3] << 24)
  7955. }
  7956. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7957. if (!noAssert) checkOffset(offset, 4, this.length)
  7958. return (this[offset] << 24) |
  7959. (this[offset + 1] << 16) |
  7960. (this[offset + 2] << 8) |
  7961. (this[offset + 3])
  7962. }
  7963. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7964. if (!noAssert) checkOffset(offset, 4, this.length)
  7965. return ieee754.read(this, offset, true, 23, 4)
  7966. }
  7967. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7968. if (!noAssert) checkOffset(offset, 4, this.length)
  7969. return ieee754.read(this, offset, false, 23, 4)
  7970. }
  7971. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7972. if (!noAssert) checkOffset(offset, 8, this.length)
  7973. return ieee754.read(this, offset, true, 52, 8)
  7974. }
  7975. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7976. if (!noAssert) checkOffset(offset, 8, this.length)
  7977. return ieee754.read(this, offset, false, 52, 8)
  7978. }
  7979. function checkInt (buf, value, offset, ext, max, min) {
  7980. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7981. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7982. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7983. }
  7984. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7985. value = +value
  7986. offset = offset | 0
  7987. byteLength = byteLength | 0
  7988. if (!noAssert) {
  7989. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7990. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7991. }
  7992. var mul = 1
  7993. var i = 0
  7994. this[offset] = value & 0xFF
  7995. while (++i < byteLength && (mul *= 0x100)) {
  7996. this[offset + i] = (value / mul) & 0xFF
  7997. }
  7998. return offset + byteLength
  7999. }
  8000. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8001. value = +value
  8002. offset = offset | 0
  8003. byteLength = byteLength | 0
  8004. if (!noAssert) {
  8005. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8006. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8007. }
  8008. var i = byteLength - 1
  8009. var mul = 1
  8010. this[offset + i] = value & 0xFF
  8011. while (--i >= 0 && (mul *= 0x100)) {
  8012. this[offset + i] = (value / mul) & 0xFF
  8013. }
  8014. return offset + byteLength
  8015. }
  8016. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8017. value = +value
  8018. offset = offset | 0
  8019. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8020. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8021. this[offset] = (value & 0xff)
  8022. return offset + 1
  8023. }
  8024. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8025. if (value < 0) value = 0xffff + value + 1
  8026. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8027. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8028. (littleEndian ? i : 1 - i) * 8
  8029. }
  8030. }
  8031. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8032. value = +value
  8033. offset = offset | 0
  8034. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8035. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8036. this[offset] = (value & 0xff)
  8037. this[offset + 1] = (value >>> 8)
  8038. } else {
  8039. objectWriteUInt16(this, value, offset, true)
  8040. }
  8041. return offset + 2
  8042. }
  8043. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8044. value = +value
  8045. offset = offset | 0
  8046. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8047. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8048. this[offset] = (value >>> 8)
  8049. this[offset + 1] = (value & 0xff)
  8050. } else {
  8051. objectWriteUInt16(this, value, offset, false)
  8052. }
  8053. return offset + 2
  8054. }
  8055. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8056. if (value < 0) value = 0xffffffff + value + 1
  8057. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8058. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8059. }
  8060. }
  8061. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8062. value = +value
  8063. offset = offset | 0
  8064. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8065. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8066. this[offset + 3] = (value >>> 24)
  8067. this[offset + 2] = (value >>> 16)
  8068. this[offset + 1] = (value >>> 8)
  8069. this[offset] = (value & 0xff)
  8070. } else {
  8071. objectWriteUInt32(this, value, offset, true)
  8072. }
  8073. return offset + 4
  8074. }
  8075. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8076. value = +value
  8077. offset = offset | 0
  8078. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8079. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8080. this[offset] = (value >>> 24)
  8081. this[offset + 1] = (value >>> 16)
  8082. this[offset + 2] = (value >>> 8)
  8083. this[offset + 3] = (value & 0xff)
  8084. } else {
  8085. objectWriteUInt32(this, value, offset, false)
  8086. }
  8087. return offset + 4
  8088. }
  8089. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8090. value = +value
  8091. offset = offset | 0
  8092. if (!noAssert) {
  8093. var limit = Math.pow(2, 8 * byteLength - 1)
  8094. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8095. }
  8096. var i = 0
  8097. var mul = 1
  8098. var sub = 0
  8099. this[offset] = value & 0xFF
  8100. while (++i < byteLength && (mul *= 0x100)) {
  8101. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8102. sub = 1
  8103. }
  8104. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8105. }
  8106. return offset + byteLength
  8107. }
  8108. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8109. value = +value
  8110. offset = offset | 0
  8111. if (!noAssert) {
  8112. var limit = Math.pow(2, 8 * byteLength - 1)
  8113. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8114. }
  8115. var i = byteLength - 1
  8116. var mul = 1
  8117. var sub = 0
  8118. this[offset + i] = value & 0xFF
  8119. while (--i >= 0 && (mul *= 0x100)) {
  8120. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8121. sub = 1
  8122. }
  8123. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8124. }
  8125. return offset + byteLength
  8126. }
  8127. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8128. value = +value
  8129. offset = offset | 0
  8130. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8131. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8132. if (value < 0) value = 0xff + value + 1
  8133. this[offset] = (value & 0xff)
  8134. return offset + 1
  8135. }
  8136. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8137. value = +value
  8138. offset = offset | 0
  8139. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8140. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8141. this[offset] = (value & 0xff)
  8142. this[offset + 1] = (value >>> 8)
  8143. } else {
  8144. objectWriteUInt16(this, value, offset, true)
  8145. }
  8146. return offset + 2
  8147. }
  8148. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8149. value = +value
  8150. offset = offset | 0
  8151. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8152. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8153. this[offset] = (value >>> 8)
  8154. this[offset + 1] = (value & 0xff)
  8155. } else {
  8156. objectWriteUInt16(this, value, offset, false)
  8157. }
  8158. return offset + 2
  8159. }
  8160. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8161. value = +value
  8162. offset = offset | 0
  8163. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8164. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8165. this[offset] = (value & 0xff)
  8166. this[offset + 1] = (value >>> 8)
  8167. this[offset + 2] = (value >>> 16)
  8168. this[offset + 3] = (value >>> 24)
  8169. } else {
  8170. objectWriteUInt32(this, value, offset, true)
  8171. }
  8172. return offset + 4
  8173. }
  8174. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8175. value = +value
  8176. offset = offset | 0
  8177. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8178. if (value < 0) value = 0xffffffff + value + 1
  8179. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8180. this[offset] = (value >>> 24)
  8181. this[offset + 1] = (value >>> 16)
  8182. this[offset + 2] = (value >>> 8)
  8183. this[offset + 3] = (value & 0xff)
  8184. } else {
  8185. objectWriteUInt32(this, value, offset, false)
  8186. }
  8187. return offset + 4
  8188. }
  8189. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8190. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8191. if (offset < 0) throw new RangeError('Index out of range')
  8192. }
  8193. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8194. if (!noAssert) {
  8195. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8196. }
  8197. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8198. return offset + 4
  8199. }
  8200. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8201. return writeFloat(this, value, offset, true, noAssert)
  8202. }
  8203. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8204. return writeFloat(this, value, offset, false, noAssert)
  8205. }
  8206. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8207. if (!noAssert) {
  8208. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8209. }
  8210. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8211. return offset + 8
  8212. }
  8213. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8214. return writeDouble(this, value, offset, true, noAssert)
  8215. }
  8216. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8217. return writeDouble(this, value, offset, false, noAssert)
  8218. }
  8219. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8220. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8221. if (!start) start = 0
  8222. if (!end && end !== 0) end = this.length
  8223. if (targetStart >= target.length) targetStart = target.length
  8224. if (!targetStart) targetStart = 0
  8225. if (end > 0 && end < start) end = start
  8226. // Copy 0 bytes; we're done
  8227. if (end === start) return 0
  8228. if (target.length === 0 || this.length === 0) return 0
  8229. // Fatal error conditions
  8230. if (targetStart < 0) {
  8231. throw new RangeError('targetStart out of bounds')
  8232. }
  8233. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8234. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8235. // Are we oob?
  8236. if (end > this.length) end = this.length
  8237. if (target.length - targetStart < end - start) {
  8238. end = target.length - targetStart + start
  8239. }
  8240. var len = end - start
  8241. var i
  8242. if (this === target && start < targetStart && targetStart < end) {
  8243. // descending copy from end
  8244. for (i = len - 1; i >= 0; --i) {
  8245. target[i + targetStart] = this[i + start]
  8246. }
  8247. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8248. // ascending copy from start
  8249. for (i = 0; i < len; ++i) {
  8250. target[i + targetStart] = this[i + start]
  8251. }
  8252. } else {
  8253. Uint8Array.prototype.set.call(
  8254. target,
  8255. this.subarray(start, start + len),
  8256. targetStart
  8257. )
  8258. }
  8259. return len
  8260. }
  8261. // Usage:
  8262. // buffer.fill(number[, offset[, end]])
  8263. // buffer.fill(buffer[, offset[, end]])
  8264. // buffer.fill(string[, offset[, end]][, encoding])
  8265. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8266. // Handle string cases:
  8267. if (typeof val === 'string') {
  8268. if (typeof start === 'string') {
  8269. encoding = start
  8270. start = 0
  8271. end = this.length
  8272. } else if (typeof end === 'string') {
  8273. encoding = end
  8274. end = this.length
  8275. }
  8276. if (val.length === 1) {
  8277. var code = val.charCodeAt(0)
  8278. if (code < 256) {
  8279. val = code
  8280. }
  8281. }
  8282. if (encoding !== undefined && typeof encoding !== 'string') {
  8283. throw new TypeError('encoding must be a string')
  8284. }
  8285. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8286. throw new TypeError('Unknown encoding: ' + encoding)
  8287. }
  8288. } else if (typeof val === 'number') {
  8289. val = val & 255
  8290. }
  8291. // Invalid ranges are not set to a default, so can range check early.
  8292. if (start < 0 || this.length < start || this.length < end) {
  8293. throw new RangeError('Out of range index')
  8294. }
  8295. if (end <= start) {
  8296. return this
  8297. }
  8298. start = start >>> 0
  8299. end = end === undefined ? this.length : end >>> 0
  8300. if (!val) val = 0
  8301. var i
  8302. if (typeof val === 'number') {
  8303. for (i = start; i < end; ++i) {
  8304. this[i] = val
  8305. }
  8306. } else {
  8307. var bytes = Buffer.isBuffer(val)
  8308. ? val
  8309. : utf8ToBytes(new Buffer(val, encoding).toString())
  8310. var len = bytes.length
  8311. for (i = 0; i < end - start; ++i) {
  8312. this[i + start] = bytes[i % len]
  8313. }
  8314. }
  8315. return this
  8316. }
  8317. // HELPER FUNCTIONS
  8318. // ================
  8319. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8320. function base64clean (str) {
  8321. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8322. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8323. // Node converts strings with length < 2 to ''
  8324. if (str.length < 2) return ''
  8325. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8326. while (str.length % 4 !== 0) {
  8327. str = str + '='
  8328. }
  8329. return str
  8330. }
  8331. function stringtrim (str) {
  8332. if (str.trim) return str.trim()
  8333. return str.replace(/^\s+|\s+$/g, '')
  8334. }
  8335. function toHex (n) {
  8336. if (n < 16) return '0' + n.toString(16)
  8337. return n.toString(16)
  8338. }
  8339. function utf8ToBytes (string, units) {
  8340. units = units || Infinity
  8341. var codePoint
  8342. var length = string.length
  8343. var leadSurrogate = null
  8344. var bytes = []
  8345. for (var i = 0; i < length; ++i) {
  8346. codePoint = string.charCodeAt(i)
  8347. // is surrogate component
  8348. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8349. // last char was a lead
  8350. if (!leadSurrogate) {
  8351. // no lead yet
  8352. if (codePoint > 0xDBFF) {
  8353. // unexpected trail
  8354. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8355. continue
  8356. } else if (i + 1 === length) {
  8357. // unpaired lead
  8358. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8359. continue
  8360. }
  8361. // valid lead
  8362. leadSurrogate = codePoint
  8363. continue
  8364. }
  8365. // 2 leads in a row
  8366. if (codePoint < 0xDC00) {
  8367. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8368. leadSurrogate = codePoint
  8369. continue
  8370. }
  8371. // valid surrogate pair
  8372. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8373. } else if (leadSurrogate) {
  8374. // valid bmp char, but last char was a lead
  8375. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8376. }
  8377. leadSurrogate = null
  8378. // encode utf8
  8379. if (codePoint < 0x80) {
  8380. if ((units -= 1) < 0) break
  8381. bytes.push(codePoint)
  8382. } else if (codePoint < 0x800) {
  8383. if ((units -= 2) < 0) break
  8384. bytes.push(
  8385. codePoint >> 0x6 | 0xC0,
  8386. codePoint & 0x3F | 0x80
  8387. )
  8388. } else if (codePoint < 0x10000) {
  8389. if ((units -= 3) < 0) break
  8390. bytes.push(
  8391. codePoint >> 0xC | 0xE0,
  8392. codePoint >> 0x6 & 0x3F | 0x80,
  8393. codePoint & 0x3F | 0x80
  8394. )
  8395. } else if (codePoint < 0x110000) {
  8396. if ((units -= 4) < 0) break
  8397. bytes.push(
  8398. codePoint >> 0x12 | 0xF0,
  8399. codePoint >> 0xC & 0x3F | 0x80,
  8400. codePoint >> 0x6 & 0x3F | 0x80,
  8401. codePoint & 0x3F | 0x80
  8402. )
  8403. } else {
  8404. throw new Error('Invalid code point')
  8405. }
  8406. }
  8407. return bytes
  8408. }
  8409. function asciiToBytes (str) {
  8410. var byteArray = []
  8411. for (var i = 0; i < str.length; ++i) {
  8412. // Node's code seems to be doing this and not & 0x7F..
  8413. byteArray.push(str.charCodeAt(i) & 0xFF)
  8414. }
  8415. return byteArray
  8416. }
  8417. function utf16leToBytes (str, units) {
  8418. var c, hi, lo
  8419. var byteArray = []
  8420. for (var i = 0; i < str.length; ++i) {
  8421. if ((units -= 2) < 0) break
  8422. c = str.charCodeAt(i)
  8423. hi = c >> 8
  8424. lo = c % 256
  8425. byteArray.push(lo)
  8426. byteArray.push(hi)
  8427. }
  8428. return byteArray
  8429. }
  8430. function base64ToBytes (str) {
  8431. return base64.toByteArray(base64clean(str))
  8432. }
  8433. function blitBuffer (src, dst, offset, length) {
  8434. for (var i = 0; i < length; ++i) {
  8435. if ((i + offset >= dst.length) || (i >= src.length)) break
  8436. dst[i + offset] = src[i]
  8437. }
  8438. return i
  8439. }
  8440. function isnan (val) {
  8441. return val !== val // eslint-disable-line no-self-compare
  8442. }
  8443. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8444. /***/ }),
  8445. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8446. /*!**************************************************!*\
  8447. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8448. \**************************************************/
  8449. /*! no static exports found */
  8450. /***/ (function(module, exports, __webpack_require__) {
  8451. /*!
  8452. * clipboard.js v2.0.4
  8453. * https://zenorocha.github.io/clipboard.js
  8454. *
  8455. * Licensed MIT © Zeno Rocha
  8456. */
  8457. (function webpackUniversalModuleDefinition(root, factory) {
  8458. if(true)
  8459. module.exports = factory();
  8460. else {}
  8461. })(this, function() {
  8462. return /******/ (function(modules) { // webpackBootstrap
  8463. /******/ // The module cache
  8464. /******/ var installedModules = {};
  8465. /******/
  8466. /******/ // The require function
  8467. /******/ function __webpack_require__(moduleId) {
  8468. /******/
  8469. /******/ // Check if module is in cache
  8470. /******/ if(installedModules[moduleId]) {
  8471. /******/ return installedModules[moduleId].exports;
  8472. /******/ }
  8473. /******/ // Create a new module (and put it into the cache)
  8474. /******/ var module = installedModules[moduleId] = {
  8475. /******/ i: moduleId,
  8476. /******/ l: false,
  8477. /******/ exports: {}
  8478. /******/ };
  8479. /******/
  8480. /******/ // Execute the module function
  8481. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8482. /******/
  8483. /******/ // Flag the module as loaded
  8484. /******/ module.l = true;
  8485. /******/
  8486. /******/ // Return the exports of the module
  8487. /******/ return module.exports;
  8488. /******/ }
  8489. /******/
  8490. /******/
  8491. /******/ // expose the modules object (__webpack_modules__)
  8492. /******/ __webpack_require__.m = modules;
  8493. /******/
  8494. /******/ // expose the module cache
  8495. /******/ __webpack_require__.c = installedModules;
  8496. /******/
  8497. /******/ // define getter function for harmony exports
  8498. /******/ __webpack_require__.d = function(exports, name, getter) {
  8499. /******/ if(!__webpack_require__.o(exports, name)) {
  8500. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8501. /******/ }
  8502. /******/ };
  8503. /******/
  8504. /******/ // define __esModule on exports
  8505. /******/ __webpack_require__.r = function(exports) {
  8506. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8507. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8508. /******/ }
  8509. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8510. /******/ };
  8511. /******/
  8512. /******/ // create a fake namespace object
  8513. /******/ // mode & 1: value is a module id, require it
  8514. /******/ // mode & 2: merge all properties of value into the ns
  8515. /******/ // mode & 4: return value when already ns object
  8516. /******/ // mode & 8|1: behave like require
  8517. /******/ __webpack_require__.t = function(value, mode) {
  8518. /******/ if(mode & 1) value = __webpack_require__(value);
  8519. /******/ if(mode & 8) return value;
  8520. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8521. /******/ var ns = Object.create(null);
  8522. /******/ __webpack_require__.r(ns);
  8523. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8524. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8525. /******/ return ns;
  8526. /******/ };
  8527. /******/
  8528. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8529. /******/ __webpack_require__.n = function(module) {
  8530. /******/ var getter = module && module.__esModule ?
  8531. /******/ function getDefault() { return module['default']; } :
  8532. /******/ function getModuleExports() { return module; };
  8533. /******/ __webpack_require__.d(getter, 'a', getter);
  8534. /******/ return getter;
  8535. /******/ };
  8536. /******/
  8537. /******/ // Object.prototype.hasOwnProperty.call
  8538. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8539. /******/
  8540. /******/ // __webpack_public_path__
  8541. /******/ __webpack_require__.p = "";
  8542. /******/
  8543. /******/
  8544. /******/ // Load entry module and return exports
  8545. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8546. /******/ })
  8547. /************************************************************************/
  8548. /******/ ([
  8549. /* 0 */
  8550. /***/ (function(module, exports, __webpack_require__) {
  8551. "use strict";
  8552. 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; };
  8553. 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; }; }();
  8554. var _clipboardAction = __webpack_require__(1);
  8555. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8556. var _tinyEmitter = __webpack_require__(3);
  8557. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8558. var _goodListener = __webpack_require__(4);
  8559. var _goodListener2 = _interopRequireDefault(_goodListener);
  8560. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8561. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8562. 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; }
  8563. 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; }
  8564. /**
  8565. * Base class which takes one or more elements, adds event listeners to them,
  8566. * and instantiates a new `ClipboardAction` on each click.
  8567. */
  8568. var Clipboard = function (_Emitter) {
  8569. _inherits(Clipboard, _Emitter);
  8570. /**
  8571. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8572. * @param {Object} options
  8573. */
  8574. function Clipboard(trigger, options) {
  8575. _classCallCheck(this, Clipboard);
  8576. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8577. _this.resolveOptions(options);
  8578. _this.listenClick(trigger);
  8579. return _this;
  8580. }
  8581. /**
  8582. * Defines if attributes would be resolved using internal setter functions
  8583. * or custom functions that were passed in the constructor.
  8584. * @param {Object} options
  8585. */
  8586. _createClass(Clipboard, [{
  8587. key: 'resolveOptions',
  8588. value: function resolveOptions() {
  8589. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8590. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8591. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8592. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8593. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8594. }
  8595. /**
  8596. * Adds a click event listener to the passed trigger.
  8597. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8598. */
  8599. }, {
  8600. key: 'listenClick',
  8601. value: function listenClick(trigger) {
  8602. var _this2 = this;
  8603. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8604. return _this2.onClick(e);
  8605. });
  8606. }
  8607. /**
  8608. * Defines a new `ClipboardAction` on each click event.
  8609. * @param {Event} e
  8610. */
  8611. }, {
  8612. key: 'onClick',
  8613. value: function onClick(e) {
  8614. var trigger = e.delegateTarget || e.currentTarget;
  8615. if (this.clipboardAction) {
  8616. this.clipboardAction = null;
  8617. }
  8618. this.clipboardAction = new _clipboardAction2.default({
  8619. action: this.action(trigger),
  8620. target: this.target(trigger),
  8621. text: this.text(trigger),
  8622. container: this.container,
  8623. trigger: trigger,
  8624. emitter: this
  8625. });
  8626. }
  8627. /**
  8628. * Default `action` lookup function.
  8629. * @param {Element} trigger
  8630. */
  8631. }, {
  8632. key: 'defaultAction',
  8633. value: function defaultAction(trigger) {
  8634. return getAttributeValue('action', trigger);
  8635. }
  8636. /**
  8637. * Default `target` lookup function.
  8638. * @param {Element} trigger
  8639. */
  8640. }, {
  8641. key: 'defaultTarget',
  8642. value: function defaultTarget(trigger) {
  8643. var selector = getAttributeValue('target', trigger);
  8644. if (selector) {
  8645. return document.querySelector(selector);
  8646. }
  8647. }
  8648. /**
  8649. * Returns the support of the given action, or all actions if no action is
  8650. * given.
  8651. * @param {String} [action]
  8652. */
  8653. }, {
  8654. key: 'defaultText',
  8655. /**
  8656. * Default `text` lookup function.
  8657. * @param {Element} trigger
  8658. */
  8659. value: function defaultText(trigger) {
  8660. return getAttributeValue('text', trigger);
  8661. }
  8662. /**
  8663. * Destroy lifecycle.
  8664. */
  8665. }, {
  8666. key: 'destroy',
  8667. value: function destroy() {
  8668. this.listener.destroy();
  8669. if (this.clipboardAction) {
  8670. this.clipboardAction.destroy();
  8671. this.clipboardAction = null;
  8672. }
  8673. }
  8674. }], [{
  8675. key: 'isSupported',
  8676. value: function isSupported() {
  8677. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8678. var actions = typeof action === 'string' ? [action] : action;
  8679. var support = !!document.queryCommandSupported;
  8680. actions.forEach(function (action) {
  8681. support = support && !!document.queryCommandSupported(action);
  8682. });
  8683. return support;
  8684. }
  8685. }]);
  8686. return Clipboard;
  8687. }(_tinyEmitter2.default);
  8688. /**
  8689. * Helper function to retrieve attribute value.
  8690. * @param {String} suffix
  8691. * @param {Element} element
  8692. */
  8693. function getAttributeValue(suffix, element) {
  8694. var attribute = 'data-clipboard-' + suffix;
  8695. if (!element.hasAttribute(attribute)) {
  8696. return;
  8697. }
  8698. return element.getAttribute(attribute);
  8699. }
  8700. module.exports = Clipboard;
  8701. /***/ }),
  8702. /* 1 */
  8703. /***/ (function(module, exports, __webpack_require__) {
  8704. "use strict";
  8705. 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; };
  8706. 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; }; }();
  8707. var _select = __webpack_require__(2);
  8708. var _select2 = _interopRequireDefault(_select);
  8709. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8710. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8711. /**
  8712. * Inner class which performs selection from either `text` or `target`
  8713. * properties and then executes copy or cut operations.
  8714. */
  8715. var ClipboardAction = function () {
  8716. /**
  8717. * @param {Object} options
  8718. */
  8719. function ClipboardAction(options) {
  8720. _classCallCheck(this, ClipboardAction);
  8721. this.resolveOptions(options);
  8722. this.initSelection();
  8723. }
  8724. /**
  8725. * Defines base properties passed from constructor.
  8726. * @param {Object} options
  8727. */
  8728. _createClass(ClipboardAction, [{
  8729. key: 'resolveOptions',
  8730. value: function resolveOptions() {
  8731. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8732. this.action = options.action;
  8733. this.container = options.container;
  8734. this.emitter = options.emitter;
  8735. this.target = options.target;
  8736. this.text = options.text;
  8737. this.trigger = options.trigger;
  8738. this.selectedText = '';
  8739. }
  8740. /**
  8741. * Decides which selection strategy is going to be applied based
  8742. * on the existence of `text` and `target` properties.
  8743. */
  8744. }, {
  8745. key: 'initSelection',
  8746. value: function initSelection() {
  8747. if (this.text) {
  8748. this.selectFake();
  8749. } else if (this.target) {
  8750. this.selectTarget();
  8751. }
  8752. }
  8753. /**
  8754. * Creates a fake textarea element, sets its value from `text` property,
  8755. * and makes a selection on it.
  8756. */
  8757. }, {
  8758. key: 'selectFake',
  8759. value: function selectFake() {
  8760. var _this = this;
  8761. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8762. this.removeFake();
  8763. this.fakeHandlerCallback = function () {
  8764. return _this.removeFake();
  8765. };
  8766. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8767. this.fakeElem = document.createElement('textarea');
  8768. // Prevent zooming on iOS
  8769. this.fakeElem.style.fontSize = '12pt';
  8770. // Reset box model
  8771. this.fakeElem.style.border = '0';
  8772. this.fakeElem.style.padding = '0';
  8773. this.fakeElem.style.margin = '0';
  8774. // Move element out of screen horizontally
  8775. this.fakeElem.style.position = 'absolute';
  8776. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8777. // Move element to the same position vertically
  8778. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8779. this.fakeElem.style.top = yPosition + 'px';
  8780. this.fakeElem.setAttribute('readonly', '');
  8781. this.fakeElem.value = this.text;
  8782. this.container.appendChild(this.fakeElem);
  8783. this.selectedText = (0, _select2.default)(this.fakeElem);
  8784. this.copyText();
  8785. }
  8786. /**
  8787. * Only removes the fake element after another click event, that way
  8788. * a user can hit `Ctrl+C` to copy because selection still exists.
  8789. */
  8790. }, {
  8791. key: 'removeFake',
  8792. value: function removeFake() {
  8793. if (this.fakeHandler) {
  8794. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8795. this.fakeHandler = null;
  8796. this.fakeHandlerCallback = null;
  8797. }
  8798. if (this.fakeElem) {
  8799. this.container.removeChild(this.fakeElem);
  8800. this.fakeElem = null;
  8801. }
  8802. }
  8803. /**
  8804. * Selects the content from element passed on `target` property.
  8805. */
  8806. }, {
  8807. key: 'selectTarget',
  8808. value: function selectTarget() {
  8809. this.selectedText = (0, _select2.default)(this.target);
  8810. this.copyText();
  8811. }
  8812. /**
  8813. * Executes the copy operation based on the current selection.
  8814. */
  8815. }, {
  8816. key: 'copyText',
  8817. value: function copyText() {
  8818. var succeeded = void 0;
  8819. try {
  8820. succeeded = document.execCommand(this.action);
  8821. } catch (err) {
  8822. succeeded = false;
  8823. }
  8824. this.handleResult(succeeded);
  8825. }
  8826. /**
  8827. * Fires an event based on the copy operation result.
  8828. * @param {Boolean} succeeded
  8829. */
  8830. }, {
  8831. key: 'handleResult',
  8832. value: function handleResult(succeeded) {
  8833. this.emitter.emit(succeeded ? 'success' : 'error', {
  8834. action: this.action,
  8835. text: this.selectedText,
  8836. trigger: this.trigger,
  8837. clearSelection: this.clearSelection.bind(this)
  8838. });
  8839. }
  8840. /**
  8841. * Moves focus away from `target` and back to the trigger, removes current selection.
  8842. */
  8843. }, {
  8844. key: 'clearSelection',
  8845. value: function clearSelection() {
  8846. if (this.trigger) {
  8847. this.trigger.focus();
  8848. }
  8849. window.getSelection().removeAllRanges();
  8850. }
  8851. /**
  8852. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8853. * @param {String} action
  8854. */
  8855. }, {
  8856. key: 'destroy',
  8857. /**
  8858. * Destroy lifecycle.
  8859. */
  8860. value: function destroy() {
  8861. this.removeFake();
  8862. }
  8863. }, {
  8864. key: 'action',
  8865. set: function set() {
  8866. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8867. this._action = action;
  8868. if (this._action !== 'copy' && this._action !== 'cut') {
  8869. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8870. }
  8871. }
  8872. /**
  8873. * Gets the `action` property.
  8874. * @return {String}
  8875. */
  8876. ,
  8877. get: function get() {
  8878. return this._action;
  8879. }
  8880. /**
  8881. * Sets the `target` property using an element
  8882. * that will be have its content copied.
  8883. * @param {Element} target
  8884. */
  8885. }, {
  8886. key: 'target',
  8887. set: function set(target) {
  8888. if (target !== undefined) {
  8889. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8890. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8891. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8892. }
  8893. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8894. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8895. }
  8896. this._target = target;
  8897. } else {
  8898. throw new Error('Invalid "target" value, use a valid Element');
  8899. }
  8900. }
  8901. }
  8902. /**
  8903. * Gets the `target` property.
  8904. * @return {String|HTMLElement}
  8905. */
  8906. ,
  8907. get: function get() {
  8908. return this._target;
  8909. }
  8910. }]);
  8911. return ClipboardAction;
  8912. }();
  8913. module.exports = ClipboardAction;
  8914. /***/ }),
  8915. /* 2 */
  8916. /***/ (function(module, exports) {
  8917. function select(element) {
  8918. var selectedText;
  8919. if (element.nodeName === 'SELECT') {
  8920. element.focus();
  8921. selectedText = element.value;
  8922. }
  8923. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8924. var isReadOnly = element.hasAttribute('readonly');
  8925. if (!isReadOnly) {
  8926. element.setAttribute('readonly', '');
  8927. }
  8928. element.select();
  8929. element.setSelectionRange(0, element.value.length);
  8930. if (!isReadOnly) {
  8931. element.removeAttribute('readonly');
  8932. }
  8933. selectedText = element.value;
  8934. }
  8935. else {
  8936. if (element.hasAttribute('contenteditable')) {
  8937. element.focus();
  8938. }
  8939. var selection = window.getSelection();
  8940. var range = document.createRange();
  8941. range.selectNodeContents(element);
  8942. selection.removeAllRanges();
  8943. selection.addRange(range);
  8944. selectedText = selection.toString();
  8945. }
  8946. return selectedText;
  8947. }
  8948. module.exports = select;
  8949. /***/ }),
  8950. /* 3 */
  8951. /***/ (function(module, exports) {
  8952. function E () {
  8953. // Keep this empty so it's easier to inherit from
  8954. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8955. }
  8956. E.prototype = {
  8957. on: function (name, callback, ctx) {
  8958. var e = this.e || (this.e = {});
  8959. (e[name] || (e[name] = [])).push({
  8960. fn: callback,
  8961. ctx: ctx
  8962. });
  8963. return this;
  8964. },
  8965. once: function (name, callback, ctx) {
  8966. var self = this;
  8967. function listener () {
  8968. self.off(name, listener);
  8969. callback.apply(ctx, arguments);
  8970. };
  8971. listener._ = callback
  8972. return this.on(name, listener, ctx);
  8973. },
  8974. emit: function (name) {
  8975. var data = [].slice.call(arguments, 1);
  8976. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8977. var i = 0;
  8978. var len = evtArr.length;
  8979. for (i; i < len; i++) {
  8980. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8981. }
  8982. return this;
  8983. },
  8984. off: function (name, callback) {
  8985. var e = this.e || (this.e = {});
  8986. var evts = e[name];
  8987. var liveEvents = [];
  8988. if (evts && callback) {
  8989. for (var i = 0, len = evts.length; i < len; i++) {
  8990. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8991. liveEvents.push(evts[i]);
  8992. }
  8993. }
  8994. // Remove event from queue to prevent memory leak
  8995. // Suggested by https://github.com/lazd
  8996. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8997. (liveEvents.length)
  8998. ? e[name] = liveEvents
  8999. : delete e[name];
  9000. return this;
  9001. }
  9002. };
  9003. module.exports = E;
  9004. /***/ }),
  9005. /* 4 */
  9006. /***/ (function(module, exports, __webpack_require__) {
  9007. var is = __webpack_require__(5);
  9008. var delegate = __webpack_require__(6);
  9009. /**
  9010. * Validates all params and calls the right
  9011. * listener function based on its target type.
  9012. *
  9013. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9014. * @param {String} type
  9015. * @param {Function} callback
  9016. * @return {Object}
  9017. */
  9018. function listen(target, type, callback) {
  9019. if (!target && !type && !callback) {
  9020. throw new Error('Missing required arguments');
  9021. }
  9022. if (!is.string(type)) {
  9023. throw new TypeError('Second argument must be a String');
  9024. }
  9025. if (!is.fn(callback)) {
  9026. throw new TypeError('Third argument must be a Function');
  9027. }
  9028. if (is.node(target)) {
  9029. return listenNode(target, type, callback);
  9030. }
  9031. else if (is.nodeList(target)) {
  9032. return listenNodeList(target, type, callback);
  9033. }
  9034. else if (is.string(target)) {
  9035. return listenSelector(target, type, callback);
  9036. }
  9037. else {
  9038. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9039. }
  9040. }
  9041. /**
  9042. * Adds an event listener to a HTML element
  9043. * and returns a remove listener function.
  9044. *
  9045. * @param {HTMLElement} node
  9046. * @param {String} type
  9047. * @param {Function} callback
  9048. * @return {Object}
  9049. */
  9050. function listenNode(node, type, callback) {
  9051. node.addEventListener(type, callback);
  9052. return {
  9053. destroy: function() {
  9054. node.removeEventListener(type, callback);
  9055. }
  9056. }
  9057. }
  9058. /**
  9059. * Add an event listener to a list of HTML elements
  9060. * and returns a remove listener function.
  9061. *
  9062. * @param {NodeList|HTMLCollection} nodeList
  9063. * @param {String} type
  9064. * @param {Function} callback
  9065. * @return {Object}
  9066. */
  9067. function listenNodeList(nodeList, type, callback) {
  9068. Array.prototype.forEach.call(nodeList, function(node) {
  9069. node.addEventListener(type, callback);
  9070. });
  9071. return {
  9072. destroy: function() {
  9073. Array.prototype.forEach.call(nodeList, function(node) {
  9074. node.removeEventListener(type, callback);
  9075. });
  9076. }
  9077. }
  9078. }
  9079. /**
  9080. * Add an event listener to a selector
  9081. * and returns a remove listener function.
  9082. *
  9083. * @param {String} selector
  9084. * @param {String} type
  9085. * @param {Function} callback
  9086. * @return {Object}
  9087. */
  9088. function listenSelector(selector, type, callback) {
  9089. return delegate(document.body, selector, type, callback);
  9090. }
  9091. module.exports = listen;
  9092. /***/ }),
  9093. /* 5 */
  9094. /***/ (function(module, exports) {
  9095. /**
  9096. * Check if argument is a HTML element.
  9097. *
  9098. * @param {Object} value
  9099. * @return {Boolean}
  9100. */
  9101. exports.node = function(value) {
  9102. return value !== undefined
  9103. && value instanceof HTMLElement
  9104. && value.nodeType === 1;
  9105. };
  9106. /**
  9107. * Check if argument is a list of HTML elements.
  9108. *
  9109. * @param {Object} value
  9110. * @return {Boolean}
  9111. */
  9112. exports.nodeList = function(value) {
  9113. var type = Object.prototype.toString.call(value);
  9114. return value !== undefined
  9115. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9116. && ('length' in value)
  9117. && (value.length === 0 || exports.node(value[0]));
  9118. };
  9119. /**
  9120. * Check if argument is a string.
  9121. *
  9122. * @param {Object} value
  9123. * @return {Boolean}
  9124. */
  9125. exports.string = function(value) {
  9126. return typeof value === 'string'
  9127. || value instanceof String;
  9128. };
  9129. /**
  9130. * Check if argument is a function.
  9131. *
  9132. * @param {Object} value
  9133. * @return {Boolean}
  9134. */
  9135. exports.fn = function(value) {
  9136. var type = Object.prototype.toString.call(value);
  9137. return type === '[object Function]';
  9138. };
  9139. /***/ }),
  9140. /* 6 */
  9141. /***/ (function(module, exports, __webpack_require__) {
  9142. var closest = __webpack_require__(7);
  9143. /**
  9144. * Delegates event to a selector.
  9145. *
  9146. * @param {Element} element
  9147. * @param {String} selector
  9148. * @param {String} type
  9149. * @param {Function} callback
  9150. * @param {Boolean} useCapture
  9151. * @return {Object}
  9152. */
  9153. function _delegate(element, selector, type, callback, useCapture) {
  9154. var listenerFn = listener.apply(this, arguments);
  9155. element.addEventListener(type, listenerFn, useCapture);
  9156. return {
  9157. destroy: function() {
  9158. element.removeEventListener(type, listenerFn, useCapture);
  9159. }
  9160. }
  9161. }
  9162. /**
  9163. * Delegates event to a selector.
  9164. *
  9165. * @param {Element|String|Array} [elements]
  9166. * @param {String} selector
  9167. * @param {String} type
  9168. * @param {Function} callback
  9169. * @param {Boolean} useCapture
  9170. * @return {Object}
  9171. */
  9172. function delegate(elements, selector, type, callback, useCapture) {
  9173. // Handle the regular Element usage
  9174. if (typeof elements.addEventListener === 'function') {
  9175. return _delegate.apply(null, arguments);
  9176. }
  9177. // Handle Element-less usage, it defaults to global delegation
  9178. if (typeof type === 'function') {
  9179. // Use `document` as the first parameter, then apply arguments
  9180. // This is a short way to .unshift `arguments` without running into deoptimizations
  9181. return _delegate.bind(null, document).apply(null, arguments);
  9182. }
  9183. // Handle Selector-based usage
  9184. if (typeof elements === 'string') {
  9185. elements = document.querySelectorAll(elements);
  9186. }
  9187. // Handle Array-like based usage
  9188. return Array.prototype.map.call(elements, function (element) {
  9189. return _delegate(element, selector, type, callback, useCapture);
  9190. });
  9191. }
  9192. /**
  9193. * Finds closest match and invokes callback.
  9194. *
  9195. * @param {Element} element
  9196. * @param {String} selector
  9197. * @param {String} type
  9198. * @param {Function} callback
  9199. * @return {Function}
  9200. */
  9201. function listener(element, selector, type, callback) {
  9202. return function(e) {
  9203. e.delegateTarget = closest(e.target, selector);
  9204. if (e.delegateTarget) {
  9205. callback.call(element, e);
  9206. }
  9207. }
  9208. }
  9209. module.exports = delegate;
  9210. /***/ }),
  9211. /* 7 */
  9212. /***/ (function(module, exports) {
  9213. var DOCUMENT_NODE_TYPE = 9;
  9214. /**
  9215. * A polyfill for Element.matches()
  9216. */
  9217. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9218. var proto = Element.prototype;
  9219. proto.matches = proto.matchesSelector ||
  9220. proto.mozMatchesSelector ||
  9221. proto.msMatchesSelector ||
  9222. proto.oMatchesSelector ||
  9223. proto.webkitMatchesSelector;
  9224. }
  9225. /**
  9226. * Finds the closest parent that matches a selector.
  9227. *
  9228. * @param {Element} element
  9229. * @param {String} selector
  9230. * @return {Function}
  9231. */
  9232. function closest (element, selector) {
  9233. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9234. if (typeof element.matches === 'function' &&
  9235. element.matches(selector)) {
  9236. return element;
  9237. }
  9238. element = element.parentNode;
  9239. }
  9240. }
  9241. module.exports = closest;
  9242. /***/ })
  9243. /******/ ]);
  9244. });
  9245. /***/ }),
  9246. /***/ "./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&":
  9247. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9248. !*** ./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& ***!
  9249. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9250. /*! no static exports found */
  9251. /***/ (function(module, exports, __webpack_require__) {
  9252. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9253. // imports
  9254. // module
  9255. 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", ""]);
  9256. // exports
  9257. /***/ }),
  9258. /***/ "./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&":
  9259. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9260. !*** ./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& ***!
  9261. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9262. /*! no static exports found */
  9263. /***/ (function(module, exports, __webpack_require__) {
  9264. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9265. // imports
  9266. // module
  9267. 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", ""]);
  9268. // exports
  9269. /***/ }),
  9270. /***/ "./node_modules/css-loader/lib/css-base.js":
  9271. /*!*************************************************!*\
  9272. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9273. \*************************************************/
  9274. /*! no static exports found */
  9275. /***/ (function(module, exports) {
  9276. /*
  9277. MIT License http://www.opensource.org/licenses/mit-license.php
  9278. Author Tobias Koppers @sokra
  9279. */
  9280. // css base code, injected by the css-loader
  9281. module.exports = function(useSourceMap) {
  9282. var list = [];
  9283. // return the list of modules as css string
  9284. list.toString = function toString() {
  9285. return this.map(function (item) {
  9286. var content = cssWithMappingToString(item, useSourceMap);
  9287. if(item[2]) {
  9288. return "@media " + item[2] + "{" + content + "}";
  9289. } else {
  9290. return content;
  9291. }
  9292. }).join("");
  9293. };
  9294. // import a list of modules into the list
  9295. list.i = function(modules, mediaQuery) {
  9296. if(typeof modules === "string")
  9297. modules = [[null, modules, ""]];
  9298. var alreadyImportedModules = {};
  9299. for(var i = 0; i < this.length; i++) {
  9300. var id = this[i][0];
  9301. if(typeof id === "number")
  9302. alreadyImportedModules[id] = true;
  9303. }
  9304. for(i = 0; i < modules.length; i++) {
  9305. var item = modules[i];
  9306. // skip already imported module
  9307. // this implementation is not 100% perfect for weird media query combinations
  9308. // when a module is imported multiple times with different media queries.
  9309. // I hope this will never occur (Hey this way we have smaller bundles)
  9310. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9311. if(mediaQuery && !item[2]) {
  9312. item[2] = mediaQuery;
  9313. } else if(mediaQuery) {
  9314. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9315. }
  9316. list.push(item);
  9317. }
  9318. }
  9319. };
  9320. return list;
  9321. };
  9322. function cssWithMappingToString(item, useSourceMap) {
  9323. var content = item[1] || '';
  9324. var cssMapping = item[3];
  9325. if (!cssMapping) {
  9326. return content;
  9327. }
  9328. if (useSourceMap && typeof btoa === 'function') {
  9329. var sourceMapping = toComment(cssMapping);
  9330. var sourceURLs = cssMapping.sources.map(function (source) {
  9331. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9332. });
  9333. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9334. }
  9335. return [content].join('\n');
  9336. }
  9337. // Adapted from convert-source-map (MIT)
  9338. function toComment(sourceMap) {
  9339. // eslint-disable-next-line no-undef
  9340. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9341. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9342. return '/*# ' + data + ' */';
  9343. }
  9344. /***/ }),
  9345. /***/ "./node_modules/ieee754/index.js":
  9346. /*!***************************************!*\
  9347. !*** ./node_modules/ieee754/index.js ***!
  9348. \***************************************/
  9349. /*! no static exports found */
  9350. /***/ (function(module, exports) {
  9351. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9352. var e, m
  9353. var eLen = (nBytes * 8) - mLen - 1
  9354. var eMax = (1 << eLen) - 1
  9355. var eBias = eMax >> 1
  9356. var nBits = -7
  9357. var i = isLE ? (nBytes - 1) : 0
  9358. var d = isLE ? -1 : 1
  9359. var s = buffer[offset + i]
  9360. i += d
  9361. e = s & ((1 << (-nBits)) - 1)
  9362. s >>= (-nBits)
  9363. nBits += eLen
  9364. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9365. m = e & ((1 << (-nBits)) - 1)
  9366. e >>= (-nBits)
  9367. nBits += mLen
  9368. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9369. if (e === 0) {
  9370. e = 1 - eBias
  9371. } else if (e === eMax) {
  9372. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9373. } else {
  9374. m = m + Math.pow(2, mLen)
  9375. e = e - eBias
  9376. }
  9377. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9378. }
  9379. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9380. var e, m, c
  9381. var eLen = (nBytes * 8) - mLen - 1
  9382. var eMax = (1 << eLen) - 1
  9383. var eBias = eMax >> 1
  9384. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9385. var i = isLE ? 0 : (nBytes - 1)
  9386. var d = isLE ? 1 : -1
  9387. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9388. value = Math.abs(value)
  9389. if (isNaN(value) || value === Infinity) {
  9390. m = isNaN(value) ? 1 : 0
  9391. e = eMax
  9392. } else {
  9393. e = Math.floor(Math.log(value) / Math.LN2)
  9394. if (value * (c = Math.pow(2, -e)) < 1) {
  9395. e--
  9396. c *= 2
  9397. }
  9398. if (e + eBias >= 1) {
  9399. value += rt / c
  9400. } else {
  9401. value += rt * Math.pow(2, 1 - eBias)
  9402. }
  9403. if (value * c >= 2) {
  9404. e++
  9405. c /= 2
  9406. }
  9407. if (e + eBias >= eMax) {
  9408. m = 0
  9409. e = eMax
  9410. } else if (e + eBias >= 1) {
  9411. m = ((value * c) - 1) * Math.pow(2, mLen)
  9412. e = e + eBias
  9413. } else {
  9414. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9415. e = 0
  9416. }
  9417. }
  9418. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9419. e = (e << mLen) | m
  9420. eLen += mLen
  9421. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9422. buffer[offset + i - d] |= s * 128
  9423. }
  9424. /***/ }),
  9425. /***/ "./node_modules/isarray/index.js":
  9426. /*!***************************************!*\
  9427. !*** ./node_modules/isarray/index.js ***!
  9428. \***************************************/
  9429. /*! no static exports found */
  9430. /***/ (function(module, exports) {
  9431. var toString = {}.toString;
  9432. module.exports = Array.isArray || function (arr) {
  9433. return toString.call(arr) == '[object Array]';
  9434. };
  9435. /***/ }),
  9436. /***/ "./node_modules/jquery/dist/jquery.js":
  9437. /*!********************************************!*\
  9438. !*** ./node_modules/jquery/dist/jquery.js ***!
  9439. \********************************************/
  9440. /*! no static exports found */
  9441. /***/ (function(module, exports, __webpack_require__) {
  9442. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9443. * jQuery JavaScript Library v3.4.1
  9444. * https://jquery.com/
  9445. *
  9446. * Includes Sizzle.js
  9447. * https://sizzlejs.com/
  9448. *
  9449. * Copyright JS Foundation and other contributors
  9450. * Released under the MIT license
  9451. * https://jquery.org/license
  9452. *
  9453. * Date: 2019-05-01T21:04Z
  9454. */
  9455. ( function( global, factory ) {
  9456. "use strict";
  9457. if ( true && typeof module.exports === "object" ) {
  9458. // For CommonJS and CommonJS-like environments where a proper `window`
  9459. // is present, execute the factory and get jQuery.
  9460. // For environments that do not have a `window` with a `document`
  9461. // (such as Node.js), expose a factory as module.exports.
  9462. // This accentuates the need for the creation of a real `window`.
  9463. // e.g. var jQuery = require("jquery")(window);
  9464. // See ticket #14549 for more info.
  9465. module.exports = global.document ?
  9466. factory( global, true ) :
  9467. function( w ) {
  9468. if ( !w.document ) {
  9469. throw new Error( "jQuery requires a window with a document" );
  9470. }
  9471. return factory( w );
  9472. };
  9473. } else {
  9474. factory( global );
  9475. }
  9476. // Pass this if window is not defined yet
  9477. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9478. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9479. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9480. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9481. // enough that all such attempts are guarded in a try block.
  9482. "use strict";
  9483. var arr = [];
  9484. var document = window.document;
  9485. var getProto = Object.getPrototypeOf;
  9486. var slice = arr.slice;
  9487. var concat = arr.concat;
  9488. var push = arr.push;
  9489. var indexOf = arr.indexOf;
  9490. var class2type = {};
  9491. var toString = class2type.toString;
  9492. var hasOwn = class2type.hasOwnProperty;
  9493. var fnToString = hasOwn.toString;
  9494. var ObjectFunctionString = fnToString.call( Object );
  9495. var support = {};
  9496. var isFunction = function isFunction( obj ) {
  9497. // Support: Chrome <=57, Firefox <=52
  9498. // In some browsers, typeof returns "function" for HTML <object> elements
  9499. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9500. // We don't want to classify *any* DOM node as a function.
  9501. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9502. };
  9503. var isWindow = function isWindow( obj ) {
  9504. return obj != null && obj === obj.window;
  9505. };
  9506. var preservedScriptAttributes = {
  9507. type: true,
  9508. src: true,
  9509. nonce: true,
  9510. noModule: true
  9511. };
  9512. function DOMEval( code, node, doc ) {
  9513. doc = doc || document;
  9514. var i, val,
  9515. script = doc.createElement( "script" );
  9516. script.text = code;
  9517. if ( node ) {
  9518. for ( i in preservedScriptAttributes ) {
  9519. // Support: Firefox 64+, Edge 18+
  9520. // Some browsers don't support the "nonce" property on scripts.
  9521. // On the other hand, just using `getAttribute` is not enough as
  9522. // the `nonce` attribute is reset to an empty string whenever it
  9523. // becomes browsing-context connected.
  9524. // See https://github.com/whatwg/html/issues/2369
  9525. // See https://html.spec.whatwg.org/#nonce-attributes
  9526. // The `node.getAttribute` check was added for the sake of
  9527. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9528. // via an object.
  9529. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9530. if ( val ) {
  9531. script.setAttribute( i, val );
  9532. }
  9533. }
  9534. }
  9535. doc.head.appendChild( script ).parentNode.removeChild( script );
  9536. }
  9537. function toType( obj ) {
  9538. if ( obj == null ) {
  9539. return obj + "";
  9540. }
  9541. // Support: Android <=2.3 only (functionish RegExp)
  9542. return typeof obj === "object" || typeof obj === "function" ?
  9543. class2type[ toString.call( obj ) ] || "object" :
  9544. typeof obj;
  9545. }
  9546. /* global Symbol */
  9547. // Defining this global in .eslintrc.json would create a danger of using the global
  9548. // unguarded in another place, it seems safer to define global only for this module
  9549. var
  9550. version = "3.4.1",
  9551. // Define a local copy of jQuery
  9552. jQuery = function( selector, context ) {
  9553. // The jQuery object is actually just the init constructor 'enhanced'
  9554. // Need init if jQuery is called (just allow error to be thrown if not included)
  9555. return new jQuery.fn.init( selector, context );
  9556. },
  9557. // Support: Android <=4.0 only
  9558. // Make sure we trim BOM and NBSP
  9559. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9560. jQuery.fn = jQuery.prototype = {
  9561. // The current version of jQuery being used
  9562. jquery: version,
  9563. constructor: jQuery,
  9564. // The default length of a jQuery object is 0
  9565. length: 0,
  9566. toArray: function() {
  9567. return slice.call( this );
  9568. },
  9569. // Get the Nth element in the matched element set OR
  9570. // Get the whole matched element set as a clean array
  9571. get: function( num ) {
  9572. // Return all the elements in a clean array
  9573. if ( num == null ) {
  9574. return slice.call( this );
  9575. }
  9576. // Return just the one element from the set
  9577. return num < 0 ? this[ num + this.length ] : this[ num ];
  9578. },
  9579. // Take an array of elements and push it onto the stack
  9580. // (returning the new matched element set)
  9581. pushStack: function( elems ) {
  9582. // Build a new jQuery matched element set
  9583. var ret = jQuery.merge( this.constructor(), elems );
  9584. // Add the old object onto the stack (as a reference)
  9585. ret.prevObject = this;
  9586. // Return the newly-formed element set
  9587. return ret;
  9588. },
  9589. // Execute a callback for every element in the matched set.
  9590. each: function( callback ) {
  9591. return jQuery.each( this, callback );
  9592. },
  9593. map: function( callback ) {
  9594. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9595. return callback.call( elem, i, elem );
  9596. } ) );
  9597. },
  9598. slice: function() {
  9599. return this.pushStack( slice.apply( this, arguments ) );
  9600. },
  9601. first: function() {
  9602. return this.eq( 0 );
  9603. },
  9604. last: function() {
  9605. return this.eq( -1 );
  9606. },
  9607. eq: function( i ) {
  9608. var len = this.length,
  9609. j = +i + ( i < 0 ? len : 0 );
  9610. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9611. },
  9612. end: function() {
  9613. return this.prevObject || this.constructor();
  9614. },
  9615. // For internal use only.
  9616. // Behaves like an Array's method, not like a jQuery method.
  9617. push: push,
  9618. sort: arr.sort,
  9619. splice: arr.splice
  9620. };
  9621. jQuery.extend = jQuery.fn.extend = function() {
  9622. var options, name, src, copy, copyIsArray, clone,
  9623. target = arguments[ 0 ] || {},
  9624. i = 1,
  9625. length = arguments.length,
  9626. deep = false;
  9627. // Handle a deep copy situation
  9628. if ( typeof target === "boolean" ) {
  9629. deep = target;
  9630. // Skip the boolean and the target
  9631. target = arguments[ i ] || {};
  9632. i++;
  9633. }
  9634. // Handle case when target is a string or something (possible in deep copy)
  9635. if ( typeof target !== "object" && !isFunction( target ) ) {
  9636. target = {};
  9637. }
  9638. // Extend jQuery itself if only one argument is passed
  9639. if ( i === length ) {
  9640. target = this;
  9641. i--;
  9642. }
  9643. for ( ; i < length; i++ ) {
  9644. // Only deal with non-null/undefined values
  9645. if ( ( options = arguments[ i ] ) != null ) {
  9646. // Extend the base object
  9647. for ( name in options ) {
  9648. copy = options[ name ];
  9649. // Prevent Object.prototype pollution
  9650. // Prevent never-ending loop
  9651. if ( name === "__proto__" || target === copy ) {
  9652. continue;
  9653. }
  9654. // Recurse if we're merging plain objects or arrays
  9655. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9656. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9657. src = target[ name ];
  9658. // Ensure proper type for the source value
  9659. if ( copyIsArray && !Array.isArray( src ) ) {
  9660. clone = [];
  9661. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9662. clone = {};
  9663. } else {
  9664. clone = src;
  9665. }
  9666. copyIsArray = false;
  9667. // Never move original objects, clone them
  9668. target[ name ] = jQuery.extend( deep, clone, copy );
  9669. // Don't bring in undefined values
  9670. } else if ( copy !== undefined ) {
  9671. target[ name ] = copy;
  9672. }
  9673. }
  9674. }
  9675. }
  9676. // Return the modified object
  9677. return target;
  9678. };
  9679. jQuery.extend( {
  9680. // Unique for each copy of jQuery on the page
  9681. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9682. // Assume jQuery is ready without the ready module
  9683. isReady: true,
  9684. error: function( msg ) {
  9685. throw new Error( msg );
  9686. },
  9687. noop: function() {},
  9688. isPlainObject: function( obj ) {
  9689. var proto, Ctor;
  9690. // Detect obvious negatives
  9691. // Use toString instead of jQuery.type to catch host objects
  9692. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9693. return false;
  9694. }
  9695. proto = getProto( obj );
  9696. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9697. if ( !proto ) {
  9698. return true;
  9699. }
  9700. // Objects with prototype are plain iff they were constructed by a global Object function
  9701. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9702. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9703. },
  9704. isEmptyObject: function( obj ) {
  9705. var name;
  9706. for ( name in obj ) {
  9707. return false;
  9708. }
  9709. return true;
  9710. },
  9711. // Evaluates a script in a global context
  9712. globalEval: function( code, options ) {
  9713. DOMEval( code, { nonce: options && options.nonce } );
  9714. },
  9715. each: function( obj, callback ) {
  9716. var length, i = 0;
  9717. if ( isArrayLike( obj ) ) {
  9718. length = obj.length;
  9719. for ( ; i < length; i++ ) {
  9720. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9721. break;
  9722. }
  9723. }
  9724. } else {
  9725. for ( i in obj ) {
  9726. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9727. break;
  9728. }
  9729. }
  9730. }
  9731. return obj;
  9732. },
  9733. // Support: Android <=4.0 only
  9734. trim: function( text ) {
  9735. return text == null ?
  9736. "" :
  9737. ( text + "" ).replace( rtrim, "" );
  9738. },
  9739. // results is for internal usage only
  9740. makeArray: function( arr, results ) {
  9741. var ret = results || [];
  9742. if ( arr != null ) {
  9743. if ( isArrayLike( Object( arr ) ) ) {
  9744. jQuery.merge( ret,
  9745. typeof arr === "string" ?
  9746. [ arr ] : arr
  9747. );
  9748. } else {
  9749. push.call( ret, arr );
  9750. }
  9751. }
  9752. return ret;
  9753. },
  9754. inArray: function( elem, arr, i ) {
  9755. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9756. },
  9757. // Support: Android <=4.0 only, PhantomJS 1 only
  9758. // push.apply(_, arraylike) throws on ancient WebKit
  9759. merge: function( first, second ) {
  9760. var len = +second.length,
  9761. j = 0,
  9762. i = first.length;
  9763. for ( ; j < len; j++ ) {
  9764. first[ i++ ] = second[ j ];
  9765. }
  9766. first.length = i;
  9767. return first;
  9768. },
  9769. grep: function( elems, callback, invert ) {
  9770. var callbackInverse,
  9771. matches = [],
  9772. i = 0,
  9773. length = elems.length,
  9774. callbackExpect = !invert;
  9775. // Go through the array, only saving the items
  9776. // that pass the validator function
  9777. for ( ; i < length; i++ ) {
  9778. callbackInverse = !callback( elems[ i ], i );
  9779. if ( callbackInverse !== callbackExpect ) {
  9780. matches.push( elems[ i ] );
  9781. }
  9782. }
  9783. return matches;
  9784. },
  9785. // arg is for internal usage only
  9786. map: function( elems, callback, arg ) {
  9787. var length, value,
  9788. i = 0,
  9789. ret = [];
  9790. // Go through the array, translating each of the items to their new values
  9791. if ( isArrayLike( elems ) ) {
  9792. length = elems.length;
  9793. for ( ; i < length; i++ ) {
  9794. value = callback( elems[ i ], i, arg );
  9795. if ( value != null ) {
  9796. ret.push( value );
  9797. }
  9798. }
  9799. // Go through every key on the object,
  9800. } else {
  9801. for ( i in elems ) {
  9802. value = callback( elems[ i ], i, arg );
  9803. if ( value != null ) {
  9804. ret.push( value );
  9805. }
  9806. }
  9807. }
  9808. // Flatten any nested arrays
  9809. return concat.apply( [], ret );
  9810. },
  9811. // A global GUID counter for objects
  9812. guid: 1,
  9813. // jQuery.support is not used in Core but other projects attach their
  9814. // properties to it so it needs to exist.
  9815. support: support
  9816. } );
  9817. if ( typeof Symbol === "function" ) {
  9818. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9819. }
  9820. // Populate the class2type map
  9821. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9822. function( i, name ) {
  9823. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9824. } );
  9825. function isArrayLike( obj ) {
  9826. // Support: real iOS 8.2 only (not reproducible in simulator)
  9827. // `in` check used to prevent JIT error (gh-2145)
  9828. // hasOwn isn't used here due to false negatives
  9829. // regarding Nodelist length in IE
  9830. var length = !!obj && "length" in obj && obj.length,
  9831. type = toType( obj );
  9832. if ( isFunction( obj ) || isWindow( obj ) ) {
  9833. return false;
  9834. }
  9835. return type === "array" || length === 0 ||
  9836. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9837. }
  9838. var Sizzle =
  9839. /*!
  9840. * Sizzle CSS Selector Engine v2.3.4
  9841. * https://sizzlejs.com/
  9842. *
  9843. * Copyright JS Foundation and other contributors
  9844. * Released under the MIT license
  9845. * https://js.foundation/
  9846. *
  9847. * Date: 2019-04-08
  9848. */
  9849. (function( window ) {
  9850. var i,
  9851. support,
  9852. Expr,
  9853. getText,
  9854. isXML,
  9855. tokenize,
  9856. compile,
  9857. select,
  9858. outermostContext,
  9859. sortInput,
  9860. hasDuplicate,
  9861. // Local document vars
  9862. setDocument,
  9863. document,
  9864. docElem,
  9865. documentIsHTML,
  9866. rbuggyQSA,
  9867. rbuggyMatches,
  9868. matches,
  9869. contains,
  9870. // Instance-specific data
  9871. expando = "sizzle" + 1 * new Date(),
  9872. preferredDoc = window.document,
  9873. dirruns = 0,
  9874. done = 0,
  9875. classCache = createCache(),
  9876. tokenCache = createCache(),
  9877. compilerCache = createCache(),
  9878. nonnativeSelectorCache = createCache(),
  9879. sortOrder = function( a, b ) {
  9880. if ( a === b ) {
  9881. hasDuplicate = true;
  9882. }
  9883. return 0;
  9884. },
  9885. // Instance methods
  9886. hasOwn = ({}).hasOwnProperty,
  9887. arr = [],
  9888. pop = arr.pop,
  9889. push_native = arr.push,
  9890. push = arr.push,
  9891. slice = arr.slice,
  9892. // Use a stripped-down indexOf as it's faster than native
  9893. // https://jsperf.com/thor-indexof-vs-for/5
  9894. indexOf = function( list, elem ) {
  9895. var i = 0,
  9896. len = list.length;
  9897. for ( ; i < len; i++ ) {
  9898. if ( list[i] === elem ) {
  9899. return i;
  9900. }
  9901. }
  9902. return -1;
  9903. },
  9904. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9905. // Regular expressions
  9906. // http://www.w3.org/TR/css3-selectors/#whitespace
  9907. whitespace = "[\\x20\\t\\r\\n\\f]",
  9908. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9909. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9910. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9911. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9912. // Operator (capture 2)
  9913. "*([*^$|!~]?=)" + whitespace +
  9914. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9915. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9916. "*\\]",
  9917. pseudos = ":(" + identifier + ")(?:\\((" +
  9918. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9919. // 1. quoted (capture 3; capture 4 or capture 5)
  9920. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9921. // 2. simple (capture 6)
  9922. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9923. // 3. anything else (capture 2)
  9924. ".*" +
  9925. ")\\)|)",
  9926. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9927. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9928. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9929. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9930. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9931. rdescend = new RegExp( whitespace + "|>" ),
  9932. rpseudo = new RegExp( pseudos ),
  9933. ridentifier = new RegExp( "^" + identifier + "$" ),
  9934. matchExpr = {
  9935. "ID": new RegExp( "^#(" + identifier + ")" ),
  9936. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9937. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9938. "ATTR": new RegExp( "^" + attributes ),
  9939. "PSEUDO": new RegExp( "^" + pseudos ),
  9940. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9941. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9942. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9943. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9944. // For use in libraries implementing .is()
  9945. // We use this for POS matching in `select`
  9946. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9947. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9948. },
  9949. rhtml = /HTML$/i,
  9950. rinputs = /^(?:input|select|textarea|button)$/i,
  9951. rheader = /^h\d$/i,
  9952. rnative = /^[^{]+\{\s*\[native \w/,
  9953. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9954. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9955. rsibling = /[+~]/,
  9956. // CSS escapes
  9957. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9958. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9959. funescape = function( _, escaped, escapedWhitespace ) {
  9960. var high = "0x" + escaped - 0x10000;
  9961. // NaN means non-codepoint
  9962. // Support: Firefox<24
  9963. // Workaround erroneous numeric interpretation of +"0x"
  9964. return high !== high || escapedWhitespace ?
  9965. escaped :
  9966. high < 0 ?
  9967. // BMP codepoint
  9968. String.fromCharCode( high + 0x10000 ) :
  9969. // Supplemental Plane codepoint (surrogate pair)
  9970. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9971. },
  9972. // CSS string/identifier serialization
  9973. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9974. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9975. fcssescape = function( ch, asCodePoint ) {
  9976. if ( asCodePoint ) {
  9977. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9978. if ( ch === "\0" ) {
  9979. return "\uFFFD";
  9980. }
  9981. // Control characters and (dependent upon position) numbers get escaped as code points
  9982. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9983. }
  9984. // Other potentially-special ASCII characters get backslash-escaped
  9985. return "\\" + ch;
  9986. },
  9987. // Used for iframes
  9988. // See setDocument()
  9989. // Removing the function wrapper causes a "Permission Denied"
  9990. // error in IE
  9991. unloadHandler = function() {
  9992. setDocument();
  9993. },
  9994. inDisabledFieldset = addCombinator(
  9995. function( elem ) {
  9996. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9997. },
  9998. { dir: "parentNode", next: "legend" }
  9999. );
  10000. // Optimize for push.apply( _, NodeList )
  10001. try {
  10002. push.apply(
  10003. (arr = slice.call( preferredDoc.childNodes )),
  10004. preferredDoc.childNodes
  10005. );
  10006. // Support: Android<4.0
  10007. // Detect silently failing push.apply
  10008. arr[ preferredDoc.childNodes.length ].nodeType;
  10009. } catch ( e ) {
  10010. push = { apply: arr.length ?
  10011. // Leverage slice if possible
  10012. function( target, els ) {
  10013. push_native.apply( target, slice.call(els) );
  10014. } :
  10015. // Support: IE<9
  10016. // Otherwise append directly
  10017. function( target, els ) {
  10018. var j = target.length,
  10019. i = 0;
  10020. // Can't trust NodeList.length
  10021. while ( (target[j++] = els[i++]) ) {}
  10022. target.length = j - 1;
  10023. }
  10024. };
  10025. }
  10026. function Sizzle( selector, context, results, seed ) {
  10027. var m, i, elem, nid, match, groups, newSelector,
  10028. newContext = context && context.ownerDocument,
  10029. // nodeType defaults to 9, since context defaults to document
  10030. nodeType = context ? context.nodeType : 9;
  10031. results = results || [];
  10032. // Return early from calls with invalid selector or context
  10033. if ( typeof selector !== "string" || !selector ||
  10034. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10035. return results;
  10036. }
  10037. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10038. if ( !seed ) {
  10039. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10040. setDocument( context );
  10041. }
  10042. context = context || document;
  10043. if ( documentIsHTML ) {
  10044. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10045. // (excepting DocumentFragment context, where the methods don't exist)
  10046. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10047. // ID selector
  10048. if ( (m = match[1]) ) {
  10049. // Document context
  10050. if ( nodeType === 9 ) {
  10051. if ( (elem = context.getElementById( m )) ) {
  10052. // Support: IE, Opera, Webkit
  10053. // TODO: identify versions
  10054. // getElementById can match elements by name instead of ID
  10055. if ( elem.id === m ) {
  10056. results.push( elem );
  10057. return results;
  10058. }
  10059. } else {
  10060. return results;
  10061. }
  10062. // Element context
  10063. } else {
  10064. // Support: IE, Opera, Webkit
  10065. // TODO: identify versions
  10066. // getElementById can match elements by name instead of ID
  10067. if ( newContext && (elem = newContext.getElementById( m )) &&
  10068. contains( context, elem ) &&
  10069. elem.id === m ) {
  10070. results.push( elem );
  10071. return results;
  10072. }
  10073. }
  10074. // Type selector
  10075. } else if ( match[2] ) {
  10076. push.apply( results, context.getElementsByTagName( selector ) );
  10077. return results;
  10078. // Class selector
  10079. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10080. context.getElementsByClassName ) {
  10081. push.apply( results, context.getElementsByClassName( m ) );
  10082. return results;
  10083. }
  10084. }
  10085. // Take advantage of querySelectorAll
  10086. if ( support.qsa &&
  10087. !nonnativeSelectorCache[ selector + " " ] &&
  10088. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10089. // Support: IE 8 only
  10090. // Exclude object elements
  10091. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10092. newSelector = selector;
  10093. newContext = context;
  10094. // qSA considers elements outside a scoping root when evaluating child or
  10095. // descendant combinators, which is not what we want.
  10096. // In such cases, we work around the behavior by prefixing every selector in the
  10097. // list with an ID selector referencing the scope context.
  10098. // Thanks to Andrew Dupont for this technique.
  10099. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10100. // Capture the context ID, setting it first if necessary
  10101. if ( (nid = context.getAttribute( "id" )) ) {
  10102. nid = nid.replace( rcssescape, fcssescape );
  10103. } else {
  10104. context.setAttribute( "id", (nid = expando) );
  10105. }
  10106. // Prefix every selector in the list
  10107. groups = tokenize( selector );
  10108. i = groups.length;
  10109. while ( i-- ) {
  10110. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10111. }
  10112. newSelector = groups.join( "," );
  10113. // Expand context for sibling selectors
  10114. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10115. context;
  10116. }
  10117. try {
  10118. push.apply( results,
  10119. newContext.querySelectorAll( newSelector )
  10120. );
  10121. return results;
  10122. } catch ( qsaError ) {
  10123. nonnativeSelectorCache( selector, true );
  10124. } finally {
  10125. if ( nid === expando ) {
  10126. context.removeAttribute( "id" );
  10127. }
  10128. }
  10129. }
  10130. }
  10131. }
  10132. // All others
  10133. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10134. }
  10135. /**
  10136. * Create key-value caches of limited size
  10137. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10138. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10139. * deleting the oldest entry
  10140. */
  10141. function createCache() {
  10142. var keys = [];
  10143. function cache( key, value ) {
  10144. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10145. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10146. // Only keep the most recent entries
  10147. delete cache[ keys.shift() ];
  10148. }
  10149. return (cache[ key + " " ] = value);
  10150. }
  10151. return cache;
  10152. }
  10153. /**
  10154. * Mark a function for special use by Sizzle
  10155. * @param {Function} fn The function to mark
  10156. */
  10157. function markFunction( fn ) {
  10158. fn[ expando ] = true;
  10159. return fn;
  10160. }
  10161. /**
  10162. * Support testing using an element
  10163. * @param {Function} fn Passed the created element and returns a boolean result
  10164. */
  10165. function assert( fn ) {
  10166. var el = document.createElement("fieldset");
  10167. try {
  10168. return !!fn( el );
  10169. } catch (e) {
  10170. return false;
  10171. } finally {
  10172. // Remove from its parent by default
  10173. if ( el.parentNode ) {
  10174. el.parentNode.removeChild( el );
  10175. }
  10176. // release memory in IE
  10177. el = null;
  10178. }
  10179. }
  10180. /**
  10181. * Adds the same handler for all of the specified attrs
  10182. * @param {String} attrs Pipe-separated list of attributes
  10183. * @param {Function} handler The method that will be applied
  10184. */
  10185. function addHandle( attrs, handler ) {
  10186. var arr = attrs.split("|"),
  10187. i = arr.length;
  10188. while ( i-- ) {
  10189. Expr.attrHandle[ arr[i] ] = handler;
  10190. }
  10191. }
  10192. /**
  10193. * Checks document order of two siblings
  10194. * @param {Element} a
  10195. * @param {Element} b
  10196. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10197. */
  10198. function siblingCheck( a, b ) {
  10199. var cur = b && a,
  10200. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10201. a.sourceIndex - b.sourceIndex;
  10202. // Use IE sourceIndex if available on both nodes
  10203. if ( diff ) {
  10204. return diff;
  10205. }
  10206. // Check if b follows a
  10207. if ( cur ) {
  10208. while ( (cur = cur.nextSibling) ) {
  10209. if ( cur === b ) {
  10210. return -1;
  10211. }
  10212. }
  10213. }
  10214. return a ? 1 : -1;
  10215. }
  10216. /**
  10217. * Returns a function to use in pseudos for input types
  10218. * @param {String} type
  10219. */
  10220. function createInputPseudo( type ) {
  10221. return function( elem ) {
  10222. var name = elem.nodeName.toLowerCase();
  10223. return name === "input" && elem.type === type;
  10224. };
  10225. }
  10226. /**
  10227. * Returns a function to use in pseudos for buttons
  10228. * @param {String} type
  10229. */
  10230. function createButtonPseudo( type ) {
  10231. return function( elem ) {
  10232. var name = elem.nodeName.toLowerCase();
  10233. return (name === "input" || name === "button") && elem.type === type;
  10234. };
  10235. }
  10236. /**
  10237. * Returns a function to use in pseudos for :enabled/:disabled
  10238. * @param {Boolean} disabled true for :disabled; false for :enabled
  10239. */
  10240. function createDisabledPseudo( disabled ) {
  10241. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10242. return function( elem ) {
  10243. // Only certain elements can match :enabled or :disabled
  10244. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10245. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10246. if ( "form" in elem ) {
  10247. // Check for inherited disabledness on relevant non-disabled elements:
  10248. // * listed form-associated elements in a disabled fieldset
  10249. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10250. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10251. // * option elements in a disabled optgroup
  10252. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10253. // All such elements have a "form" property.
  10254. if ( elem.parentNode && elem.disabled === false ) {
  10255. // Option elements defer to a parent optgroup if present
  10256. if ( "label" in elem ) {
  10257. if ( "label" in elem.parentNode ) {
  10258. return elem.parentNode.disabled === disabled;
  10259. } else {
  10260. return elem.disabled === disabled;
  10261. }
  10262. }
  10263. // Support: IE 6 - 11
  10264. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10265. return elem.isDisabled === disabled ||
  10266. // Where there is no isDisabled, check manually
  10267. /* jshint -W018 */
  10268. elem.isDisabled !== !disabled &&
  10269. inDisabledFieldset( elem ) === disabled;
  10270. }
  10271. return elem.disabled === disabled;
  10272. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10273. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10274. // even exist on them, let alone have a boolean value.
  10275. } else if ( "label" in elem ) {
  10276. return elem.disabled === disabled;
  10277. }
  10278. // Remaining elements are neither :enabled nor :disabled
  10279. return false;
  10280. };
  10281. }
  10282. /**
  10283. * Returns a function to use in pseudos for positionals
  10284. * @param {Function} fn
  10285. */
  10286. function createPositionalPseudo( fn ) {
  10287. return markFunction(function( argument ) {
  10288. argument = +argument;
  10289. return markFunction(function( seed, matches ) {
  10290. var j,
  10291. matchIndexes = fn( [], seed.length, argument ),
  10292. i = matchIndexes.length;
  10293. // Match elements found at the specified indexes
  10294. while ( i-- ) {
  10295. if ( seed[ (j = matchIndexes[i]) ] ) {
  10296. seed[j] = !(matches[j] = seed[j]);
  10297. }
  10298. }
  10299. });
  10300. });
  10301. }
  10302. /**
  10303. * Checks a node for validity as a Sizzle context
  10304. * @param {Element|Object=} context
  10305. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10306. */
  10307. function testContext( context ) {
  10308. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10309. }
  10310. // Expose support vars for convenience
  10311. support = Sizzle.support = {};
  10312. /**
  10313. * Detects XML nodes
  10314. * @param {Element|Object} elem An element or a document
  10315. * @returns {Boolean} True iff elem is a non-HTML XML node
  10316. */
  10317. isXML = Sizzle.isXML = function( elem ) {
  10318. var namespace = elem.namespaceURI,
  10319. docElem = (elem.ownerDocument || elem).documentElement;
  10320. // Support: IE <=8
  10321. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10322. // https://bugs.jquery.com/ticket/4833
  10323. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10324. };
  10325. /**
  10326. * Sets document-related variables once based on the current document
  10327. * @param {Element|Object} [doc] An element or document object to use to set the document
  10328. * @returns {Object} Returns the current document
  10329. */
  10330. setDocument = Sizzle.setDocument = function( node ) {
  10331. var hasCompare, subWindow,
  10332. doc = node ? node.ownerDocument || node : preferredDoc;
  10333. // Return early if doc is invalid or already selected
  10334. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10335. return document;
  10336. }
  10337. // Update global variables
  10338. document = doc;
  10339. docElem = document.documentElement;
  10340. documentIsHTML = !isXML( document );
  10341. // Support: IE 9-11, Edge
  10342. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10343. if ( preferredDoc !== document &&
  10344. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10345. // Support: IE 11, Edge
  10346. if ( subWindow.addEventListener ) {
  10347. subWindow.addEventListener( "unload", unloadHandler, false );
  10348. // Support: IE 9 - 10 only
  10349. } else if ( subWindow.attachEvent ) {
  10350. subWindow.attachEvent( "onunload", unloadHandler );
  10351. }
  10352. }
  10353. /* Attributes
  10354. ---------------------------------------------------------------------- */
  10355. // Support: IE<8
  10356. // Verify that getAttribute really returns attributes and not properties
  10357. // (excepting IE8 booleans)
  10358. support.attributes = assert(function( el ) {
  10359. el.className = "i";
  10360. return !el.getAttribute("className");
  10361. });
  10362. /* getElement(s)By*
  10363. ---------------------------------------------------------------------- */
  10364. // Check if getElementsByTagName("*") returns only elements
  10365. support.getElementsByTagName = assert(function( el ) {
  10366. el.appendChild( document.createComment("") );
  10367. return !el.getElementsByTagName("*").length;
  10368. });
  10369. // Support: IE<9
  10370. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10371. // Support: IE<10
  10372. // Check if getElementById returns elements by name
  10373. // The broken getElementById methods don't pick up programmatically-set names,
  10374. // so use a roundabout getElementsByName test
  10375. support.getById = assert(function( el ) {
  10376. docElem.appendChild( el ).id = expando;
  10377. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10378. });
  10379. // ID filter and find
  10380. if ( support.getById ) {
  10381. Expr.filter["ID"] = function( id ) {
  10382. var attrId = id.replace( runescape, funescape );
  10383. return function( elem ) {
  10384. return elem.getAttribute("id") === attrId;
  10385. };
  10386. };
  10387. Expr.find["ID"] = function( id, context ) {
  10388. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10389. var elem = context.getElementById( id );
  10390. return elem ? [ elem ] : [];
  10391. }
  10392. };
  10393. } else {
  10394. Expr.filter["ID"] = function( id ) {
  10395. var attrId = id.replace( runescape, funescape );
  10396. return function( elem ) {
  10397. var node = typeof elem.getAttributeNode !== "undefined" &&
  10398. elem.getAttributeNode("id");
  10399. return node && node.value === attrId;
  10400. };
  10401. };
  10402. // Support: IE 6 - 7 only
  10403. // getElementById is not reliable as a find shortcut
  10404. Expr.find["ID"] = function( id, context ) {
  10405. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10406. var node, i, elems,
  10407. elem = context.getElementById( id );
  10408. if ( elem ) {
  10409. // Verify the id attribute
  10410. node = elem.getAttributeNode("id");
  10411. if ( node && node.value === id ) {
  10412. return [ elem ];
  10413. }
  10414. // Fall back on getElementsByName
  10415. elems = context.getElementsByName( id );
  10416. i = 0;
  10417. while ( (elem = elems[i++]) ) {
  10418. node = elem.getAttributeNode("id");
  10419. if ( node && node.value === id ) {
  10420. return [ elem ];
  10421. }
  10422. }
  10423. }
  10424. return [];
  10425. }
  10426. };
  10427. }
  10428. // Tag
  10429. Expr.find["TAG"] = support.getElementsByTagName ?
  10430. function( tag, context ) {
  10431. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10432. return context.getElementsByTagName( tag );
  10433. // DocumentFragment nodes don't have gEBTN
  10434. } else if ( support.qsa ) {
  10435. return context.querySelectorAll( tag );
  10436. }
  10437. } :
  10438. function( tag, context ) {
  10439. var elem,
  10440. tmp = [],
  10441. i = 0,
  10442. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10443. results = context.getElementsByTagName( tag );
  10444. // Filter out possible comments
  10445. if ( tag === "*" ) {
  10446. while ( (elem = results[i++]) ) {
  10447. if ( elem.nodeType === 1 ) {
  10448. tmp.push( elem );
  10449. }
  10450. }
  10451. return tmp;
  10452. }
  10453. return results;
  10454. };
  10455. // Class
  10456. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10457. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10458. return context.getElementsByClassName( className );
  10459. }
  10460. };
  10461. /* QSA/matchesSelector
  10462. ---------------------------------------------------------------------- */
  10463. // QSA and matchesSelector support
  10464. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10465. rbuggyMatches = [];
  10466. // qSa(:focus) reports false when true (Chrome 21)
  10467. // We allow this because of a bug in IE8/9 that throws an error
  10468. // whenever `document.activeElement` is accessed on an iframe
  10469. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10470. // See https://bugs.jquery.com/ticket/13378
  10471. rbuggyQSA = [];
  10472. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10473. // Build QSA regex
  10474. // Regex strategy adopted from Diego Perini
  10475. assert(function( el ) {
  10476. // Select is set to empty string on purpose
  10477. // This is to test IE's treatment of not explicitly
  10478. // setting a boolean content attribute,
  10479. // since its presence should be enough
  10480. // https://bugs.jquery.com/ticket/12359
  10481. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10482. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10483. "<option selected=''></option></select>";
  10484. // Support: IE8, Opera 11-12.16
  10485. // Nothing should be selected when empty strings follow ^= or $= or *=
  10486. // The test attribute must be unknown in Opera but "safe" for WinRT
  10487. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10488. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10489. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10490. }
  10491. // Support: IE8
  10492. // Boolean attributes and "value" are not treated correctly
  10493. if ( !el.querySelectorAll("[selected]").length ) {
  10494. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10495. }
  10496. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10497. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10498. rbuggyQSA.push("~=");
  10499. }
  10500. // Webkit/Opera - :checked should return selected option elements
  10501. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10502. // IE8 throws error here and will not see later tests
  10503. if ( !el.querySelectorAll(":checked").length ) {
  10504. rbuggyQSA.push(":checked");
  10505. }
  10506. // Support: Safari 8+, iOS 8+
  10507. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10508. // In-page `selector#id sibling-combinator selector` fails
  10509. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10510. rbuggyQSA.push(".#.+[+~]");
  10511. }
  10512. });
  10513. assert(function( el ) {
  10514. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10515. "<select disabled='disabled'><option/></select>";
  10516. // Support: Windows 8 Native Apps
  10517. // The type and name attributes are restricted during .innerHTML assignment
  10518. var input = document.createElement("input");
  10519. input.setAttribute( "type", "hidden" );
  10520. el.appendChild( input ).setAttribute( "name", "D" );
  10521. // Support: IE8
  10522. // Enforce case-sensitivity of name attribute
  10523. if ( el.querySelectorAll("[name=d]").length ) {
  10524. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10525. }
  10526. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10527. // IE8 throws error here and will not see later tests
  10528. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10529. rbuggyQSA.push( ":enabled", ":disabled" );
  10530. }
  10531. // Support: IE9-11+
  10532. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10533. docElem.appendChild( el ).disabled = true;
  10534. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10535. rbuggyQSA.push( ":enabled", ":disabled" );
  10536. }
  10537. // Opera 10-11 does not throw on post-comma invalid pseudos
  10538. el.querySelectorAll("*,:x");
  10539. rbuggyQSA.push(",.*:");
  10540. });
  10541. }
  10542. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10543. docElem.webkitMatchesSelector ||
  10544. docElem.mozMatchesSelector ||
  10545. docElem.oMatchesSelector ||
  10546. docElem.msMatchesSelector) )) ) {
  10547. assert(function( el ) {
  10548. // Check to see if it's possible to do matchesSelector
  10549. // on a disconnected node (IE 9)
  10550. support.disconnectedMatch = matches.call( el, "*" );
  10551. // This should fail with an exception
  10552. // Gecko does not error, returns false instead
  10553. matches.call( el, "[s!='']:x" );
  10554. rbuggyMatches.push( "!=", pseudos );
  10555. });
  10556. }
  10557. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10558. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10559. /* Contains
  10560. ---------------------------------------------------------------------- */
  10561. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10562. // Element contains another
  10563. // Purposefully self-exclusive
  10564. // As in, an element does not contain itself
  10565. contains = hasCompare || rnative.test( docElem.contains ) ?
  10566. function( a, b ) {
  10567. var adown = a.nodeType === 9 ? a.documentElement : a,
  10568. bup = b && b.parentNode;
  10569. return a === bup || !!( bup && bup.nodeType === 1 && (
  10570. adown.contains ?
  10571. adown.contains( bup ) :
  10572. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10573. ));
  10574. } :
  10575. function( a, b ) {
  10576. if ( b ) {
  10577. while ( (b = b.parentNode) ) {
  10578. if ( b === a ) {
  10579. return true;
  10580. }
  10581. }
  10582. }
  10583. return false;
  10584. };
  10585. /* Sorting
  10586. ---------------------------------------------------------------------- */
  10587. // Document order sorting
  10588. sortOrder = hasCompare ?
  10589. function( a, b ) {
  10590. // Flag for duplicate removal
  10591. if ( a === b ) {
  10592. hasDuplicate = true;
  10593. return 0;
  10594. }
  10595. // Sort on method existence if only one input has compareDocumentPosition
  10596. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10597. if ( compare ) {
  10598. return compare;
  10599. }
  10600. // Calculate position if both inputs belong to the same document
  10601. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10602. a.compareDocumentPosition( b ) :
  10603. // Otherwise we know they are disconnected
  10604. 1;
  10605. // Disconnected nodes
  10606. if ( compare & 1 ||
  10607. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10608. // Choose the first element that is related to our preferred document
  10609. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10610. return -1;
  10611. }
  10612. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10613. return 1;
  10614. }
  10615. // Maintain original order
  10616. return sortInput ?
  10617. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10618. 0;
  10619. }
  10620. return compare & 4 ? -1 : 1;
  10621. } :
  10622. function( a, b ) {
  10623. // Exit early if the nodes are identical
  10624. if ( a === b ) {
  10625. hasDuplicate = true;
  10626. return 0;
  10627. }
  10628. var cur,
  10629. i = 0,
  10630. aup = a.parentNode,
  10631. bup = b.parentNode,
  10632. ap = [ a ],
  10633. bp = [ b ];
  10634. // Parentless nodes are either documents or disconnected
  10635. if ( !aup || !bup ) {
  10636. return a === document ? -1 :
  10637. b === document ? 1 :
  10638. aup ? -1 :
  10639. bup ? 1 :
  10640. sortInput ?
  10641. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10642. 0;
  10643. // If the nodes are siblings, we can do a quick check
  10644. } else if ( aup === bup ) {
  10645. return siblingCheck( a, b );
  10646. }
  10647. // Otherwise we need full lists of their ancestors for comparison
  10648. cur = a;
  10649. while ( (cur = cur.parentNode) ) {
  10650. ap.unshift( cur );
  10651. }
  10652. cur = b;
  10653. while ( (cur = cur.parentNode) ) {
  10654. bp.unshift( cur );
  10655. }
  10656. // Walk down the tree looking for a discrepancy
  10657. while ( ap[i] === bp[i] ) {
  10658. i++;
  10659. }
  10660. return i ?
  10661. // Do a sibling check if the nodes have a common ancestor
  10662. siblingCheck( ap[i], bp[i] ) :
  10663. // Otherwise nodes in our document sort first
  10664. ap[i] === preferredDoc ? -1 :
  10665. bp[i] === preferredDoc ? 1 :
  10666. 0;
  10667. };
  10668. return document;
  10669. };
  10670. Sizzle.matches = function( expr, elements ) {
  10671. return Sizzle( expr, null, null, elements );
  10672. };
  10673. Sizzle.matchesSelector = function( elem, expr ) {
  10674. // Set document vars if needed
  10675. if ( ( elem.ownerDocument || elem ) !== document ) {
  10676. setDocument( elem );
  10677. }
  10678. if ( support.matchesSelector && documentIsHTML &&
  10679. !nonnativeSelectorCache[ expr + " " ] &&
  10680. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10681. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10682. try {
  10683. var ret = matches.call( elem, expr );
  10684. // IE 9's matchesSelector returns false on disconnected nodes
  10685. if ( ret || support.disconnectedMatch ||
  10686. // As well, disconnected nodes are said to be in a document
  10687. // fragment in IE 9
  10688. elem.document && elem.document.nodeType !== 11 ) {
  10689. return ret;
  10690. }
  10691. } catch (e) {
  10692. nonnativeSelectorCache( expr, true );
  10693. }
  10694. }
  10695. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10696. };
  10697. Sizzle.contains = function( context, elem ) {
  10698. // Set document vars if needed
  10699. if ( ( context.ownerDocument || context ) !== document ) {
  10700. setDocument( context );
  10701. }
  10702. return contains( context, elem );
  10703. };
  10704. Sizzle.attr = function( elem, name ) {
  10705. // Set document vars if needed
  10706. if ( ( elem.ownerDocument || elem ) !== document ) {
  10707. setDocument( elem );
  10708. }
  10709. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10710. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10711. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10712. fn( elem, name, !documentIsHTML ) :
  10713. undefined;
  10714. return val !== undefined ?
  10715. val :
  10716. support.attributes || !documentIsHTML ?
  10717. elem.getAttribute( name ) :
  10718. (val = elem.getAttributeNode(name)) && val.specified ?
  10719. val.value :
  10720. null;
  10721. };
  10722. Sizzle.escape = function( sel ) {
  10723. return (sel + "").replace( rcssescape, fcssescape );
  10724. };
  10725. Sizzle.error = function( msg ) {
  10726. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10727. };
  10728. /**
  10729. * Document sorting and removing duplicates
  10730. * @param {ArrayLike} results
  10731. */
  10732. Sizzle.uniqueSort = function( results ) {
  10733. var elem,
  10734. duplicates = [],
  10735. j = 0,
  10736. i = 0;
  10737. // Unless we *know* we can detect duplicates, assume their presence
  10738. hasDuplicate = !support.detectDuplicates;
  10739. sortInput = !support.sortStable && results.slice( 0 );
  10740. results.sort( sortOrder );
  10741. if ( hasDuplicate ) {
  10742. while ( (elem = results[i++]) ) {
  10743. if ( elem === results[ i ] ) {
  10744. j = duplicates.push( i );
  10745. }
  10746. }
  10747. while ( j-- ) {
  10748. results.splice( duplicates[ j ], 1 );
  10749. }
  10750. }
  10751. // Clear input after sorting to release objects
  10752. // See https://github.com/jquery/sizzle/pull/225
  10753. sortInput = null;
  10754. return results;
  10755. };
  10756. /**
  10757. * Utility function for retrieving the text value of an array of DOM nodes
  10758. * @param {Array|Element} elem
  10759. */
  10760. getText = Sizzle.getText = function( elem ) {
  10761. var node,
  10762. ret = "",
  10763. i = 0,
  10764. nodeType = elem.nodeType;
  10765. if ( !nodeType ) {
  10766. // If no nodeType, this is expected to be an array
  10767. while ( (node = elem[i++]) ) {
  10768. // Do not traverse comment nodes
  10769. ret += getText( node );
  10770. }
  10771. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10772. // Use textContent for elements
  10773. // innerText usage removed for consistency of new lines (jQuery #11153)
  10774. if ( typeof elem.textContent === "string" ) {
  10775. return elem.textContent;
  10776. } else {
  10777. // Traverse its children
  10778. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10779. ret += getText( elem );
  10780. }
  10781. }
  10782. } else if ( nodeType === 3 || nodeType === 4 ) {
  10783. return elem.nodeValue;
  10784. }
  10785. // Do not include comment or processing instruction nodes
  10786. return ret;
  10787. };
  10788. Expr = Sizzle.selectors = {
  10789. // Can be adjusted by the user
  10790. cacheLength: 50,
  10791. createPseudo: markFunction,
  10792. match: matchExpr,
  10793. attrHandle: {},
  10794. find: {},
  10795. relative: {
  10796. ">": { dir: "parentNode", first: true },
  10797. " ": { dir: "parentNode" },
  10798. "+": { dir: "previousSibling", first: true },
  10799. "~": { dir: "previousSibling" }
  10800. },
  10801. preFilter: {
  10802. "ATTR": function( match ) {
  10803. match[1] = match[1].replace( runescape, funescape );
  10804. // Move the given value to match[3] whether quoted or unquoted
  10805. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10806. if ( match[2] === "~=" ) {
  10807. match[3] = " " + match[3] + " ";
  10808. }
  10809. return match.slice( 0, 4 );
  10810. },
  10811. "CHILD": function( match ) {
  10812. /* matches from matchExpr["CHILD"]
  10813. 1 type (only|nth|...)
  10814. 2 what (child|of-type)
  10815. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10816. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10817. 5 sign of xn-component
  10818. 6 x of xn-component
  10819. 7 sign of y-component
  10820. 8 y of y-component
  10821. */
  10822. match[1] = match[1].toLowerCase();
  10823. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10824. // nth-* requires argument
  10825. if ( !match[3] ) {
  10826. Sizzle.error( match[0] );
  10827. }
  10828. // numeric x and y parameters for Expr.filter.CHILD
  10829. // remember that false/true cast respectively to 0/1
  10830. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10831. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10832. // other types prohibit arguments
  10833. } else if ( match[3] ) {
  10834. Sizzle.error( match[0] );
  10835. }
  10836. return match;
  10837. },
  10838. "PSEUDO": function( match ) {
  10839. var excess,
  10840. unquoted = !match[6] && match[2];
  10841. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10842. return null;
  10843. }
  10844. // Accept quoted arguments as-is
  10845. if ( match[3] ) {
  10846. match[2] = match[4] || match[5] || "";
  10847. // Strip excess characters from unquoted arguments
  10848. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10849. // Get excess from tokenize (recursively)
  10850. (excess = tokenize( unquoted, true )) &&
  10851. // advance to the next closing parenthesis
  10852. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10853. // excess is a negative index
  10854. match[0] = match[0].slice( 0, excess );
  10855. match[2] = unquoted.slice( 0, excess );
  10856. }
  10857. // Return only captures needed by the pseudo filter method (type and argument)
  10858. return match.slice( 0, 3 );
  10859. }
  10860. },
  10861. filter: {
  10862. "TAG": function( nodeNameSelector ) {
  10863. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10864. return nodeNameSelector === "*" ?
  10865. function() { return true; } :
  10866. function( elem ) {
  10867. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10868. };
  10869. },
  10870. "CLASS": function( className ) {
  10871. var pattern = classCache[ className + " " ];
  10872. return pattern ||
  10873. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10874. classCache( className, function( elem ) {
  10875. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10876. });
  10877. },
  10878. "ATTR": function( name, operator, check ) {
  10879. return function( elem ) {
  10880. var result = Sizzle.attr( elem, name );
  10881. if ( result == null ) {
  10882. return operator === "!=";
  10883. }
  10884. if ( !operator ) {
  10885. return true;
  10886. }
  10887. result += "";
  10888. return operator === "=" ? result === check :
  10889. operator === "!=" ? result !== check :
  10890. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10891. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10892. operator === "$=" ? check && result.slice( -check.length ) === check :
  10893. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10894. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10895. false;
  10896. };
  10897. },
  10898. "CHILD": function( type, what, argument, first, last ) {
  10899. var simple = type.slice( 0, 3 ) !== "nth",
  10900. forward = type.slice( -4 ) !== "last",
  10901. ofType = what === "of-type";
  10902. return first === 1 && last === 0 ?
  10903. // Shortcut for :nth-*(n)
  10904. function( elem ) {
  10905. return !!elem.parentNode;
  10906. } :
  10907. function( elem, context, xml ) {
  10908. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10909. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10910. parent = elem.parentNode,
  10911. name = ofType && elem.nodeName.toLowerCase(),
  10912. useCache = !xml && !ofType,
  10913. diff = false;
  10914. if ( parent ) {
  10915. // :(first|last|only)-(child|of-type)
  10916. if ( simple ) {
  10917. while ( dir ) {
  10918. node = elem;
  10919. while ( (node = node[ dir ]) ) {
  10920. if ( ofType ?
  10921. node.nodeName.toLowerCase() === name :
  10922. node.nodeType === 1 ) {
  10923. return false;
  10924. }
  10925. }
  10926. // Reverse direction for :only-* (if we haven't yet done so)
  10927. start = dir = type === "only" && !start && "nextSibling";
  10928. }
  10929. return true;
  10930. }
  10931. start = [ forward ? parent.firstChild : parent.lastChild ];
  10932. // non-xml :nth-child(...) stores cache data on `parent`
  10933. if ( forward && useCache ) {
  10934. // Seek `elem` from a previously-cached index
  10935. // ...in a gzip-friendly way
  10936. node = parent;
  10937. outerCache = node[ expando ] || (node[ expando ] = {});
  10938. // Support: IE <9 only
  10939. // Defend against cloned attroperties (jQuery gh-1709)
  10940. uniqueCache = outerCache[ node.uniqueID ] ||
  10941. (outerCache[ node.uniqueID ] = {});
  10942. cache = uniqueCache[ type ] || [];
  10943. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10944. diff = nodeIndex && cache[ 2 ];
  10945. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10946. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10947. // Fallback to seeking `elem` from the start
  10948. (diff = nodeIndex = 0) || start.pop()) ) {
  10949. // When found, cache indexes on `parent` and break
  10950. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10951. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10952. break;
  10953. }
  10954. }
  10955. } else {
  10956. // Use previously-cached element index if available
  10957. if ( useCache ) {
  10958. // ...in a gzip-friendly way
  10959. node = elem;
  10960. outerCache = node[ expando ] || (node[ expando ] = {});
  10961. // Support: IE <9 only
  10962. // Defend against cloned attroperties (jQuery gh-1709)
  10963. uniqueCache = outerCache[ node.uniqueID ] ||
  10964. (outerCache[ node.uniqueID ] = {});
  10965. cache = uniqueCache[ type ] || [];
  10966. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10967. diff = nodeIndex;
  10968. }
  10969. // xml :nth-child(...)
  10970. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10971. if ( diff === false ) {
  10972. // Use the same loop as above to seek `elem` from the start
  10973. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10974. (diff = nodeIndex = 0) || start.pop()) ) {
  10975. if ( ( ofType ?
  10976. node.nodeName.toLowerCase() === name :
  10977. node.nodeType === 1 ) &&
  10978. ++diff ) {
  10979. // Cache the index of each encountered element
  10980. if ( useCache ) {
  10981. outerCache = node[ expando ] || (node[ expando ] = {});
  10982. // Support: IE <9 only
  10983. // Defend against cloned attroperties (jQuery gh-1709)
  10984. uniqueCache = outerCache[ node.uniqueID ] ||
  10985. (outerCache[ node.uniqueID ] = {});
  10986. uniqueCache[ type ] = [ dirruns, diff ];
  10987. }
  10988. if ( node === elem ) {
  10989. break;
  10990. }
  10991. }
  10992. }
  10993. }
  10994. }
  10995. // Incorporate the offset, then check against cycle size
  10996. diff -= last;
  10997. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10998. }
  10999. };
  11000. },
  11001. "PSEUDO": function( pseudo, argument ) {
  11002. // pseudo-class names are case-insensitive
  11003. // http://www.w3.org/TR/selectors/#pseudo-classes
  11004. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  11005. // Remember that setFilters inherits from pseudos
  11006. var args,
  11007. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  11008. Sizzle.error( "unsupported pseudo: " + pseudo );
  11009. // The user may use createPseudo to indicate that
  11010. // arguments are needed to create the filter function
  11011. // just as Sizzle does
  11012. if ( fn[ expando ] ) {
  11013. return fn( argument );
  11014. }
  11015. // But maintain support for old signatures
  11016. if ( fn.length > 1 ) {
  11017. args = [ pseudo, pseudo, "", argument ];
  11018. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11019. markFunction(function( seed, matches ) {
  11020. var idx,
  11021. matched = fn( seed, argument ),
  11022. i = matched.length;
  11023. while ( i-- ) {
  11024. idx = indexOf( seed, matched[i] );
  11025. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11026. }
  11027. }) :
  11028. function( elem ) {
  11029. return fn( elem, 0, args );
  11030. };
  11031. }
  11032. return fn;
  11033. }
  11034. },
  11035. pseudos: {
  11036. // Potentially complex pseudos
  11037. "not": markFunction(function( selector ) {
  11038. // Trim the selector passed to compile
  11039. // to avoid treating leading and trailing
  11040. // spaces as combinators
  11041. var input = [],
  11042. results = [],
  11043. matcher = compile( selector.replace( rtrim, "$1" ) );
  11044. return matcher[ expando ] ?
  11045. markFunction(function( seed, matches, context, xml ) {
  11046. var elem,
  11047. unmatched = matcher( seed, null, xml, [] ),
  11048. i = seed.length;
  11049. // Match elements unmatched by `matcher`
  11050. while ( i-- ) {
  11051. if ( (elem = unmatched[i]) ) {
  11052. seed[i] = !(matches[i] = elem);
  11053. }
  11054. }
  11055. }) :
  11056. function( elem, context, xml ) {
  11057. input[0] = elem;
  11058. matcher( input, null, xml, results );
  11059. // Don't keep the element (issue #299)
  11060. input[0] = null;
  11061. return !results.pop();
  11062. };
  11063. }),
  11064. "has": markFunction(function( selector ) {
  11065. return function( elem ) {
  11066. return Sizzle( selector, elem ).length > 0;
  11067. };
  11068. }),
  11069. "contains": markFunction(function( text ) {
  11070. text = text.replace( runescape, funescape );
  11071. return function( elem ) {
  11072. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11073. };
  11074. }),
  11075. // "Whether an element is represented by a :lang() selector
  11076. // is based solely on the element's language value
  11077. // being equal to the identifier C,
  11078. // or beginning with the identifier C immediately followed by "-".
  11079. // The matching of C against the element's language value is performed case-insensitively.
  11080. // The identifier C does not have to be a valid language name."
  11081. // http://www.w3.org/TR/selectors/#lang-pseudo
  11082. "lang": markFunction( function( lang ) {
  11083. // lang value must be a valid identifier
  11084. if ( !ridentifier.test(lang || "") ) {
  11085. Sizzle.error( "unsupported lang: " + lang );
  11086. }
  11087. lang = lang.replace( runescape, funescape ).toLowerCase();
  11088. return function( elem ) {
  11089. var elemLang;
  11090. do {
  11091. if ( (elemLang = documentIsHTML ?
  11092. elem.lang :
  11093. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11094. elemLang = elemLang.toLowerCase();
  11095. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11096. }
  11097. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11098. return false;
  11099. };
  11100. }),
  11101. // Miscellaneous
  11102. "target": function( elem ) {
  11103. var hash = window.location && window.location.hash;
  11104. return hash && hash.slice( 1 ) === elem.id;
  11105. },
  11106. "root": function( elem ) {
  11107. return elem === docElem;
  11108. },
  11109. "focus": function( elem ) {
  11110. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11111. },
  11112. // Boolean properties
  11113. "enabled": createDisabledPseudo( false ),
  11114. "disabled": createDisabledPseudo( true ),
  11115. "checked": function( elem ) {
  11116. // In CSS3, :checked should return both checked and selected elements
  11117. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11118. var nodeName = elem.nodeName.toLowerCase();
  11119. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11120. },
  11121. "selected": function( elem ) {
  11122. // Accessing this property makes selected-by-default
  11123. // options in Safari work properly
  11124. if ( elem.parentNode ) {
  11125. elem.parentNode.selectedIndex;
  11126. }
  11127. return elem.selected === true;
  11128. },
  11129. // Contents
  11130. "empty": function( elem ) {
  11131. // http://www.w3.org/TR/selectors/#empty-pseudo
  11132. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11133. // but not by others (comment: 8; processing instruction: 7; etc.)
  11134. // nodeType < 6 works because attributes (2) do not appear as children
  11135. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11136. if ( elem.nodeType < 6 ) {
  11137. return false;
  11138. }
  11139. }
  11140. return true;
  11141. },
  11142. "parent": function( elem ) {
  11143. return !Expr.pseudos["empty"]( elem );
  11144. },
  11145. // Element/input types
  11146. "header": function( elem ) {
  11147. return rheader.test( elem.nodeName );
  11148. },
  11149. "input": function( elem ) {
  11150. return rinputs.test( elem.nodeName );
  11151. },
  11152. "button": function( elem ) {
  11153. var name = elem.nodeName.toLowerCase();
  11154. return name === "input" && elem.type === "button" || name === "button";
  11155. },
  11156. "text": function( elem ) {
  11157. var attr;
  11158. return elem.nodeName.toLowerCase() === "input" &&
  11159. elem.type === "text" &&
  11160. // Support: IE<8
  11161. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11162. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11163. },
  11164. // Position-in-collection
  11165. "first": createPositionalPseudo(function() {
  11166. return [ 0 ];
  11167. }),
  11168. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11169. return [ length - 1 ];
  11170. }),
  11171. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11172. return [ argument < 0 ? argument + length : argument ];
  11173. }),
  11174. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11175. var i = 0;
  11176. for ( ; i < length; i += 2 ) {
  11177. matchIndexes.push( i );
  11178. }
  11179. return matchIndexes;
  11180. }),
  11181. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11182. var i = 1;
  11183. for ( ; i < length; i += 2 ) {
  11184. matchIndexes.push( i );
  11185. }
  11186. return matchIndexes;
  11187. }),
  11188. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11189. var i = argument < 0 ?
  11190. argument + length :
  11191. argument > length ?
  11192. length :
  11193. argument;
  11194. for ( ; --i >= 0; ) {
  11195. matchIndexes.push( i );
  11196. }
  11197. return matchIndexes;
  11198. }),
  11199. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11200. var i = argument < 0 ? argument + length : argument;
  11201. for ( ; ++i < length; ) {
  11202. matchIndexes.push( i );
  11203. }
  11204. return matchIndexes;
  11205. })
  11206. }
  11207. };
  11208. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11209. // Add button/input type pseudos
  11210. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11211. Expr.pseudos[ i ] = createInputPseudo( i );
  11212. }
  11213. for ( i in { submit: true, reset: true } ) {
  11214. Expr.pseudos[ i ] = createButtonPseudo( i );
  11215. }
  11216. // Easy API for creating new setFilters
  11217. function setFilters() {}
  11218. setFilters.prototype = Expr.filters = Expr.pseudos;
  11219. Expr.setFilters = new setFilters();
  11220. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11221. var matched, match, tokens, type,
  11222. soFar, groups, preFilters,
  11223. cached = tokenCache[ selector + " " ];
  11224. if ( cached ) {
  11225. return parseOnly ? 0 : cached.slice( 0 );
  11226. }
  11227. soFar = selector;
  11228. groups = [];
  11229. preFilters = Expr.preFilter;
  11230. while ( soFar ) {
  11231. // Comma and first run
  11232. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11233. if ( match ) {
  11234. // Don't consume trailing commas as valid
  11235. soFar = soFar.slice( match[0].length ) || soFar;
  11236. }
  11237. groups.push( (tokens = []) );
  11238. }
  11239. matched = false;
  11240. // Combinators
  11241. if ( (match = rcombinators.exec( soFar )) ) {
  11242. matched = match.shift();
  11243. tokens.push({
  11244. value: matched,
  11245. // Cast descendant combinators to space
  11246. type: match[0].replace( rtrim, " " )
  11247. });
  11248. soFar = soFar.slice( matched.length );
  11249. }
  11250. // Filters
  11251. for ( type in Expr.filter ) {
  11252. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11253. (match = preFilters[ type ]( match ))) ) {
  11254. matched = match.shift();
  11255. tokens.push({
  11256. value: matched,
  11257. type: type,
  11258. matches: match
  11259. });
  11260. soFar = soFar.slice( matched.length );
  11261. }
  11262. }
  11263. if ( !matched ) {
  11264. break;
  11265. }
  11266. }
  11267. // Return the length of the invalid excess
  11268. // if we're just parsing
  11269. // Otherwise, throw an error or return tokens
  11270. return parseOnly ?
  11271. soFar.length :
  11272. soFar ?
  11273. Sizzle.error( selector ) :
  11274. // Cache the tokens
  11275. tokenCache( selector, groups ).slice( 0 );
  11276. };
  11277. function toSelector( tokens ) {
  11278. var i = 0,
  11279. len = tokens.length,
  11280. selector = "";
  11281. for ( ; i < len; i++ ) {
  11282. selector += tokens[i].value;
  11283. }
  11284. return selector;
  11285. }
  11286. function addCombinator( matcher, combinator, base ) {
  11287. var dir = combinator.dir,
  11288. skip = combinator.next,
  11289. key = skip || dir,
  11290. checkNonElements = base && key === "parentNode",
  11291. doneName = done++;
  11292. return combinator.first ?
  11293. // Check against closest ancestor/preceding element
  11294. function( elem, context, xml ) {
  11295. while ( (elem = elem[ dir ]) ) {
  11296. if ( elem.nodeType === 1 || checkNonElements ) {
  11297. return matcher( elem, context, xml );
  11298. }
  11299. }
  11300. return false;
  11301. } :
  11302. // Check against all ancestor/preceding elements
  11303. function( elem, context, xml ) {
  11304. var oldCache, uniqueCache, outerCache,
  11305. newCache = [ dirruns, doneName ];
  11306. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11307. if ( xml ) {
  11308. while ( (elem = elem[ dir ]) ) {
  11309. if ( elem.nodeType === 1 || checkNonElements ) {
  11310. if ( matcher( elem, context, xml ) ) {
  11311. return true;
  11312. }
  11313. }
  11314. }
  11315. } else {
  11316. while ( (elem = elem[ dir ]) ) {
  11317. if ( elem.nodeType === 1 || checkNonElements ) {
  11318. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11319. // Support: IE <9 only
  11320. // Defend against cloned attroperties (jQuery gh-1709)
  11321. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11322. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11323. elem = elem[ dir ] || elem;
  11324. } else if ( (oldCache = uniqueCache[ key ]) &&
  11325. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11326. // Assign to newCache so results back-propagate to previous elements
  11327. return (newCache[ 2 ] = oldCache[ 2 ]);
  11328. } else {
  11329. // Reuse newcache so results back-propagate to previous elements
  11330. uniqueCache[ key ] = newCache;
  11331. // A match means we're done; a fail means we have to keep checking
  11332. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11333. return true;
  11334. }
  11335. }
  11336. }
  11337. }
  11338. }
  11339. return false;
  11340. };
  11341. }
  11342. function elementMatcher( matchers ) {
  11343. return matchers.length > 1 ?
  11344. function( elem, context, xml ) {
  11345. var i = matchers.length;
  11346. while ( i-- ) {
  11347. if ( !matchers[i]( elem, context, xml ) ) {
  11348. return false;
  11349. }
  11350. }
  11351. return true;
  11352. } :
  11353. matchers[0];
  11354. }
  11355. function multipleContexts( selector, contexts, results ) {
  11356. var i = 0,
  11357. len = contexts.length;
  11358. for ( ; i < len; i++ ) {
  11359. Sizzle( selector, contexts[i], results );
  11360. }
  11361. return results;
  11362. }
  11363. function condense( unmatched, map, filter, context, xml ) {
  11364. var elem,
  11365. newUnmatched = [],
  11366. i = 0,
  11367. len = unmatched.length,
  11368. mapped = map != null;
  11369. for ( ; i < len; i++ ) {
  11370. if ( (elem = unmatched[i]) ) {
  11371. if ( !filter || filter( elem, context, xml ) ) {
  11372. newUnmatched.push( elem );
  11373. if ( mapped ) {
  11374. map.push( i );
  11375. }
  11376. }
  11377. }
  11378. }
  11379. return newUnmatched;
  11380. }
  11381. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11382. if ( postFilter && !postFilter[ expando ] ) {
  11383. postFilter = setMatcher( postFilter );
  11384. }
  11385. if ( postFinder && !postFinder[ expando ] ) {
  11386. postFinder = setMatcher( postFinder, postSelector );
  11387. }
  11388. return markFunction(function( seed, results, context, xml ) {
  11389. var temp, i, elem,
  11390. preMap = [],
  11391. postMap = [],
  11392. preexisting = results.length,
  11393. // Get initial elements from seed or context
  11394. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11395. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11396. matcherIn = preFilter && ( seed || !selector ) ?
  11397. condense( elems, preMap, preFilter, context, xml ) :
  11398. elems,
  11399. matcherOut = matcher ?
  11400. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11401. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11402. // ...intermediate processing is necessary
  11403. [] :
  11404. // ...otherwise use results directly
  11405. results :
  11406. matcherIn;
  11407. // Find primary matches
  11408. if ( matcher ) {
  11409. matcher( matcherIn, matcherOut, context, xml );
  11410. }
  11411. // Apply postFilter
  11412. if ( postFilter ) {
  11413. temp = condense( matcherOut, postMap );
  11414. postFilter( temp, [], context, xml );
  11415. // Un-match failing elements by moving them back to matcherIn
  11416. i = temp.length;
  11417. while ( i-- ) {
  11418. if ( (elem = temp[i]) ) {
  11419. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11420. }
  11421. }
  11422. }
  11423. if ( seed ) {
  11424. if ( postFinder || preFilter ) {
  11425. if ( postFinder ) {
  11426. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11427. temp = [];
  11428. i = matcherOut.length;
  11429. while ( i-- ) {
  11430. if ( (elem = matcherOut[i]) ) {
  11431. // Restore matcherIn since elem is not yet a final match
  11432. temp.push( (matcherIn[i] = elem) );
  11433. }
  11434. }
  11435. postFinder( null, (matcherOut = []), temp, xml );
  11436. }
  11437. // Move matched elements from seed to results to keep them synchronized
  11438. i = matcherOut.length;
  11439. while ( i-- ) {
  11440. if ( (elem = matcherOut[i]) &&
  11441. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11442. seed[temp] = !(results[temp] = elem);
  11443. }
  11444. }
  11445. }
  11446. // Add elements to results, through postFinder if defined
  11447. } else {
  11448. matcherOut = condense(
  11449. matcherOut === results ?
  11450. matcherOut.splice( preexisting, matcherOut.length ) :
  11451. matcherOut
  11452. );
  11453. if ( postFinder ) {
  11454. postFinder( null, results, matcherOut, xml );
  11455. } else {
  11456. push.apply( results, matcherOut );
  11457. }
  11458. }
  11459. });
  11460. }
  11461. function matcherFromTokens( tokens ) {
  11462. var checkContext, matcher, j,
  11463. len = tokens.length,
  11464. leadingRelative = Expr.relative[ tokens[0].type ],
  11465. implicitRelative = leadingRelative || Expr.relative[" "],
  11466. i = leadingRelative ? 1 : 0,
  11467. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11468. matchContext = addCombinator( function( elem ) {
  11469. return elem === checkContext;
  11470. }, implicitRelative, true ),
  11471. matchAnyContext = addCombinator( function( elem ) {
  11472. return indexOf( checkContext, elem ) > -1;
  11473. }, implicitRelative, true ),
  11474. matchers = [ function( elem, context, xml ) {
  11475. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11476. (checkContext = context).nodeType ?
  11477. matchContext( elem, context, xml ) :
  11478. matchAnyContext( elem, context, xml ) );
  11479. // Avoid hanging onto element (issue #299)
  11480. checkContext = null;
  11481. return ret;
  11482. } ];
  11483. for ( ; i < len; i++ ) {
  11484. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11485. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11486. } else {
  11487. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11488. // Return special upon seeing a positional matcher
  11489. if ( matcher[ expando ] ) {
  11490. // Find the next relative operator (if any) for proper handling
  11491. j = ++i;
  11492. for ( ; j < len; j++ ) {
  11493. if ( Expr.relative[ tokens[j].type ] ) {
  11494. break;
  11495. }
  11496. }
  11497. return setMatcher(
  11498. i > 1 && elementMatcher( matchers ),
  11499. i > 1 && toSelector(
  11500. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11501. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11502. ).replace( rtrim, "$1" ),
  11503. matcher,
  11504. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11505. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11506. j < len && toSelector( tokens )
  11507. );
  11508. }
  11509. matchers.push( matcher );
  11510. }
  11511. }
  11512. return elementMatcher( matchers );
  11513. }
  11514. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11515. var bySet = setMatchers.length > 0,
  11516. byElement = elementMatchers.length > 0,
  11517. superMatcher = function( seed, context, xml, results, outermost ) {
  11518. var elem, j, matcher,
  11519. matchedCount = 0,
  11520. i = "0",
  11521. unmatched = seed && [],
  11522. setMatched = [],
  11523. contextBackup = outermostContext,
  11524. // We must always have either seed elements or outermost context
  11525. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11526. // Use integer dirruns iff this is the outermost matcher
  11527. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11528. len = elems.length;
  11529. if ( outermost ) {
  11530. outermostContext = context === document || context || outermost;
  11531. }
  11532. // Add elements passing elementMatchers directly to results
  11533. // Support: IE<9, Safari
  11534. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11535. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11536. if ( byElement && elem ) {
  11537. j = 0;
  11538. if ( !context && elem.ownerDocument !== document ) {
  11539. setDocument( elem );
  11540. xml = !documentIsHTML;
  11541. }
  11542. while ( (matcher = elementMatchers[j++]) ) {
  11543. if ( matcher( elem, context || document, xml) ) {
  11544. results.push( elem );
  11545. break;
  11546. }
  11547. }
  11548. if ( outermost ) {
  11549. dirruns = dirrunsUnique;
  11550. }
  11551. }
  11552. // Track unmatched elements for set filters
  11553. if ( bySet ) {
  11554. // They will have gone through all possible matchers
  11555. if ( (elem = !matcher && elem) ) {
  11556. matchedCount--;
  11557. }
  11558. // Lengthen the array for every element, matched or not
  11559. if ( seed ) {
  11560. unmatched.push( elem );
  11561. }
  11562. }
  11563. }
  11564. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11565. // makes the latter nonnegative.
  11566. matchedCount += i;
  11567. // Apply set filters to unmatched elements
  11568. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11569. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11570. // no element matchers and no seed.
  11571. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11572. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11573. // numerically zero.
  11574. if ( bySet && i !== matchedCount ) {
  11575. j = 0;
  11576. while ( (matcher = setMatchers[j++]) ) {
  11577. matcher( unmatched, setMatched, context, xml );
  11578. }
  11579. if ( seed ) {
  11580. // Reintegrate element matches to eliminate the need for sorting
  11581. if ( matchedCount > 0 ) {
  11582. while ( i-- ) {
  11583. if ( !(unmatched[i] || setMatched[i]) ) {
  11584. setMatched[i] = pop.call( results );
  11585. }
  11586. }
  11587. }
  11588. // Discard index placeholder values to get only actual matches
  11589. setMatched = condense( setMatched );
  11590. }
  11591. // Add matches to results
  11592. push.apply( results, setMatched );
  11593. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11594. if ( outermost && !seed && setMatched.length > 0 &&
  11595. ( matchedCount + setMatchers.length ) > 1 ) {
  11596. Sizzle.uniqueSort( results );
  11597. }
  11598. }
  11599. // Override manipulation of globals by nested matchers
  11600. if ( outermost ) {
  11601. dirruns = dirrunsUnique;
  11602. outermostContext = contextBackup;
  11603. }
  11604. return unmatched;
  11605. };
  11606. return bySet ?
  11607. markFunction( superMatcher ) :
  11608. superMatcher;
  11609. }
  11610. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11611. var i,
  11612. setMatchers = [],
  11613. elementMatchers = [],
  11614. cached = compilerCache[ selector + " " ];
  11615. if ( !cached ) {
  11616. // Generate a function of recursive functions that can be used to check each element
  11617. if ( !match ) {
  11618. match = tokenize( selector );
  11619. }
  11620. i = match.length;
  11621. while ( i-- ) {
  11622. cached = matcherFromTokens( match[i] );
  11623. if ( cached[ expando ] ) {
  11624. setMatchers.push( cached );
  11625. } else {
  11626. elementMatchers.push( cached );
  11627. }
  11628. }
  11629. // Cache the compiled function
  11630. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11631. // Save selector and tokenization
  11632. cached.selector = selector;
  11633. }
  11634. return cached;
  11635. };
  11636. /**
  11637. * A low-level selection function that works with Sizzle's compiled
  11638. * selector functions
  11639. * @param {String|Function} selector A selector or a pre-compiled
  11640. * selector function built with Sizzle.compile
  11641. * @param {Element} context
  11642. * @param {Array} [results]
  11643. * @param {Array} [seed] A set of elements to match against
  11644. */
  11645. select = Sizzle.select = function( selector, context, results, seed ) {
  11646. var i, tokens, token, type, find,
  11647. compiled = typeof selector === "function" && selector,
  11648. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11649. results = results || [];
  11650. // Try to minimize operations if there is only one selector in the list and no seed
  11651. // (the latter of which guarantees us context)
  11652. if ( match.length === 1 ) {
  11653. // Reduce context if the leading compound selector is an ID
  11654. tokens = match[0] = match[0].slice( 0 );
  11655. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11656. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11657. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11658. if ( !context ) {
  11659. return results;
  11660. // Precompiled matchers will still verify ancestry, so step up a level
  11661. } else if ( compiled ) {
  11662. context = context.parentNode;
  11663. }
  11664. selector = selector.slice( tokens.shift().value.length );
  11665. }
  11666. // Fetch a seed set for right-to-left matching
  11667. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11668. while ( i-- ) {
  11669. token = tokens[i];
  11670. // Abort if we hit a combinator
  11671. if ( Expr.relative[ (type = token.type) ] ) {
  11672. break;
  11673. }
  11674. if ( (find = Expr.find[ type ]) ) {
  11675. // Search, expanding context for leading sibling combinators
  11676. if ( (seed = find(
  11677. token.matches[0].replace( runescape, funescape ),
  11678. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11679. )) ) {
  11680. // If seed is empty or no tokens remain, we can return early
  11681. tokens.splice( i, 1 );
  11682. selector = seed.length && toSelector( tokens );
  11683. if ( !selector ) {
  11684. push.apply( results, seed );
  11685. return results;
  11686. }
  11687. break;
  11688. }
  11689. }
  11690. }
  11691. }
  11692. // Compile and execute a filtering function if one is not provided
  11693. // Provide `match` to avoid retokenization if we modified the selector above
  11694. ( compiled || compile( selector, match ) )(
  11695. seed,
  11696. context,
  11697. !documentIsHTML,
  11698. results,
  11699. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11700. );
  11701. return results;
  11702. };
  11703. // One-time assignments
  11704. // Sort stability
  11705. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11706. // Support: Chrome 14-35+
  11707. // Always assume duplicates if they aren't passed to the comparison function
  11708. support.detectDuplicates = !!hasDuplicate;
  11709. // Initialize against the default document
  11710. setDocument();
  11711. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11712. // Detached nodes confoundingly follow *each other*
  11713. support.sortDetached = assert(function( el ) {
  11714. // Should return 1, but returns 4 (following)
  11715. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11716. });
  11717. // Support: IE<8
  11718. // Prevent attribute/property "interpolation"
  11719. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11720. if ( !assert(function( el ) {
  11721. el.innerHTML = "<a href='#'></a>";
  11722. return el.firstChild.getAttribute("href") === "#" ;
  11723. }) ) {
  11724. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11725. if ( !isXML ) {
  11726. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11727. }
  11728. });
  11729. }
  11730. // Support: IE<9
  11731. // Use defaultValue in place of getAttribute("value")
  11732. if ( !support.attributes || !assert(function( el ) {
  11733. el.innerHTML = "<input/>";
  11734. el.firstChild.setAttribute( "value", "" );
  11735. return el.firstChild.getAttribute( "value" ) === "";
  11736. }) ) {
  11737. addHandle( "value", function( elem, name, isXML ) {
  11738. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11739. return elem.defaultValue;
  11740. }
  11741. });
  11742. }
  11743. // Support: IE<9
  11744. // Use getAttributeNode to fetch booleans when getAttribute lies
  11745. if ( !assert(function( el ) {
  11746. return el.getAttribute("disabled") == null;
  11747. }) ) {
  11748. addHandle( booleans, function( elem, name, isXML ) {
  11749. var val;
  11750. if ( !isXML ) {
  11751. return elem[ name ] === true ? name.toLowerCase() :
  11752. (val = elem.getAttributeNode( name )) && val.specified ?
  11753. val.value :
  11754. null;
  11755. }
  11756. });
  11757. }
  11758. return Sizzle;
  11759. })( window );
  11760. jQuery.find = Sizzle;
  11761. jQuery.expr = Sizzle.selectors;
  11762. // Deprecated
  11763. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11764. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11765. jQuery.text = Sizzle.getText;
  11766. jQuery.isXMLDoc = Sizzle.isXML;
  11767. jQuery.contains = Sizzle.contains;
  11768. jQuery.escapeSelector = Sizzle.escape;
  11769. var dir = function( elem, dir, until ) {
  11770. var matched = [],
  11771. truncate = until !== undefined;
  11772. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11773. if ( elem.nodeType === 1 ) {
  11774. if ( truncate && jQuery( elem ).is( until ) ) {
  11775. break;
  11776. }
  11777. matched.push( elem );
  11778. }
  11779. }
  11780. return matched;
  11781. };
  11782. var siblings = function( n, elem ) {
  11783. var matched = [];
  11784. for ( ; n; n = n.nextSibling ) {
  11785. if ( n.nodeType === 1 && n !== elem ) {
  11786. matched.push( n );
  11787. }
  11788. }
  11789. return matched;
  11790. };
  11791. var rneedsContext = jQuery.expr.match.needsContext;
  11792. function nodeName( elem, name ) {
  11793. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11794. };
  11795. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11796. // Implement the identical functionality for filter and not
  11797. function winnow( elements, qualifier, not ) {
  11798. if ( isFunction( qualifier ) ) {
  11799. return jQuery.grep( elements, function( elem, i ) {
  11800. return !!qualifier.call( elem, i, elem ) !== not;
  11801. } );
  11802. }
  11803. // Single element
  11804. if ( qualifier.nodeType ) {
  11805. return jQuery.grep( elements, function( elem ) {
  11806. return ( elem === qualifier ) !== not;
  11807. } );
  11808. }
  11809. // Arraylike of elements (jQuery, arguments, Array)
  11810. if ( typeof qualifier !== "string" ) {
  11811. return jQuery.grep( elements, function( elem ) {
  11812. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11813. } );
  11814. }
  11815. // Filtered directly for both simple and complex selectors
  11816. return jQuery.filter( qualifier, elements, not );
  11817. }
  11818. jQuery.filter = function( expr, elems, not ) {
  11819. var elem = elems[ 0 ];
  11820. if ( not ) {
  11821. expr = ":not(" + expr + ")";
  11822. }
  11823. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11824. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11825. }
  11826. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11827. return elem.nodeType === 1;
  11828. } ) );
  11829. };
  11830. jQuery.fn.extend( {
  11831. find: function( selector ) {
  11832. var i, ret,
  11833. len = this.length,
  11834. self = this;
  11835. if ( typeof selector !== "string" ) {
  11836. return this.pushStack( jQuery( selector ).filter( function() {
  11837. for ( i = 0; i < len; i++ ) {
  11838. if ( jQuery.contains( self[ i ], this ) ) {
  11839. return true;
  11840. }
  11841. }
  11842. } ) );
  11843. }
  11844. ret = this.pushStack( [] );
  11845. for ( i = 0; i < len; i++ ) {
  11846. jQuery.find( selector, self[ i ], ret );
  11847. }
  11848. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11849. },
  11850. filter: function( selector ) {
  11851. return this.pushStack( winnow( this, selector || [], false ) );
  11852. },
  11853. not: function( selector ) {
  11854. return this.pushStack( winnow( this, selector || [], true ) );
  11855. },
  11856. is: function( selector ) {
  11857. return !!winnow(
  11858. this,
  11859. // If this is a positional/relative selector, check membership in the returned set
  11860. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11861. typeof selector === "string" && rneedsContext.test( selector ) ?
  11862. jQuery( selector ) :
  11863. selector || [],
  11864. false
  11865. ).length;
  11866. }
  11867. } );
  11868. // Initialize a jQuery object
  11869. // A central reference to the root jQuery(document)
  11870. var rootjQuery,
  11871. // A simple way to check for HTML strings
  11872. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11873. // Strict HTML recognition (#11290: must start with <)
  11874. // Shortcut simple #id case for speed
  11875. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11876. init = jQuery.fn.init = function( selector, context, root ) {
  11877. var match, elem;
  11878. // HANDLE: $(""), $(null), $(undefined), $(false)
  11879. if ( !selector ) {
  11880. return this;
  11881. }
  11882. // Method init() accepts an alternate rootjQuery
  11883. // so migrate can support jQuery.sub (gh-2101)
  11884. root = root || rootjQuery;
  11885. // Handle HTML strings
  11886. if ( typeof selector === "string" ) {
  11887. if ( selector[ 0 ] === "<" &&
  11888. selector[ selector.length - 1 ] === ">" &&
  11889. selector.length >= 3 ) {
  11890. // Assume that strings that start and end with <> are HTML and skip the regex check
  11891. match = [ null, selector, null ];
  11892. } else {
  11893. match = rquickExpr.exec( selector );
  11894. }
  11895. // Match html or make sure no context is specified for #id
  11896. if ( match && ( match[ 1 ] || !context ) ) {
  11897. // HANDLE: $(html) -> $(array)
  11898. if ( match[ 1 ] ) {
  11899. context = context instanceof jQuery ? context[ 0 ] : context;
  11900. // Option to run scripts is true for back-compat
  11901. // Intentionally let the error be thrown if parseHTML is not present
  11902. jQuery.merge( this, jQuery.parseHTML(
  11903. match[ 1 ],
  11904. context && context.nodeType ? context.ownerDocument || context : document,
  11905. true
  11906. ) );
  11907. // HANDLE: $(html, props)
  11908. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11909. for ( match in context ) {
  11910. // Properties of context are called as methods if possible
  11911. if ( isFunction( this[ match ] ) ) {
  11912. this[ match ]( context[ match ] );
  11913. // ...and otherwise set as attributes
  11914. } else {
  11915. this.attr( match, context[ match ] );
  11916. }
  11917. }
  11918. }
  11919. return this;
  11920. // HANDLE: $(#id)
  11921. } else {
  11922. elem = document.getElementById( match[ 2 ] );
  11923. if ( elem ) {
  11924. // Inject the element directly into the jQuery object
  11925. this[ 0 ] = elem;
  11926. this.length = 1;
  11927. }
  11928. return this;
  11929. }
  11930. // HANDLE: $(expr, $(...))
  11931. } else if ( !context || context.jquery ) {
  11932. return ( context || root ).find( selector );
  11933. // HANDLE: $(expr, context)
  11934. // (which is just equivalent to: $(context).find(expr)
  11935. } else {
  11936. return this.constructor( context ).find( selector );
  11937. }
  11938. // HANDLE: $(DOMElement)
  11939. } else if ( selector.nodeType ) {
  11940. this[ 0 ] = selector;
  11941. this.length = 1;
  11942. return this;
  11943. // HANDLE: $(function)
  11944. // Shortcut for document ready
  11945. } else if ( isFunction( selector ) ) {
  11946. return root.ready !== undefined ?
  11947. root.ready( selector ) :
  11948. // Execute immediately if ready is not present
  11949. selector( jQuery );
  11950. }
  11951. return jQuery.makeArray( selector, this );
  11952. };
  11953. // Give the init function the jQuery prototype for later instantiation
  11954. init.prototype = jQuery.fn;
  11955. // Initialize central reference
  11956. rootjQuery = jQuery( document );
  11957. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11958. // Methods guaranteed to produce a unique set when starting from a unique set
  11959. guaranteedUnique = {
  11960. children: true,
  11961. contents: true,
  11962. next: true,
  11963. prev: true
  11964. };
  11965. jQuery.fn.extend( {
  11966. has: function( target ) {
  11967. var targets = jQuery( target, this ),
  11968. l = targets.length;
  11969. return this.filter( function() {
  11970. var i = 0;
  11971. for ( ; i < l; i++ ) {
  11972. if ( jQuery.contains( this, targets[ i ] ) ) {
  11973. return true;
  11974. }
  11975. }
  11976. } );
  11977. },
  11978. closest: function( selectors, context ) {
  11979. var cur,
  11980. i = 0,
  11981. l = this.length,
  11982. matched = [],
  11983. targets = typeof selectors !== "string" && jQuery( selectors );
  11984. // Positional selectors never match, since there's no _selection_ context
  11985. if ( !rneedsContext.test( selectors ) ) {
  11986. for ( ; i < l; i++ ) {
  11987. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11988. // Always skip document fragments
  11989. if ( cur.nodeType < 11 && ( targets ?
  11990. targets.index( cur ) > -1 :
  11991. // Don't pass non-elements to Sizzle
  11992. cur.nodeType === 1 &&
  11993. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11994. matched.push( cur );
  11995. break;
  11996. }
  11997. }
  11998. }
  11999. }
  12000. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  12001. },
  12002. // Determine the position of an element within the set
  12003. index: function( elem ) {
  12004. // No argument, return index in parent
  12005. if ( !elem ) {
  12006. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  12007. }
  12008. // Index in selector
  12009. if ( typeof elem === "string" ) {
  12010. return indexOf.call( jQuery( elem ), this[ 0 ] );
  12011. }
  12012. // Locate the position of the desired element
  12013. return indexOf.call( this,
  12014. // If it receives a jQuery object, the first element is used
  12015. elem.jquery ? elem[ 0 ] : elem
  12016. );
  12017. },
  12018. add: function( selector, context ) {
  12019. return this.pushStack(
  12020. jQuery.uniqueSort(
  12021. jQuery.merge( this.get(), jQuery( selector, context ) )
  12022. )
  12023. );
  12024. },
  12025. addBack: function( selector ) {
  12026. return this.add( selector == null ?
  12027. this.prevObject : this.prevObject.filter( selector )
  12028. );
  12029. }
  12030. } );
  12031. function sibling( cur, dir ) {
  12032. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12033. return cur;
  12034. }
  12035. jQuery.each( {
  12036. parent: function( elem ) {
  12037. var parent = elem.parentNode;
  12038. return parent && parent.nodeType !== 11 ? parent : null;
  12039. },
  12040. parents: function( elem ) {
  12041. return dir( elem, "parentNode" );
  12042. },
  12043. parentsUntil: function( elem, i, until ) {
  12044. return dir( elem, "parentNode", until );
  12045. },
  12046. next: function( elem ) {
  12047. return sibling( elem, "nextSibling" );
  12048. },
  12049. prev: function( elem ) {
  12050. return sibling( elem, "previousSibling" );
  12051. },
  12052. nextAll: function( elem ) {
  12053. return dir( elem, "nextSibling" );
  12054. },
  12055. prevAll: function( elem ) {
  12056. return dir( elem, "previousSibling" );
  12057. },
  12058. nextUntil: function( elem, i, until ) {
  12059. return dir( elem, "nextSibling", until );
  12060. },
  12061. prevUntil: function( elem, i, until ) {
  12062. return dir( elem, "previousSibling", until );
  12063. },
  12064. siblings: function( elem ) {
  12065. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12066. },
  12067. children: function( elem ) {
  12068. return siblings( elem.firstChild );
  12069. },
  12070. contents: function( elem ) {
  12071. if ( typeof elem.contentDocument !== "undefined" ) {
  12072. return elem.contentDocument;
  12073. }
  12074. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12075. // Treat the template element as a regular one in browsers that
  12076. // don't support it.
  12077. if ( nodeName( elem, "template" ) ) {
  12078. elem = elem.content || elem;
  12079. }
  12080. return jQuery.merge( [], elem.childNodes );
  12081. }
  12082. }, function( name, fn ) {
  12083. jQuery.fn[ name ] = function( until, selector ) {
  12084. var matched = jQuery.map( this, fn, until );
  12085. if ( name.slice( -5 ) !== "Until" ) {
  12086. selector = until;
  12087. }
  12088. if ( selector && typeof selector === "string" ) {
  12089. matched = jQuery.filter( selector, matched );
  12090. }
  12091. if ( this.length > 1 ) {
  12092. // Remove duplicates
  12093. if ( !guaranteedUnique[ name ] ) {
  12094. jQuery.uniqueSort( matched );
  12095. }
  12096. // Reverse order for parents* and prev-derivatives
  12097. if ( rparentsprev.test( name ) ) {
  12098. matched.reverse();
  12099. }
  12100. }
  12101. return this.pushStack( matched );
  12102. };
  12103. } );
  12104. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12105. // Convert String-formatted options into Object-formatted ones
  12106. function createOptions( options ) {
  12107. var object = {};
  12108. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12109. object[ flag ] = true;
  12110. } );
  12111. return object;
  12112. }
  12113. /*
  12114. * Create a callback list using the following parameters:
  12115. *
  12116. * options: an optional list of space-separated options that will change how
  12117. * the callback list behaves or a more traditional option object
  12118. *
  12119. * By default a callback list will act like an event callback list and can be
  12120. * "fired" multiple times.
  12121. *
  12122. * Possible options:
  12123. *
  12124. * once: will ensure the callback list can only be fired once (like a Deferred)
  12125. *
  12126. * memory: will keep track of previous values and will call any callback added
  12127. * after the list has been fired right away with the latest "memorized"
  12128. * values (like a Deferred)
  12129. *
  12130. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12131. *
  12132. * stopOnFalse: interrupt callings when a callback returns false
  12133. *
  12134. */
  12135. jQuery.Callbacks = function( options ) {
  12136. // Convert options from String-formatted to Object-formatted if needed
  12137. // (we check in cache first)
  12138. options = typeof options === "string" ?
  12139. createOptions( options ) :
  12140. jQuery.extend( {}, options );
  12141. var // Flag to know if list is currently firing
  12142. firing,
  12143. // Last fire value for non-forgettable lists
  12144. memory,
  12145. // Flag to know if list was already fired
  12146. fired,
  12147. // Flag to prevent firing
  12148. locked,
  12149. // Actual callback list
  12150. list = [],
  12151. // Queue of execution data for repeatable lists
  12152. queue = [],
  12153. // Index of currently firing callback (modified by add/remove as needed)
  12154. firingIndex = -1,
  12155. // Fire callbacks
  12156. fire = function() {
  12157. // Enforce single-firing
  12158. locked = locked || options.once;
  12159. // Execute callbacks for all pending executions,
  12160. // respecting firingIndex overrides and runtime changes
  12161. fired = firing = true;
  12162. for ( ; queue.length; firingIndex = -1 ) {
  12163. memory = queue.shift();
  12164. while ( ++firingIndex < list.length ) {
  12165. // Run callback and check for early termination
  12166. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12167. options.stopOnFalse ) {
  12168. // Jump to end and forget the data so .add doesn't re-fire
  12169. firingIndex = list.length;
  12170. memory = false;
  12171. }
  12172. }
  12173. }
  12174. // Forget the data if we're done with it
  12175. if ( !options.memory ) {
  12176. memory = false;
  12177. }
  12178. firing = false;
  12179. // Clean up if we're done firing for good
  12180. if ( locked ) {
  12181. // Keep an empty list if we have data for future add calls
  12182. if ( memory ) {
  12183. list = [];
  12184. // Otherwise, this object is spent
  12185. } else {
  12186. list = "";
  12187. }
  12188. }
  12189. },
  12190. // Actual Callbacks object
  12191. self = {
  12192. // Add a callback or a collection of callbacks to the list
  12193. add: function() {
  12194. if ( list ) {
  12195. // If we have memory from a past run, we should fire after adding
  12196. if ( memory && !firing ) {
  12197. firingIndex = list.length - 1;
  12198. queue.push( memory );
  12199. }
  12200. ( function add( args ) {
  12201. jQuery.each( args, function( _, arg ) {
  12202. if ( isFunction( arg ) ) {
  12203. if ( !options.unique || !self.has( arg ) ) {
  12204. list.push( arg );
  12205. }
  12206. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12207. // Inspect recursively
  12208. add( arg );
  12209. }
  12210. } );
  12211. } )( arguments );
  12212. if ( memory && !firing ) {
  12213. fire();
  12214. }
  12215. }
  12216. return this;
  12217. },
  12218. // Remove a callback from the list
  12219. remove: function() {
  12220. jQuery.each( arguments, function( _, arg ) {
  12221. var index;
  12222. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12223. list.splice( index, 1 );
  12224. // Handle firing indexes
  12225. if ( index <= firingIndex ) {
  12226. firingIndex--;
  12227. }
  12228. }
  12229. } );
  12230. return this;
  12231. },
  12232. // Check if a given callback is in the list.
  12233. // If no argument is given, return whether or not list has callbacks attached.
  12234. has: function( fn ) {
  12235. return fn ?
  12236. jQuery.inArray( fn, list ) > -1 :
  12237. list.length > 0;
  12238. },
  12239. // Remove all callbacks from the list
  12240. empty: function() {
  12241. if ( list ) {
  12242. list = [];
  12243. }
  12244. return this;
  12245. },
  12246. // Disable .fire and .add
  12247. // Abort any current/pending executions
  12248. // Clear all callbacks and values
  12249. disable: function() {
  12250. locked = queue = [];
  12251. list = memory = "";
  12252. return this;
  12253. },
  12254. disabled: function() {
  12255. return !list;
  12256. },
  12257. // Disable .fire
  12258. // Also disable .add unless we have memory (since it would have no effect)
  12259. // Abort any pending executions
  12260. lock: function() {
  12261. locked = queue = [];
  12262. if ( !memory && !firing ) {
  12263. list = memory = "";
  12264. }
  12265. return this;
  12266. },
  12267. locked: function() {
  12268. return !!locked;
  12269. },
  12270. // Call all callbacks with the given context and arguments
  12271. fireWith: function( context, args ) {
  12272. if ( !locked ) {
  12273. args = args || [];
  12274. args = [ context, args.slice ? args.slice() : args ];
  12275. queue.push( args );
  12276. if ( !firing ) {
  12277. fire();
  12278. }
  12279. }
  12280. return this;
  12281. },
  12282. // Call all the callbacks with the given arguments
  12283. fire: function() {
  12284. self.fireWith( this, arguments );
  12285. return this;
  12286. },
  12287. // To know if the callbacks have already been called at least once
  12288. fired: function() {
  12289. return !!fired;
  12290. }
  12291. };
  12292. return self;
  12293. };
  12294. function Identity( v ) {
  12295. return v;
  12296. }
  12297. function Thrower( ex ) {
  12298. throw ex;
  12299. }
  12300. function adoptValue( value, resolve, reject, noValue ) {
  12301. var method;
  12302. try {
  12303. // Check for promise aspect first to privilege synchronous behavior
  12304. if ( value && isFunction( ( method = value.promise ) ) ) {
  12305. method.call( value ).done( resolve ).fail( reject );
  12306. // Other thenables
  12307. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12308. method.call( value, resolve, reject );
  12309. // Other non-thenables
  12310. } else {
  12311. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12312. // * false: [ value ].slice( 0 ) => resolve( value )
  12313. // * true: [ value ].slice( 1 ) => resolve()
  12314. resolve.apply( undefined, [ value ].slice( noValue ) );
  12315. }
  12316. // For Promises/A+, convert exceptions into rejections
  12317. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12318. // Deferred#then to conditionally suppress rejection.
  12319. } catch ( value ) {
  12320. // Support: Android 4.0 only
  12321. // Strict mode functions invoked without .call/.apply get global-object context
  12322. reject.apply( undefined, [ value ] );
  12323. }
  12324. }
  12325. jQuery.extend( {
  12326. Deferred: function( func ) {
  12327. var tuples = [
  12328. // action, add listener, callbacks,
  12329. // ... .then handlers, argument index, [final state]
  12330. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12331. jQuery.Callbacks( "memory" ), 2 ],
  12332. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12333. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12334. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12335. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12336. ],
  12337. state = "pending",
  12338. promise = {
  12339. state: function() {
  12340. return state;
  12341. },
  12342. always: function() {
  12343. deferred.done( arguments ).fail( arguments );
  12344. return this;
  12345. },
  12346. "catch": function( fn ) {
  12347. return promise.then( null, fn );
  12348. },
  12349. // Keep pipe for back-compat
  12350. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12351. var fns = arguments;
  12352. return jQuery.Deferred( function( newDefer ) {
  12353. jQuery.each( tuples, function( i, tuple ) {
  12354. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12355. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12356. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12357. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12358. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12359. deferred[ tuple[ 1 ] ]( function() {
  12360. var returned = fn && fn.apply( this, arguments );
  12361. if ( returned && isFunction( returned.promise ) ) {
  12362. returned.promise()
  12363. .progress( newDefer.notify )
  12364. .done( newDefer.resolve )
  12365. .fail( newDefer.reject );
  12366. } else {
  12367. newDefer[ tuple[ 0 ] + "With" ](
  12368. this,
  12369. fn ? [ returned ] : arguments
  12370. );
  12371. }
  12372. } );
  12373. } );
  12374. fns = null;
  12375. } ).promise();
  12376. },
  12377. then: function( onFulfilled, onRejected, onProgress ) {
  12378. var maxDepth = 0;
  12379. function resolve( depth, deferred, handler, special ) {
  12380. return function() {
  12381. var that = this,
  12382. args = arguments,
  12383. mightThrow = function() {
  12384. var returned, then;
  12385. // Support: Promises/A+ section 2.3.3.3.3
  12386. // https://promisesaplus.com/#point-59
  12387. // Ignore double-resolution attempts
  12388. if ( depth < maxDepth ) {
  12389. return;
  12390. }
  12391. returned = handler.apply( that, args );
  12392. // Support: Promises/A+ section 2.3.1
  12393. // https://promisesaplus.com/#point-48
  12394. if ( returned === deferred.promise() ) {
  12395. throw new TypeError( "Thenable self-resolution" );
  12396. }
  12397. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12398. // https://promisesaplus.com/#point-54
  12399. // https://promisesaplus.com/#point-75
  12400. // Retrieve `then` only once
  12401. then = returned &&
  12402. // Support: Promises/A+ section 2.3.4
  12403. // https://promisesaplus.com/#point-64
  12404. // Only check objects and functions for thenability
  12405. ( typeof returned === "object" ||
  12406. typeof returned === "function" ) &&
  12407. returned.then;
  12408. // Handle a returned thenable
  12409. if ( isFunction( then ) ) {
  12410. // Special processors (notify) just wait for resolution
  12411. if ( special ) {
  12412. then.call(
  12413. returned,
  12414. resolve( maxDepth, deferred, Identity, special ),
  12415. resolve( maxDepth, deferred, Thrower, special )
  12416. );
  12417. // Normal processors (resolve) also hook into progress
  12418. } else {
  12419. // ...and disregard older resolution values
  12420. maxDepth++;
  12421. then.call(
  12422. returned,
  12423. resolve( maxDepth, deferred, Identity, special ),
  12424. resolve( maxDepth, deferred, Thrower, special ),
  12425. resolve( maxDepth, deferred, Identity,
  12426. deferred.notifyWith )
  12427. );
  12428. }
  12429. // Handle all other returned values
  12430. } else {
  12431. // Only substitute handlers pass on context
  12432. // and multiple values (non-spec behavior)
  12433. if ( handler !== Identity ) {
  12434. that = undefined;
  12435. args = [ returned ];
  12436. }
  12437. // Process the value(s)
  12438. // Default process is resolve
  12439. ( special || deferred.resolveWith )( that, args );
  12440. }
  12441. },
  12442. // Only normal processors (resolve) catch and reject exceptions
  12443. process = special ?
  12444. mightThrow :
  12445. function() {
  12446. try {
  12447. mightThrow();
  12448. } catch ( e ) {
  12449. if ( jQuery.Deferred.exceptionHook ) {
  12450. jQuery.Deferred.exceptionHook( e,
  12451. process.stackTrace );
  12452. }
  12453. // Support: Promises/A+ section 2.3.3.3.4.1
  12454. // https://promisesaplus.com/#point-61
  12455. // Ignore post-resolution exceptions
  12456. if ( depth + 1 >= maxDepth ) {
  12457. // Only substitute handlers pass on context
  12458. // and multiple values (non-spec behavior)
  12459. if ( handler !== Thrower ) {
  12460. that = undefined;
  12461. args = [ e ];
  12462. }
  12463. deferred.rejectWith( that, args );
  12464. }
  12465. }
  12466. };
  12467. // Support: Promises/A+ section 2.3.3.3.1
  12468. // https://promisesaplus.com/#point-57
  12469. // Re-resolve promises immediately to dodge false rejection from
  12470. // subsequent errors
  12471. if ( depth ) {
  12472. process();
  12473. } else {
  12474. // Call an optional hook to record the stack, in case of exception
  12475. // since it's otherwise lost when execution goes async
  12476. if ( jQuery.Deferred.getStackHook ) {
  12477. process.stackTrace = jQuery.Deferred.getStackHook();
  12478. }
  12479. window.setTimeout( process );
  12480. }
  12481. };
  12482. }
  12483. return jQuery.Deferred( function( newDefer ) {
  12484. // progress_handlers.add( ... )
  12485. tuples[ 0 ][ 3 ].add(
  12486. resolve(
  12487. 0,
  12488. newDefer,
  12489. isFunction( onProgress ) ?
  12490. onProgress :
  12491. Identity,
  12492. newDefer.notifyWith
  12493. )
  12494. );
  12495. // fulfilled_handlers.add( ... )
  12496. tuples[ 1 ][ 3 ].add(
  12497. resolve(
  12498. 0,
  12499. newDefer,
  12500. isFunction( onFulfilled ) ?
  12501. onFulfilled :
  12502. Identity
  12503. )
  12504. );
  12505. // rejected_handlers.add( ... )
  12506. tuples[ 2 ][ 3 ].add(
  12507. resolve(
  12508. 0,
  12509. newDefer,
  12510. isFunction( onRejected ) ?
  12511. onRejected :
  12512. Thrower
  12513. )
  12514. );
  12515. } ).promise();
  12516. },
  12517. // Get a promise for this deferred
  12518. // If obj is provided, the promise aspect is added to the object
  12519. promise: function( obj ) {
  12520. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12521. }
  12522. },
  12523. deferred = {};
  12524. // Add list-specific methods
  12525. jQuery.each( tuples, function( i, tuple ) {
  12526. var list = tuple[ 2 ],
  12527. stateString = tuple[ 5 ];
  12528. // promise.progress = list.add
  12529. // promise.done = list.add
  12530. // promise.fail = list.add
  12531. promise[ tuple[ 1 ] ] = list.add;
  12532. // Handle state
  12533. if ( stateString ) {
  12534. list.add(
  12535. function() {
  12536. // state = "resolved" (i.e., fulfilled)
  12537. // state = "rejected"
  12538. state = stateString;
  12539. },
  12540. // rejected_callbacks.disable
  12541. // fulfilled_callbacks.disable
  12542. tuples[ 3 - i ][ 2 ].disable,
  12543. // rejected_handlers.disable
  12544. // fulfilled_handlers.disable
  12545. tuples[ 3 - i ][ 3 ].disable,
  12546. // progress_callbacks.lock
  12547. tuples[ 0 ][ 2 ].lock,
  12548. // progress_handlers.lock
  12549. tuples[ 0 ][ 3 ].lock
  12550. );
  12551. }
  12552. // progress_handlers.fire
  12553. // fulfilled_handlers.fire
  12554. // rejected_handlers.fire
  12555. list.add( tuple[ 3 ].fire );
  12556. // deferred.notify = function() { deferred.notifyWith(...) }
  12557. // deferred.resolve = function() { deferred.resolveWith(...) }
  12558. // deferred.reject = function() { deferred.rejectWith(...) }
  12559. deferred[ tuple[ 0 ] ] = function() {
  12560. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12561. return this;
  12562. };
  12563. // deferred.notifyWith = list.fireWith
  12564. // deferred.resolveWith = list.fireWith
  12565. // deferred.rejectWith = list.fireWith
  12566. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12567. } );
  12568. // Make the deferred a promise
  12569. promise.promise( deferred );
  12570. // Call given func if any
  12571. if ( func ) {
  12572. func.call( deferred, deferred );
  12573. }
  12574. // All done!
  12575. return deferred;
  12576. },
  12577. // Deferred helper
  12578. when: function( singleValue ) {
  12579. var
  12580. // count of uncompleted subordinates
  12581. remaining = arguments.length,
  12582. // count of unprocessed arguments
  12583. i = remaining,
  12584. // subordinate fulfillment data
  12585. resolveContexts = Array( i ),
  12586. resolveValues = slice.call( arguments ),
  12587. // the master Deferred
  12588. master = jQuery.Deferred(),
  12589. // subordinate callback factory
  12590. updateFunc = function( i ) {
  12591. return function( value ) {
  12592. resolveContexts[ i ] = this;
  12593. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12594. if ( !( --remaining ) ) {
  12595. master.resolveWith( resolveContexts, resolveValues );
  12596. }
  12597. };
  12598. };
  12599. // Single- and empty arguments are adopted like Promise.resolve
  12600. if ( remaining <= 1 ) {
  12601. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12602. !remaining );
  12603. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12604. if ( master.state() === "pending" ||
  12605. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12606. return master.then();
  12607. }
  12608. }
  12609. // Multiple arguments are aggregated like Promise.all array elements
  12610. while ( i-- ) {
  12611. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12612. }
  12613. return master.promise();
  12614. }
  12615. } );
  12616. // These usually indicate a programmer mistake during development,
  12617. // warn about them ASAP rather than swallowing them by default.
  12618. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12619. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12620. // Support: IE 8 - 9 only
  12621. // Console exists when dev tools are open, which can happen at any time
  12622. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12623. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12624. }
  12625. };
  12626. jQuery.readyException = function( error ) {
  12627. window.setTimeout( function() {
  12628. throw error;
  12629. } );
  12630. };
  12631. // The deferred used on DOM ready
  12632. var readyList = jQuery.Deferred();
  12633. jQuery.fn.ready = function( fn ) {
  12634. readyList
  12635. .then( fn )
  12636. // Wrap jQuery.readyException in a function so that the lookup
  12637. // happens at the time of error handling instead of callback
  12638. // registration.
  12639. .catch( function( error ) {
  12640. jQuery.readyException( error );
  12641. } );
  12642. return this;
  12643. };
  12644. jQuery.extend( {
  12645. // Is the DOM ready to be used? Set to true once it occurs.
  12646. isReady: false,
  12647. // A counter to track how many items to wait for before
  12648. // the ready event fires. See #6781
  12649. readyWait: 1,
  12650. // Handle when the DOM is ready
  12651. ready: function( wait ) {
  12652. // Abort if there are pending holds or we're already ready
  12653. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12654. return;
  12655. }
  12656. // Remember that the DOM is ready
  12657. jQuery.isReady = true;
  12658. // If a normal DOM Ready event fired, decrement, and wait if need be
  12659. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12660. return;
  12661. }
  12662. // If there are functions bound, to execute
  12663. readyList.resolveWith( document, [ jQuery ] );
  12664. }
  12665. } );
  12666. jQuery.ready.then = readyList.then;
  12667. // The ready event handler and self cleanup method
  12668. function completed() {
  12669. document.removeEventListener( "DOMContentLoaded", completed );
  12670. window.removeEventListener( "load", completed );
  12671. jQuery.ready();
  12672. }
  12673. // Catch cases where $(document).ready() is called
  12674. // after the browser event has already occurred.
  12675. // Support: IE <=9 - 10 only
  12676. // Older IE sometimes signals "interactive" too soon
  12677. if ( document.readyState === "complete" ||
  12678. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12679. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12680. window.setTimeout( jQuery.ready );
  12681. } else {
  12682. // Use the handy event callback
  12683. document.addEventListener( "DOMContentLoaded", completed );
  12684. // A fallback to window.onload, that will always work
  12685. window.addEventListener( "load", completed );
  12686. }
  12687. // Multifunctional method to get and set values of a collection
  12688. // The value/s can optionally be executed if it's a function
  12689. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12690. var i = 0,
  12691. len = elems.length,
  12692. bulk = key == null;
  12693. // Sets many values
  12694. if ( toType( key ) === "object" ) {
  12695. chainable = true;
  12696. for ( i in key ) {
  12697. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12698. }
  12699. // Sets one value
  12700. } else if ( value !== undefined ) {
  12701. chainable = true;
  12702. if ( !isFunction( value ) ) {
  12703. raw = true;
  12704. }
  12705. if ( bulk ) {
  12706. // Bulk operations run against the entire set
  12707. if ( raw ) {
  12708. fn.call( elems, value );
  12709. fn = null;
  12710. // ...except when executing function values
  12711. } else {
  12712. bulk = fn;
  12713. fn = function( elem, key, value ) {
  12714. return bulk.call( jQuery( elem ), value );
  12715. };
  12716. }
  12717. }
  12718. if ( fn ) {
  12719. for ( ; i < len; i++ ) {
  12720. fn(
  12721. elems[ i ], key, raw ?
  12722. value :
  12723. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12724. );
  12725. }
  12726. }
  12727. }
  12728. if ( chainable ) {
  12729. return elems;
  12730. }
  12731. // Gets
  12732. if ( bulk ) {
  12733. return fn.call( elems );
  12734. }
  12735. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12736. };
  12737. // Matches dashed string for camelizing
  12738. var rmsPrefix = /^-ms-/,
  12739. rdashAlpha = /-([a-z])/g;
  12740. // Used by camelCase as callback to replace()
  12741. function fcamelCase( all, letter ) {
  12742. return letter.toUpperCase();
  12743. }
  12744. // Convert dashed to camelCase; used by the css and data modules
  12745. // Support: IE <=9 - 11, Edge 12 - 15
  12746. // Microsoft forgot to hump their vendor prefix (#9572)
  12747. function camelCase( string ) {
  12748. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12749. }
  12750. var acceptData = function( owner ) {
  12751. // Accepts only:
  12752. // - Node
  12753. // - Node.ELEMENT_NODE
  12754. // - Node.DOCUMENT_NODE
  12755. // - Object
  12756. // - Any
  12757. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12758. };
  12759. function Data() {
  12760. this.expando = jQuery.expando + Data.uid++;
  12761. }
  12762. Data.uid = 1;
  12763. Data.prototype = {
  12764. cache: function( owner ) {
  12765. // Check if the owner object already has a cache
  12766. var value = owner[ this.expando ];
  12767. // If not, create one
  12768. if ( !value ) {
  12769. value = {};
  12770. // We can accept data for non-element nodes in modern browsers,
  12771. // but we should not, see #8335.
  12772. // Always return an empty object.
  12773. if ( acceptData( owner ) ) {
  12774. // If it is a node unlikely to be stringify-ed or looped over
  12775. // use plain assignment
  12776. if ( owner.nodeType ) {
  12777. owner[ this.expando ] = value;
  12778. // Otherwise secure it in a non-enumerable property
  12779. // configurable must be true to allow the property to be
  12780. // deleted when data is removed
  12781. } else {
  12782. Object.defineProperty( owner, this.expando, {
  12783. value: value,
  12784. configurable: true
  12785. } );
  12786. }
  12787. }
  12788. }
  12789. return value;
  12790. },
  12791. set: function( owner, data, value ) {
  12792. var prop,
  12793. cache = this.cache( owner );
  12794. // Handle: [ owner, key, value ] args
  12795. // Always use camelCase key (gh-2257)
  12796. if ( typeof data === "string" ) {
  12797. cache[ camelCase( data ) ] = value;
  12798. // Handle: [ owner, { properties } ] args
  12799. } else {
  12800. // Copy the properties one-by-one to the cache object
  12801. for ( prop in data ) {
  12802. cache[ camelCase( prop ) ] = data[ prop ];
  12803. }
  12804. }
  12805. return cache;
  12806. },
  12807. get: function( owner, key ) {
  12808. return key === undefined ?
  12809. this.cache( owner ) :
  12810. // Always use camelCase key (gh-2257)
  12811. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12812. },
  12813. access: function( owner, key, value ) {
  12814. // In cases where either:
  12815. //
  12816. // 1. No key was specified
  12817. // 2. A string key was specified, but no value provided
  12818. //
  12819. // Take the "read" path and allow the get method to determine
  12820. // which value to return, respectively either:
  12821. //
  12822. // 1. The entire cache object
  12823. // 2. The data stored at the key
  12824. //
  12825. if ( key === undefined ||
  12826. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12827. return this.get( owner, key );
  12828. }
  12829. // When the key is not a string, or both a key and value
  12830. // are specified, set or extend (existing objects) with either:
  12831. //
  12832. // 1. An object of properties
  12833. // 2. A key and value
  12834. //
  12835. this.set( owner, key, value );
  12836. // Since the "set" path can have two possible entry points
  12837. // return the expected data based on which path was taken[*]
  12838. return value !== undefined ? value : key;
  12839. },
  12840. remove: function( owner, key ) {
  12841. var i,
  12842. cache = owner[ this.expando ];
  12843. if ( cache === undefined ) {
  12844. return;
  12845. }
  12846. if ( key !== undefined ) {
  12847. // Support array or space separated string of keys
  12848. if ( Array.isArray( key ) ) {
  12849. // If key is an array of keys...
  12850. // We always set camelCase keys, so remove that.
  12851. key = key.map( camelCase );
  12852. } else {
  12853. key = camelCase( key );
  12854. // If a key with the spaces exists, use it.
  12855. // Otherwise, create an array by matching non-whitespace
  12856. key = key in cache ?
  12857. [ key ] :
  12858. ( key.match( rnothtmlwhite ) || [] );
  12859. }
  12860. i = key.length;
  12861. while ( i-- ) {
  12862. delete cache[ key[ i ] ];
  12863. }
  12864. }
  12865. // Remove the expando if there's no more data
  12866. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12867. // Support: Chrome <=35 - 45
  12868. // Webkit & Blink performance suffers when deleting properties
  12869. // from DOM nodes, so set to undefined instead
  12870. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12871. if ( owner.nodeType ) {
  12872. owner[ this.expando ] = undefined;
  12873. } else {
  12874. delete owner[ this.expando ];
  12875. }
  12876. }
  12877. },
  12878. hasData: function( owner ) {
  12879. var cache = owner[ this.expando ];
  12880. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12881. }
  12882. };
  12883. var dataPriv = new Data();
  12884. var dataUser = new Data();
  12885. // Implementation Summary
  12886. //
  12887. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12888. // 2. Improve the module's maintainability by reducing the storage
  12889. // paths to a single mechanism.
  12890. // 3. Use the same single mechanism to support "private" and "user" data.
  12891. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12892. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12893. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12894. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12895. rmultiDash = /[A-Z]/g;
  12896. function getData( data ) {
  12897. if ( data === "true" ) {
  12898. return true;
  12899. }
  12900. if ( data === "false" ) {
  12901. return false;
  12902. }
  12903. if ( data === "null" ) {
  12904. return null;
  12905. }
  12906. // Only convert to a number if it doesn't change the string
  12907. if ( data === +data + "" ) {
  12908. return +data;
  12909. }
  12910. if ( rbrace.test( data ) ) {
  12911. return JSON.parse( data );
  12912. }
  12913. return data;
  12914. }
  12915. function dataAttr( elem, key, data ) {
  12916. var name;
  12917. // If nothing was found internally, try to fetch any
  12918. // data from the HTML5 data-* attribute
  12919. if ( data === undefined && elem.nodeType === 1 ) {
  12920. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12921. data = elem.getAttribute( name );
  12922. if ( typeof data === "string" ) {
  12923. try {
  12924. data = getData( data );
  12925. } catch ( e ) {}
  12926. // Make sure we set the data so it isn't changed later
  12927. dataUser.set( elem, key, data );
  12928. } else {
  12929. data = undefined;
  12930. }
  12931. }
  12932. return data;
  12933. }
  12934. jQuery.extend( {
  12935. hasData: function( elem ) {
  12936. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12937. },
  12938. data: function( elem, name, data ) {
  12939. return dataUser.access( elem, name, data );
  12940. },
  12941. removeData: function( elem, name ) {
  12942. dataUser.remove( elem, name );
  12943. },
  12944. // TODO: Now that all calls to _data and _removeData have been replaced
  12945. // with direct calls to dataPriv methods, these can be deprecated.
  12946. _data: function( elem, name, data ) {
  12947. return dataPriv.access( elem, name, data );
  12948. },
  12949. _removeData: function( elem, name ) {
  12950. dataPriv.remove( elem, name );
  12951. }
  12952. } );
  12953. jQuery.fn.extend( {
  12954. data: function( key, value ) {
  12955. var i, name, data,
  12956. elem = this[ 0 ],
  12957. attrs = elem && elem.attributes;
  12958. // Gets all values
  12959. if ( key === undefined ) {
  12960. if ( this.length ) {
  12961. data = dataUser.get( elem );
  12962. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12963. i = attrs.length;
  12964. while ( i-- ) {
  12965. // Support: IE 11 only
  12966. // The attrs elements can be null (#14894)
  12967. if ( attrs[ i ] ) {
  12968. name = attrs[ i ].name;
  12969. if ( name.indexOf( "data-" ) === 0 ) {
  12970. name = camelCase( name.slice( 5 ) );
  12971. dataAttr( elem, name, data[ name ] );
  12972. }
  12973. }
  12974. }
  12975. dataPriv.set( elem, "hasDataAttrs", true );
  12976. }
  12977. }
  12978. return data;
  12979. }
  12980. // Sets multiple values
  12981. if ( typeof key === "object" ) {
  12982. return this.each( function() {
  12983. dataUser.set( this, key );
  12984. } );
  12985. }
  12986. return access( this, function( value ) {
  12987. var data;
  12988. // The calling jQuery object (element matches) is not empty
  12989. // (and therefore has an element appears at this[ 0 ]) and the
  12990. // `value` parameter was not undefined. An empty jQuery object
  12991. // will result in `undefined` for elem = this[ 0 ] which will
  12992. // throw an exception if an attempt to read a data cache is made.
  12993. if ( elem && value === undefined ) {
  12994. // Attempt to get data from the cache
  12995. // The key will always be camelCased in Data
  12996. data = dataUser.get( elem, key );
  12997. if ( data !== undefined ) {
  12998. return data;
  12999. }
  13000. // Attempt to "discover" the data in
  13001. // HTML5 custom data-* attrs
  13002. data = dataAttr( elem, key );
  13003. if ( data !== undefined ) {
  13004. return data;
  13005. }
  13006. // We tried really hard, but the data doesn't exist.
  13007. return;
  13008. }
  13009. // Set the data...
  13010. this.each( function() {
  13011. // We always store the camelCased key
  13012. dataUser.set( this, key, value );
  13013. } );
  13014. }, null, value, arguments.length > 1, null, true );
  13015. },
  13016. removeData: function( key ) {
  13017. return this.each( function() {
  13018. dataUser.remove( this, key );
  13019. } );
  13020. }
  13021. } );
  13022. jQuery.extend( {
  13023. queue: function( elem, type, data ) {
  13024. var queue;
  13025. if ( elem ) {
  13026. type = ( type || "fx" ) + "queue";
  13027. queue = dataPriv.get( elem, type );
  13028. // Speed up dequeue by getting out quickly if this is just a lookup
  13029. if ( data ) {
  13030. if ( !queue || Array.isArray( data ) ) {
  13031. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13032. } else {
  13033. queue.push( data );
  13034. }
  13035. }
  13036. return queue || [];
  13037. }
  13038. },
  13039. dequeue: function( elem, type ) {
  13040. type = type || "fx";
  13041. var queue = jQuery.queue( elem, type ),
  13042. startLength = queue.length,
  13043. fn = queue.shift(),
  13044. hooks = jQuery._queueHooks( elem, type ),
  13045. next = function() {
  13046. jQuery.dequeue( elem, type );
  13047. };
  13048. // If the fx queue is dequeued, always remove the progress sentinel
  13049. if ( fn === "inprogress" ) {
  13050. fn = queue.shift();
  13051. startLength--;
  13052. }
  13053. if ( fn ) {
  13054. // Add a progress sentinel to prevent the fx queue from being
  13055. // automatically dequeued
  13056. if ( type === "fx" ) {
  13057. queue.unshift( "inprogress" );
  13058. }
  13059. // Clear up the last queue stop function
  13060. delete hooks.stop;
  13061. fn.call( elem, next, hooks );
  13062. }
  13063. if ( !startLength && hooks ) {
  13064. hooks.empty.fire();
  13065. }
  13066. },
  13067. // Not public - generate a queueHooks object, or return the current one
  13068. _queueHooks: function( elem, type ) {
  13069. var key = type + "queueHooks";
  13070. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13071. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13072. dataPriv.remove( elem, [ type + "queue", key ] );
  13073. } )
  13074. } );
  13075. }
  13076. } );
  13077. jQuery.fn.extend( {
  13078. queue: function( type, data ) {
  13079. var setter = 2;
  13080. if ( typeof type !== "string" ) {
  13081. data = type;
  13082. type = "fx";
  13083. setter--;
  13084. }
  13085. if ( arguments.length < setter ) {
  13086. return jQuery.queue( this[ 0 ], type );
  13087. }
  13088. return data === undefined ?
  13089. this :
  13090. this.each( function() {
  13091. var queue = jQuery.queue( this, type, data );
  13092. // Ensure a hooks for this queue
  13093. jQuery._queueHooks( this, type );
  13094. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13095. jQuery.dequeue( this, type );
  13096. }
  13097. } );
  13098. },
  13099. dequeue: function( type ) {
  13100. return this.each( function() {
  13101. jQuery.dequeue( this, type );
  13102. } );
  13103. },
  13104. clearQueue: function( type ) {
  13105. return this.queue( type || "fx", [] );
  13106. },
  13107. // Get a promise resolved when queues of a certain type
  13108. // are emptied (fx is the type by default)
  13109. promise: function( type, obj ) {
  13110. var tmp,
  13111. count = 1,
  13112. defer = jQuery.Deferred(),
  13113. elements = this,
  13114. i = this.length,
  13115. resolve = function() {
  13116. if ( !( --count ) ) {
  13117. defer.resolveWith( elements, [ elements ] );
  13118. }
  13119. };
  13120. if ( typeof type !== "string" ) {
  13121. obj = type;
  13122. type = undefined;
  13123. }
  13124. type = type || "fx";
  13125. while ( i-- ) {
  13126. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13127. if ( tmp && tmp.empty ) {
  13128. count++;
  13129. tmp.empty.add( resolve );
  13130. }
  13131. }
  13132. resolve();
  13133. return defer.promise( obj );
  13134. }
  13135. } );
  13136. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13137. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13138. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13139. var documentElement = document.documentElement;
  13140. var isAttached = function( elem ) {
  13141. return jQuery.contains( elem.ownerDocument, elem );
  13142. },
  13143. composed = { composed: true };
  13144. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13145. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13146. // Support: iOS 10.0-10.2 only
  13147. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13148. // leading to errors. We need to check for `getRootNode`.
  13149. if ( documentElement.getRootNode ) {
  13150. isAttached = function( elem ) {
  13151. return jQuery.contains( elem.ownerDocument, elem ) ||
  13152. elem.getRootNode( composed ) === elem.ownerDocument;
  13153. };
  13154. }
  13155. var isHiddenWithinTree = function( elem, el ) {
  13156. // isHiddenWithinTree might be called from jQuery#filter function;
  13157. // in that case, element will be second argument
  13158. elem = el || elem;
  13159. // Inline style trumps all
  13160. return elem.style.display === "none" ||
  13161. elem.style.display === "" &&
  13162. // Otherwise, check computed style
  13163. // Support: Firefox <=43 - 45
  13164. // Disconnected elements can have computed display: none, so first confirm that elem is
  13165. // in the document.
  13166. isAttached( elem ) &&
  13167. jQuery.css( elem, "display" ) === "none";
  13168. };
  13169. var swap = function( elem, options, callback, args ) {
  13170. var ret, name,
  13171. old = {};
  13172. // Remember the old values, and insert the new ones
  13173. for ( name in options ) {
  13174. old[ name ] = elem.style[ name ];
  13175. elem.style[ name ] = options[ name ];
  13176. }
  13177. ret = callback.apply( elem, args || [] );
  13178. // Revert the old values
  13179. for ( name in options ) {
  13180. elem.style[ name ] = old[ name ];
  13181. }
  13182. return ret;
  13183. };
  13184. function adjustCSS( elem, prop, valueParts, tween ) {
  13185. var adjusted, scale,
  13186. maxIterations = 20,
  13187. currentValue = tween ?
  13188. function() {
  13189. return tween.cur();
  13190. } :
  13191. function() {
  13192. return jQuery.css( elem, prop, "" );
  13193. },
  13194. initial = currentValue(),
  13195. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13196. // Starting value computation is required for potential unit mismatches
  13197. initialInUnit = elem.nodeType &&
  13198. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13199. rcssNum.exec( jQuery.css( elem, prop ) );
  13200. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13201. // Support: Firefox <=54
  13202. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13203. initial = initial / 2;
  13204. // Trust units reported by jQuery.css
  13205. unit = unit || initialInUnit[ 3 ];
  13206. // Iteratively approximate from a nonzero starting point
  13207. initialInUnit = +initial || 1;
  13208. while ( maxIterations-- ) {
  13209. // Evaluate and update our best guess (doubling guesses that zero out).
  13210. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13211. jQuery.style( elem, prop, initialInUnit + unit );
  13212. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13213. maxIterations = 0;
  13214. }
  13215. initialInUnit = initialInUnit / scale;
  13216. }
  13217. initialInUnit = initialInUnit * 2;
  13218. jQuery.style( elem, prop, initialInUnit + unit );
  13219. // Make sure we update the tween properties later on
  13220. valueParts = valueParts || [];
  13221. }
  13222. if ( valueParts ) {
  13223. initialInUnit = +initialInUnit || +initial || 0;
  13224. // Apply relative offset (+=/-=) if specified
  13225. adjusted = valueParts[ 1 ] ?
  13226. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13227. +valueParts[ 2 ];
  13228. if ( tween ) {
  13229. tween.unit = unit;
  13230. tween.start = initialInUnit;
  13231. tween.end = adjusted;
  13232. }
  13233. }
  13234. return adjusted;
  13235. }
  13236. var defaultDisplayMap = {};
  13237. function getDefaultDisplay( elem ) {
  13238. var temp,
  13239. doc = elem.ownerDocument,
  13240. nodeName = elem.nodeName,
  13241. display = defaultDisplayMap[ nodeName ];
  13242. if ( display ) {
  13243. return display;
  13244. }
  13245. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13246. display = jQuery.css( temp, "display" );
  13247. temp.parentNode.removeChild( temp );
  13248. if ( display === "none" ) {
  13249. display = "block";
  13250. }
  13251. defaultDisplayMap[ nodeName ] = display;
  13252. return display;
  13253. }
  13254. function showHide( elements, show ) {
  13255. var display, elem,
  13256. values = [],
  13257. index = 0,
  13258. length = elements.length;
  13259. // Determine new display value for elements that need to change
  13260. for ( ; index < length; index++ ) {
  13261. elem = elements[ index ];
  13262. if ( !elem.style ) {
  13263. continue;
  13264. }
  13265. display = elem.style.display;
  13266. if ( show ) {
  13267. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13268. // check is required in this first loop unless we have a nonempty display value (either
  13269. // inline or about-to-be-restored)
  13270. if ( display === "none" ) {
  13271. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13272. if ( !values[ index ] ) {
  13273. elem.style.display = "";
  13274. }
  13275. }
  13276. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13277. values[ index ] = getDefaultDisplay( elem );
  13278. }
  13279. } else {
  13280. if ( display !== "none" ) {
  13281. values[ index ] = "none";
  13282. // Remember what we're overwriting
  13283. dataPriv.set( elem, "display", display );
  13284. }
  13285. }
  13286. }
  13287. // Set the display of the elements in a second loop to avoid constant reflow
  13288. for ( index = 0; index < length; index++ ) {
  13289. if ( values[ index ] != null ) {
  13290. elements[ index ].style.display = values[ index ];
  13291. }
  13292. }
  13293. return elements;
  13294. }
  13295. jQuery.fn.extend( {
  13296. show: function() {
  13297. return showHide( this, true );
  13298. },
  13299. hide: function() {
  13300. return showHide( this );
  13301. },
  13302. toggle: function( state ) {
  13303. if ( typeof state === "boolean" ) {
  13304. return state ? this.show() : this.hide();
  13305. }
  13306. return this.each( function() {
  13307. if ( isHiddenWithinTree( this ) ) {
  13308. jQuery( this ).show();
  13309. } else {
  13310. jQuery( this ).hide();
  13311. }
  13312. } );
  13313. }
  13314. } );
  13315. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13316. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13317. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13318. // We have to close these tags to support XHTML (#13200)
  13319. var wrapMap = {
  13320. // Support: IE <=9 only
  13321. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13322. // XHTML parsers do not magically insert elements in the
  13323. // same way that tag soup parsers do. So we cannot shorten
  13324. // this by omitting <tbody> or other required elements.
  13325. thead: [ 1, "<table>", "</table>" ],
  13326. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13327. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13328. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13329. _default: [ 0, "", "" ]
  13330. };
  13331. // Support: IE <=9 only
  13332. wrapMap.optgroup = wrapMap.option;
  13333. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13334. wrapMap.th = wrapMap.td;
  13335. function getAll( context, tag ) {
  13336. // Support: IE <=9 - 11 only
  13337. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13338. var ret;
  13339. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13340. ret = context.getElementsByTagName( tag || "*" );
  13341. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13342. ret = context.querySelectorAll( tag || "*" );
  13343. } else {
  13344. ret = [];
  13345. }
  13346. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13347. return jQuery.merge( [ context ], ret );
  13348. }
  13349. return ret;
  13350. }
  13351. // Mark scripts as having already been evaluated
  13352. function setGlobalEval( elems, refElements ) {
  13353. var i = 0,
  13354. l = elems.length;
  13355. for ( ; i < l; i++ ) {
  13356. dataPriv.set(
  13357. elems[ i ],
  13358. "globalEval",
  13359. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13360. );
  13361. }
  13362. }
  13363. var rhtml = /<|&#?\w+;/;
  13364. function buildFragment( elems, context, scripts, selection, ignored ) {
  13365. var elem, tmp, tag, wrap, attached, j,
  13366. fragment = context.createDocumentFragment(),
  13367. nodes = [],
  13368. i = 0,
  13369. l = elems.length;
  13370. for ( ; i < l; i++ ) {
  13371. elem = elems[ i ];
  13372. if ( elem || elem === 0 ) {
  13373. // Add nodes directly
  13374. if ( toType( elem ) === "object" ) {
  13375. // Support: Android <=4.0 only, PhantomJS 1 only
  13376. // push.apply(_, arraylike) throws on ancient WebKit
  13377. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13378. // Convert non-html into a text node
  13379. } else if ( !rhtml.test( elem ) ) {
  13380. nodes.push( context.createTextNode( elem ) );
  13381. // Convert html into DOM nodes
  13382. } else {
  13383. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13384. // Deserialize a standard representation
  13385. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13386. wrap = wrapMap[ tag ] || wrapMap._default;
  13387. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13388. // Descend through wrappers to the right content
  13389. j = wrap[ 0 ];
  13390. while ( j-- ) {
  13391. tmp = tmp.lastChild;
  13392. }
  13393. // Support: Android <=4.0 only, PhantomJS 1 only
  13394. // push.apply(_, arraylike) throws on ancient WebKit
  13395. jQuery.merge( nodes, tmp.childNodes );
  13396. // Remember the top-level container
  13397. tmp = fragment.firstChild;
  13398. // Ensure the created nodes are orphaned (#12392)
  13399. tmp.textContent = "";
  13400. }
  13401. }
  13402. }
  13403. // Remove wrapper from fragment
  13404. fragment.textContent = "";
  13405. i = 0;
  13406. while ( ( elem = nodes[ i++ ] ) ) {
  13407. // Skip elements already in the context collection (trac-4087)
  13408. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13409. if ( ignored ) {
  13410. ignored.push( elem );
  13411. }
  13412. continue;
  13413. }
  13414. attached = isAttached( elem );
  13415. // Append to fragment
  13416. tmp = getAll( fragment.appendChild( elem ), "script" );
  13417. // Preserve script evaluation history
  13418. if ( attached ) {
  13419. setGlobalEval( tmp );
  13420. }
  13421. // Capture executables
  13422. if ( scripts ) {
  13423. j = 0;
  13424. while ( ( elem = tmp[ j++ ] ) ) {
  13425. if ( rscriptType.test( elem.type || "" ) ) {
  13426. scripts.push( elem );
  13427. }
  13428. }
  13429. }
  13430. }
  13431. return fragment;
  13432. }
  13433. ( function() {
  13434. var fragment = document.createDocumentFragment(),
  13435. div = fragment.appendChild( document.createElement( "div" ) ),
  13436. input = document.createElement( "input" );
  13437. // Support: Android 4.0 - 4.3 only
  13438. // Check state lost if the name is set (#11217)
  13439. // Support: Windows Web Apps (WWA)
  13440. // `name` and `type` must use .setAttribute for WWA (#14901)
  13441. input.setAttribute( "type", "radio" );
  13442. input.setAttribute( "checked", "checked" );
  13443. input.setAttribute( "name", "t" );
  13444. div.appendChild( input );
  13445. // Support: Android <=4.1 only
  13446. // Older WebKit doesn't clone checked state correctly in fragments
  13447. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13448. // Support: IE <=11 only
  13449. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13450. div.innerHTML = "<textarea>x</textarea>";
  13451. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13452. } )();
  13453. var
  13454. rkeyEvent = /^key/,
  13455. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13456. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13457. function returnTrue() {
  13458. return true;
  13459. }
  13460. function returnFalse() {
  13461. return false;
  13462. }
  13463. // Support: IE <=9 - 11+
  13464. // focus() and blur() are asynchronous, except when they are no-op.
  13465. // So expect focus to be synchronous when the element is already active,
  13466. // and blur to be synchronous when the element is not already active.
  13467. // (focus and blur are always synchronous in other supported browsers,
  13468. // this just defines when we can count on it).
  13469. function expectSync( elem, type ) {
  13470. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13471. }
  13472. // Support: IE <=9 only
  13473. // Accessing document.activeElement can throw unexpectedly
  13474. // https://bugs.jquery.com/ticket/13393
  13475. function safeActiveElement() {
  13476. try {
  13477. return document.activeElement;
  13478. } catch ( err ) { }
  13479. }
  13480. function on( elem, types, selector, data, fn, one ) {
  13481. var origFn, type;
  13482. // Types can be a map of types/handlers
  13483. if ( typeof types === "object" ) {
  13484. // ( types-Object, selector, data )
  13485. if ( typeof selector !== "string" ) {
  13486. // ( types-Object, data )
  13487. data = data || selector;
  13488. selector = undefined;
  13489. }
  13490. for ( type in types ) {
  13491. on( elem, type, selector, data, types[ type ], one );
  13492. }
  13493. return elem;
  13494. }
  13495. if ( data == null && fn == null ) {
  13496. // ( types, fn )
  13497. fn = selector;
  13498. data = selector = undefined;
  13499. } else if ( fn == null ) {
  13500. if ( typeof selector === "string" ) {
  13501. // ( types, selector, fn )
  13502. fn = data;
  13503. data = undefined;
  13504. } else {
  13505. // ( types, data, fn )
  13506. fn = data;
  13507. data = selector;
  13508. selector = undefined;
  13509. }
  13510. }
  13511. if ( fn === false ) {
  13512. fn = returnFalse;
  13513. } else if ( !fn ) {
  13514. return elem;
  13515. }
  13516. if ( one === 1 ) {
  13517. origFn = fn;
  13518. fn = function( event ) {
  13519. // Can use an empty set, since event contains the info
  13520. jQuery().off( event );
  13521. return origFn.apply( this, arguments );
  13522. };
  13523. // Use same guid so caller can remove using origFn
  13524. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13525. }
  13526. return elem.each( function() {
  13527. jQuery.event.add( this, types, fn, data, selector );
  13528. } );
  13529. }
  13530. /*
  13531. * Helper functions for managing events -- not part of the public interface.
  13532. * Props to Dean Edwards' addEvent library for many of the ideas.
  13533. */
  13534. jQuery.event = {
  13535. global: {},
  13536. add: function( elem, types, handler, data, selector ) {
  13537. var handleObjIn, eventHandle, tmp,
  13538. events, t, handleObj,
  13539. special, handlers, type, namespaces, origType,
  13540. elemData = dataPriv.get( elem );
  13541. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13542. if ( !elemData ) {
  13543. return;
  13544. }
  13545. // Caller can pass in an object of custom data in lieu of the handler
  13546. if ( handler.handler ) {
  13547. handleObjIn = handler;
  13548. handler = handleObjIn.handler;
  13549. selector = handleObjIn.selector;
  13550. }
  13551. // Ensure that invalid selectors throw exceptions at attach time
  13552. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13553. if ( selector ) {
  13554. jQuery.find.matchesSelector( documentElement, selector );
  13555. }
  13556. // Make sure that the handler has a unique ID, used to find/remove it later
  13557. if ( !handler.guid ) {
  13558. handler.guid = jQuery.guid++;
  13559. }
  13560. // Init the element's event structure and main handler, if this is the first
  13561. if ( !( events = elemData.events ) ) {
  13562. events = elemData.events = {};
  13563. }
  13564. if ( !( eventHandle = elemData.handle ) ) {
  13565. eventHandle = elemData.handle = function( e ) {
  13566. // Discard the second event of a jQuery.event.trigger() and
  13567. // when an event is called after a page has unloaded
  13568. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13569. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13570. };
  13571. }
  13572. // Handle multiple events separated by a space
  13573. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13574. t = types.length;
  13575. while ( t-- ) {
  13576. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13577. type = origType = tmp[ 1 ];
  13578. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13579. // There *must* be a type, no attaching namespace-only handlers
  13580. if ( !type ) {
  13581. continue;
  13582. }
  13583. // If event changes its type, use the special event handlers for the changed type
  13584. special = jQuery.event.special[ type ] || {};
  13585. // If selector defined, determine special event api type, otherwise given type
  13586. type = ( selector ? special.delegateType : special.bindType ) || type;
  13587. // Update special based on newly reset type
  13588. special = jQuery.event.special[ type ] || {};
  13589. // handleObj is passed to all event handlers
  13590. handleObj = jQuery.extend( {
  13591. type: type,
  13592. origType: origType,
  13593. data: data,
  13594. handler: handler,
  13595. guid: handler.guid,
  13596. selector: selector,
  13597. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13598. namespace: namespaces.join( "." )
  13599. }, handleObjIn );
  13600. // Init the event handler queue if we're the first
  13601. if ( !( handlers = events[ type ] ) ) {
  13602. handlers = events[ type ] = [];
  13603. handlers.delegateCount = 0;
  13604. // Only use addEventListener if the special events handler returns false
  13605. if ( !special.setup ||
  13606. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13607. if ( elem.addEventListener ) {
  13608. elem.addEventListener( type, eventHandle );
  13609. }
  13610. }
  13611. }
  13612. if ( special.add ) {
  13613. special.add.call( elem, handleObj );
  13614. if ( !handleObj.handler.guid ) {
  13615. handleObj.handler.guid = handler.guid;
  13616. }
  13617. }
  13618. // Add to the element's handler list, delegates in front
  13619. if ( selector ) {
  13620. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13621. } else {
  13622. handlers.push( handleObj );
  13623. }
  13624. // Keep track of which events have ever been used, for event optimization
  13625. jQuery.event.global[ type ] = true;
  13626. }
  13627. },
  13628. // Detach an event or set of events from an element
  13629. remove: function( elem, types, handler, selector, mappedTypes ) {
  13630. var j, origCount, tmp,
  13631. events, t, handleObj,
  13632. special, handlers, type, namespaces, origType,
  13633. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13634. if ( !elemData || !( events = elemData.events ) ) {
  13635. return;
  13636. }
  13637. // Once for each type.namespace in types; type may be omitted
  13638. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13639. t = types.length;
  13640. while ( t-- ) {
  13641. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13642. type = origType = tmp[ 1 ];
  13643. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13644. // Unbind all events (on this namespace, if provided) for the element
  13645. if ( !type ) {
  13646. for ( type in events ) {
  13647. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13648. }
  13649. continue;
  13650. }
  13651. special = jQuery.event.special[ type ] || {};
  13652. type = ( selector ? special.delegateType : special.bindType ) || type;
  13653. handlers = events[ type ] || [];
  13654. tmp = tmp[ 2 ] &&
  13655. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13656. // Remove matching events
  13657. origCount = j = handlers.length;
  13658. while ( j-- ) {
  13659. handleObj = handlers[ j ];
  13660. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13661. ( !handler || handler.guid === handleObj.guid ) &&
  13662. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13663. ( !selector || selector === handleObj.selector ||
  13664. selector === "**" && handleObj.selector ) ) {
  13665. handlers.splice( j, 1 );
  13666. if ( handleObj.selector ) {
  13667. handlers.delegateCount--;
  13668. }
  13669. if ( special.remove ) {
  13670. special.remove.call( elem, handleObj );
  13671. }
  13672. }
  13673. }
  13674. // Remove generic event handler if we removed something and no more handlers exist
  13675. // (avoids potential for endless recursion during removal of special event handlers)
  13676. if ( origCount && !handlers.length ) {
  13677. if ( !special.teardown ||
  13678. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13679. jQuery.removeEvent( elem, type, elemData.handle );
  13680. }
  13681. delete events[ type ];
  13682. }
  13683. }
  13684. // Remove data and the expando if it's no longer used
  13685. if ( jQuery.isEmptyObject( events ) ) {
  13686. dataPriv.remove( elem, "handle events" );
  13687. }
  13688. },
  13689. dispatch: function( nativeEvent ) {
  13690. // Make a writable jQuery.Event from the native event object
  13691. var event = jQuery.event.fix( nativeEvent );
  13692. var i, j, ret, matched, handleObj, handlerQueue,
  13693. args = new Array( arguments.length ),
  13694. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13695. special = jQuery.event.special[ event.type ] || {};
  13696. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13697. args[ 0 ] = event;
  13698. for ( i = 1; i < arguments.length; i++ ) {
  13699. args[ i ] = arguments[ i ];
  13700. }
  13701. event.delegateTarget = this;
  13702. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13703. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13704. return;
  13705. }
  13706. // Determine handlers
  13707. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13708. // Run delegates first; they may want to stop propagation beneath us
  13709. i = 0;
  13710. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13711. event.currentTarget = matched.elem;
  13712. j = 0;
  13713. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13714. !event.isImmediatePropagationStopped() ) {
  13715. // If the event is namespaced, then each handler is only invoked if it is
  13716. // specially universal or its namespaces are a superset of the event's.
  13717. if ( !event.rnamespace || handleObj.namespace === false ||
  13718. event.rnamespace.test( handleObj.namespace ) ) {
  13719. event.handleObj = handleObj;
  13720. event.data = handleObj.data;
  13721. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13722. handleObj.handler ).apply( matched.elem, args );
  13723. if ( ret !== undefined ) {
  13724. if ( ( event.result = ret ) === false ) {
  13725. event.preventDefault();
  13726. event.stopPropagation();
  13727. }
  13728. }
  13729. }
  13730. }
  13731. }
  13732. // Call the postDispatch hook for the mapped type
  13733. if ( special.postDispatch ) {
  13734. special.postDispatch.call( this, event );
  13735. }
  13736. return event.result;
  13737. },
  13738. handlers: function( event, handlers ) {
  13739. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13740. handlerQueue = [],
  13741. delegateCount = handlers.delegateCount,
  13742. cur = event.target;
  13743. // Find delegate handlers
  13744. if ( delegateCount &&
  13745. // Support: IE <=9
  13746. // Black-hole SVG <use> instance trees (trac-13180)
  13747. cur.nodeType &&
  13748. // Support: Firefox <=42
  13749. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13750. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13751. // Support: IE 11 only
  13752. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13753. !( event.type === "click" && event.button >= 1 ) ) {
  13754. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13755. // Don't check non-elements (#13208)
  13756. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13757. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13758. matchedHandlers = [];
  13759. matchedSelectors = {};
  13760. for ( i = 0; i < delegateCount; i++ ) {
  13761. handleObj = handlers[ i ];
  13762. // Don't conflict with Object.prototype properties (#13203)
  13763. sel = handleObj.selector + " ";
  13764. if ( matchedSelectors[ sel ] === undefined ) {
  13765. matchedSelectors[ sel ] = handleObj.needsContext ?
  13766. jQuery( sel, this ).index( cur ) > -1 :
  13767. jQuery.find( sel, this, null, [ cur ] ).length;
  13768. }
  13769. if ( matchedSelectors[ sel ] ) {
  13770. matchedHandlers.push( handleObj );
  13771. }
  13772. }
  13773. if ( matchedHandlers.length ) {
  13774. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13775. }
  13776. }
  13777. }
  13778. }
  13779. // Add the remaining (directly-bound) handlers
  13780. cur = this;
  13781. if ( delegateCount < handlers.length ) {
  13782. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13783. }
  13784. return handlerQueue;
  13785. },
  13786. addProp: function( name, hook ) {
  13787. Object.defineProperty( jQuery.Event.prototype, name, {
  13788. enumerable: true,
  13789. configurable: true,
  13790. get: isFunction( hook ) ?
  13791. function() {
  13792. if ( this.originalEvent ) {
  13793. return hook( this.originalEvent );
  13794. }
  13795. } :
  13796. function() {
  13797. if ( this.originalEvent ) {
  13798. return this.originalEvent[ name ];
  13799. }
  13800. },
  13801. set: function( value ) {
  13802. Object.defineProperty( this, name, {
  13803. enumerable: true,
  13804. configurable: true,
  13805. writable: true,
  13806. value: value
  13807. } );
  13808. }
  13809. } );
  13810. },
  13811. fix: function( originalEvent ) {
  13812. return originalEvent[ jQuery.expando ] ?
  13813. originalEvent :
  13814. new jQuery.Event( originalEvent );
  13815. },
  13816. special: {
  13817. load: {
  13818. // Prevent triggered image.load events from bubbling to window.load
  13819. noBubble: true
  13820. },
  13821. click: {
  13822. // Utilize native event to ensure correct state for checkable inputs
  13823. setup: function( data ) {
  13824. // For mutual compressibility with _default, replace `this` access with a local var.
  13825. // `|| data` is dead code meant only to preserve the variable through minification.
  13826. var el = this || data;
  13827. // Claim the first handler
  13828. if ( rcheckableType.test( el.type ) &&
  13829. el.click && nodeName( el, "input" ) ) {
  13830. // dataPriv.set( el, "click", ... )
  13831. leverageNative( el, "click", returnTrue );
  13832. }
  13833. // Return false to allow normal processing in the caller
  13834. return false;
  13835. },
  13836. trigger: function( data ) {
  13837. // For mutual compressibility with _default, replace `this` access with a local var.
  13838. // `|| data` is dead code meant only to preserve the variable through minification.
  13839. var el = this || data;
  13840. // Force setup before triggering a click
  13841. if ( rcheckableType.test( el.type ) &&
  13842. el.click && nodeName( el, "input" ) ) {
  13843. leverageNative( el, "click" );
  13844. }
  13845. // Return non-false to allow normal event-path propagation
  13846. return true;
  13847. },
  13848. // For cross-browser consistency, suppress native .click() on links
  13849. // Also prevent it if we're currently inside a leveraged native-event stack
  13850. _default: function( event ) {
  13851. var target = event.target;
  13852. return rcheckableType.test( target.type ) &&
  13853. target.click && nodeName( target, "input" ) &&
  13854. dataPriv.get( target, "click" ) ||
  13855. nodeName( target, "a" );
  13856. }
  13857. },
  13858. beforeunload: {
  13859. postDispatch: function( event ) {
  13860. // Support: Firefox 20+
  13861. // Firefox doesn't alert if the returnValue field is not set.
  13862. if ( event.result !== undefined && event.originalEvent ) {
  13863. event.originalEvent.returnValue = event.result;
  13864. }
  13865. }
  13866. }
  13867. }
  13868. };
  13869. // Ensure the presence of an event listener that handles manually-triggered
  13870. // synthetic events by interrupting progress until reinvoked in response to
  13871. // *native* events that it fires directly, ensuring that state changes have
  13872. // already occurred before other listeners are invoked.
  13873. function leverageNative( el, type, expectSync ) {
  13874. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13875. if ( !expectSync ) {
  13876. if ( dataPriv.get( el, type ) === undefined ) {
  13877. jQuery.event.add( el, type, returnTrue );
  13878. }
  13879. return;
  13880. }
  13881. // Register the controller as a special universal handler for all event namespaces
  13882. dataPriv.set( el, type, false );
  13883. jQuery.event.add( el, type, {
  13884. namespace: false,
  13885. handler: function( event ) {
  13886. var notAsync, result,
  13887. saved = dataPriv.get( this, type );
  13888. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13889. // Interrupt processing of the outer synthetic .trigger()ed event
  13890. // Saved data should be false in such cases, but might be a leftover capture object
  13891. // from an async native handler (gh-4350)
  13892. if ( !saved.length ) {
  13893. // Store arguments for use when handling the inner native event
  13894. // There will always be at least one argument (an event object), so this array
  13895. // will not be confused with a leftover capture object.
  13896. saved = slice.call( arguments );
  13897. dataPriv.set( this, type, saved );
  13898. // Trigger the native event and capture its result
  13899. // Support: IE <=9 - 11+
  13900. // focus() and blur() are asynchronous
  13901. notAsync = expectSync( this, type );
  13902. this[ type ]();
  13903. result = dataPriv.get( this, type );
  13904. if ( saved !== result || notAsync ) {
  13905. dataPriv.set( this, type, false );
  13906. } else {
  13907. result = {};
  13908. }
  13909. if ( saved !== result ) {
  13910. // Cancel the outer synthetic event
  13911. event.stopImmediatePropagation();
  13912. event.preventDefault();
  13913. return result.value;
  13914. }
  13915. // If this is an inner synthetic event for an event with a bubbling surrogate
  13916. // (focus or blur), assume that the surrogate already propagated from triggering the
  13917. // native event and prevent that from happening again here.
  13918. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13919. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13920. // less bad than duplication.
  13921. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13922. event.stopPropagation();
  13923. }
  13924. // If this is a native event triggered above, everything is now in order
  13925. // Fire an inner synthetic event with the original arguments
  13926. } else if ( saved.length ) {
  13927. // ...and capture the result
  13928. dataPriv.set( this, type, {
  13929. value: jQuery.event.trigger(
  13930. // Support: IE <=9 - 11+
  13931. // Extend with the prototype to reset the above stopImmediatePropagation()
  13932. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13933. saved.slice( 1 ),
  13934. this
  13935. )
  13936. } );
  13937. // Abort handling of the native event
  13938. event.stopImmediatePropagation();
  13939. }
  13940. }
  13941. } );
  13942. }
  13943. jQuery.removeEvent = function( elem, type, handle ) {
  13944. // This "if" is needed for plain objects
  13945. if ( elem.removeEventListener ) {
  13946. elem.removeEventListener( type, handle );
  13947. }
  13948. };
  13949. jQuery.Event = function( src, props ) {
  13950. // Allow instantiation without the 'new' keyword
  13951. if ( !( this instanceof jQuery.Event ) ) {
  13952. return new jQuery.Event( src, props );
  13953. }
  13954. // Event object
  13955. if ( src && src.type ) {
  13956. this.originalEvent = src;
  13957. this.type = src.type;
  13958. // Events bubbling up the document may have been marked as prevented
  13959. // by a handler lower down the tree; reflect the correct value.
  13960. this.isDefaultPrevented = src.defaultPrevented ||
  13961. src.defaultPrevented === undefined &&
  13962. // Support: Android <=2.3 only
  13963. src.returnValue === false ?
  13964. returnTrue :
  13965. returnFalse;
  13966. // Create target properties
  13967. // Support: Safari <=6 - 7 only
  13968. // Target should not be a text node (#504, #13143)
  13969. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13970. src.target.parentNode :
  13971. src.target;
  13972. this.currentTarget = src.currentTarget;
  13973. this.relatedTarget = src.relatedTarget;
  13974. // Event type
  13975. } else {
  13976. this.type = src;
  13977. }
  13978. // Put explicitly provided properties onto the event object
  13979. if ( props ) {
  13980. jQuery.extend( this, props );
  13981. }
  13982. // Create a timestamp if incoming event doesn't have one
  13983. this.timeStamp = src && src.timeStamp || Date.now();
  13984. // Mark it as fixed
  13985. this[ jQuery.expando ] = true;
  13986. };
  13987. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13988. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13989. jQuery.Event.prototype = {
  13990. constructor: jQuery.Event,
  13991. isDefaultPrevented: returnFalse,
  13992. isPropagationStopped: returnFalse,
  13993. isImmediatePropagationStopped: returnFalse,
  13994. isSimulated: false,
  13995. preventDefault: function() {
  13996. var e = this.originalEvent;
  13997. this.isDefaultPrevented = returnTrue;
  13998. if ( e && !this.isSimulated ) {
  13999. e.preventDefault();
  14000. }
  14001. },
  14002. stopPropagation: function() {
  14003. var e = this.originalEvent;
  14004. this.isPropagationStopped = returnTrue;
  14005. if ( e && !this.isSimulated ) {
  14006. e.stopPropagation();
  14007. }
  14008. },
  14009. stopImmediatePropagation: function() {
  14010. var e = this.originalEvent;
  14011. this.isImmediatePropagationStopped = returnTrue;
  14012. if ( e && !this.isSimulated ) {
  14013. e.stopImmediatePropagation();
  14014. }
  14015. this.stopPropagation();
  14016. }
  14017. };
  14018. // Includes all common event props including KeyEvent and MouseEvent specific props
  14019. jQuery.each( {
  14020. altKey: true,
  14021. bubbles: true,
  14022. cancelable: true,
  14023. changedTouches: true,
  14024. ctrlKey: true,
  14025. detail: true,
  14026. eventPhase: true,
  14027. metaKey: true,
  14028. pageX: true,
  14029. pageY: true,
  14030. shiftKey: true,
  14031. view: true,
  14032. "char": true,
  14033. code: true,
  14034. charCode: true,
  14035. key: true,
  14036. keyCode: true,
  14037. button: true,
  14038. buttons: true,
  14039. clientX: true,
  14040. clientY: true,
  14041. offsetX: true,
  14042. offsetY: true,
  14043. pointerId: true,
  14044. pointerType: true,
  14045. screenX: true,
  14046. screenY: true,
  14047. targetTouches: true,
  14048. toElement: true,
  14049. touches: true,
  14050. which: function( event ) {
  14051. var button = event.button;
  14052. // Add which for key events
  14053. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14054. return event.charCode != null ? event.charCode : event.keyCode;
  14055. }
  14056. // Add which for click: 1 === left; 2 === middle; 3 === right
  14057. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14058. if ( button & 1 ) {
  14059. return 1;
  14060. }
  14061. if ( button & 2 ) {
  14062. return 3;
  14063. }
  14064. if ( button & 4 ) {
  14065. return 2;
  14066. }
  14067. return 0;
  14068. }
  14069. return event.which;
  14070. }
  14071. }, jQuery.event.addProp );
  14072. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14073. jQuery.event.special[ type ] = {
  14074. // Utilize native event if possible so blur/focus sequence is correct
  14075. setup: function() {
  14076. // Claim the first handler
  14077. // dataPriv.set( this, "focus", ... )
  14078. // dataPriv.set( this, "blur", ... )
  14079. leverageNative( this, type, expectSync );
  14080. // Return false to allow normal processing in the caller
  14081. return false;
  14082. },
  14083. trigger: function() {
  14084. // Force setup before trigger
  14085. leverageNative( this, type );
  14086. // Return non-false to allow normal event-path propagation
  14087. return true;
  14088. },
  14089. delegateType: delegateType
  14090. };
  14091. } );
  14092. // Create mouseenter/leave events using mouseover/out and event-time checks
  14093. // so that event delegation works in jQuery.
  14094. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14095. //
  14096. // Support: Safari 7 only
  14097. // Safari sends mouseenter too often; see:
  14098. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14099. // for the description of the bug (it existed in older Chrome versions as well).
  14100. jQuery.each( {
  14101. mouseenter: "mouseover",
  14102. mouseleave: "mouseout",
  14103. pointerenter: "pointerover",
  14104. pointerleave: "pointerout"
  14105. }, function( orig, fix ) {
  14106. jQuery.event.special[ orig ] = {
  14107. delegateType: fix,
  14108. bindType: fix,
  14109. handle: function( event ) {
  14110. var ret,
  14111. target = this,
  14112. related = event.relatedTarget,
  14113. handleObj = event.handleObj;
  14114. // For mouseenter/leave call the handler if related is outside the target.
  14115. // NB: No relatedTarget if the mouse left/entered the browser window
  14116. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14117. event.type = handleObj.origType;
  14118. ret = handleObj.handler.apply( this, arguments );
  14119. event.type = fix;
  14120. }
  14121. return ret;
  14122. }
  14123. };
  14124. } );
  14125. jQuery.fn.extend( {
  14126. on: function( types, selector, data, fn ) {
  14127. return on( this, types, selector, data, fn );
  14128. },
  14129. one: function( types, selector, data, fn ) {
  14130. return on( this, types, selector, data, fn, 1 );
  14131. },
  14132. off: function( types, selector, fn ) {
  14133. var handleObj, type;
  14134. if ( types && types.preventDefault && types.handleObj ) {
  14135. // ( event ) dispatched jQuery.Event
  14136. handleObj = types.handleObj;
  14137. jQuery( types.delegateTarget ).off(
  14138. handleObj.namespace ?
  14139. handleObj.origType + "." + handleObj.namespace :
  14140. handleObj.origType,
  14141. handleObj.selector,
  14142. handleObj.handler
  14143. );
  14144. return this;
  14145. }
  14146. if ( typeof types === "object" ) {
  14147. // ( types-object [, selector] )
  14148. for ( type in types ) {
  14149. this.off( type, selector, types[ type ] );
  14150. }
  14151. return this;
  14152. }
  14153. if ( selector === false || typeof selector === "function" ) {
  14154. // ( types [, fn] )
  14155. fn = selector;
  14156. selector = undefined;
  14157. }
  14158. if ( fn === false ) {
  14159. fn = returnFalse;
  14160. }
  14161. return this.each( function() {
  14162. jQuery.event.remove( this, types, fn, selector );
  14163. } );
  14164. }
  14165. } );
  14166. var
  14167. /* eslint-disable max-len */
  14168. // See https://github.com/eslint/eslint/issues/3229
  14169. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14170. /* eslint-enable */
  14171. // Support: IE <=10 - 11, Edge 12 - 13 only
  14172. // In IE/Edge using regex groups here causes severe slowdowns.
  14173. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14174. rnoInnerhtml = /<script|<style|<link/i,
  14175. // checked="checked" or checked
  14176. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14177. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14178. // Prefer a tbody over its parent table for containing new rows
  14179. function manipulationTarget( elem, content ) {
  14180. if ( nodeName( elem, "table" ) &&
  14181. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14182. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14183. }
  14184. return elem;
  14185. }
  14186. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14187. function disableScript( elem ) {
  14188. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14189. return elem;
  14190. }
  14191. function restoreScript( elem ) {
  14192. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14193. elem.type = elem.type.slice( 5 );
  14194. } else {
  14195. elem.removeAttribute( "type" );
  14196. }
  14197. return elem;
  14198. }
  14199. function cloneCopyEvent( src, dest ) {
  14200. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14201. if ( dest.nodeType !== 1 ) {
  14202. return;
  14203. }
  14204. // 1. Copy private data: events, handlers, etc.
  14205. if ( dataPriv.hasData( src ) ) {
  14206. pdataOld = dataPriv.access( src );
  14207. pdataCur = dataPriv.set( dest, pdataOld );
  14208. events = pdataOld.events;
  14209. if ( events ) {
  14210. delete pdataCur.handle;
  14211. pdataCur.events = {};
  14212. for ( type in events ) {
  14213. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14214. jQuery.event.add( dest, type, events[ type ][ i ] );
  14215. }
  14216. }
  14217. }
  14218. }
  14219. // 2. Copy user data
  14220. if ( dataUser.hasData( src ) ) {
  14221. udataOld = dataUser.access( src );
  14222. udataCur = jQuery.extend( {}, udataOld );
  14223. dataUser.set( dest, udataCur );
  14224. }
  14225. }
  14226. // Fix IE bugs, see support tests
  14227. function fixInput( src, dest ) {
  14228. var nodeName = dest.nodeName.toLowerCase();
  14229. // Fails to persist the checked state of a cloned checkbox or radio button.
  14230. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14231. dest.checked = src.checked;
  14232. // Fails to return the selected option to the default selected state when cloning options
  14233. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14234. dest.defaultValue = src.defaultValue;
  14235. }
  14236. }
  14237. function domManip( collection, args, callback, ignored ) {
  14238. // Flatten any nested arrays
  14239. args = concat.apply( [], args );
  14240. var fragment, first, scripts, hasScripts, node, doc,
  14241. i = 0,
  14242. l = collection.length,
  14243. iNoClone = l - 1,
  14244. value = args[ 0 ],
  14245. valueIsFunction = isFunction( value );
  14246. // We can't cloneNode fragments that contain checked, in WebKit
  14247. if ( valueIsFunction ||
  14248. ( l > 1 && typeof value === "string" &&
  14249. !support.checkClone && rchecked.test( value ) ) ) {
  14250. return collection.each( function( index ) {
  14251. var self = collection.eq( index );
  14252. if ( valueIsFunction ) {
  14253. args[ 0 ] = value.call( this, index, self.html() );
  14254. }
  14255. domManip( self, args, callback, ignored );
  14256. } );
  14257. }
  14258. if ( l ) {
  14259. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14260. first = fragment.firstChild;
  14261. if ( fragment.childNodes.length === 1 ) {
  14262. fragment = first;
  14263. }
  14264. // Require either new content or an interest in ignored elements to invoke the callback
  14265. if ( first || ignored ) {
  14266. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14267. hasScripts = scripts.length;
  14268. // Use the original fragment for the last item
  14269. // instead of the first because it can end up
  14270. // being emptied incorrectly in certain situations (#8070).
  14271. for ( ; i < l; i++ ) {
  14272. node = fragment;
  14273. if ( i !== iNoClone ) {
  14274. node = jQuery.clone( node, true, true );
  14275. // Keep references to cloned scripts for later restoration
  14276. if ( hasScripts ) {
  14277. // Support: Android <=4.0 only, PhantomJS 1 only
  14278. // push.apply(_, arraylike) throws on ancient WebKit
  14279. jQuery.merge( scripts, getAll( node, "script" ) );
  14280. }
  14281. }
  14282. callback.call( collection[ i ], node, i );
  14283. }
  14284. if ( hasScripts ) {
  14285. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14286. // Reenable scripts
  14287. jQuery.map( scripts, restoreScript );
  14288. // Evaluate executable scripts on first document insertion
  14289. for ( i = 0; i < hasScripts; i++ ) {
  14290. node = scripts[ i ];
  14291. if ( rscriptType.test( node.type || "" ) &&
  14292. !dataPriv.access( node, "globalEval" ) &&
  14293. jQuery.contains( doc, node ) ) {
  14294. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14295. // Optional AJAX dependency, but won't run scripts if not present
  14296. if ( jQuery._evalUrl && !node.noModule ) {
  14297. jQuery._evalUrl( node.src, {
  14298. nonce: node.nonce || node.getAttribute( "nonce" )
  14299. } );
  14300. }
  14301. } else {
  14302. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14303. }
  14304. }
  14305. }
  14306. }
  14307. }
  14308. }
  14309. return collection;
  14310. }
  14311. function remove( elem, selector, keepData ) {
  14312. var node,
  14313. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14314. i = 0;
  14315. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14316. if ( !keepData && node.nodeType === 1 ) {
  14317. jQuery.cleanData( getAll( node ) );
  14318. }
  14319. if ( node.parentNode ) {
  14320. if ( keepData && isAttached( node ) ) {
  14321. setGlobalEval( getAll( node, "script" ) );
  14322. }
  14323. node.parentNode.removeChild( node );
  14324. }
  14325. }
  14326. return elem;
  14327. }
  14328. jQuery.extend( {
  14329. htmlPrefilter: function( html ) {
  14330. return html.replace( rxhtmlTag, "<$1></$2>" );
  14331. },
  14332. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14333. var i, l, srcElements, destElements,
  14334. clone = elem.cloneNode( true ),
  14335. inPage = isAttached( elem );
  14336. // Fix IE cloning issues
  14337. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14338. !jQuery.isXMLDoc( elem ) ) {
  14339. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14340. destElements = getAll( clone );
  14341. srcElements = getAll( elem );
  14342. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14343. fixInput( srcElements[ i ], destElements[ i ] );
  14344. }
  14345. }
  14346. // Copy the events from the original to the clone
  14347. if ( dataAndEvents ) {
  14348. if ( deepDataAndEvents ) {
  14349. srcElements = srcElements || getAll( elem );
  14350. destElements = destElements || getAll( clone );
  14351. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14352. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14353. }
  14354. } else {
  14355. cloneCopyEvent( elem, clone );
  14356. }
  14357. }
  14358. // Preserve script evaluation history
  14359. destElements = getAll( clone, "script" );
  14360. if ( destElements.length > 0 ) {
  14361. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14362. }
  14363. // Return the cloned set
  14364. return clone;
  14365. },
  14366. cleanData: function( elems ) {
  14367. var data, elem, type,
  14368. special = jQuery.event.special,
  14369. i = 0;
  14370. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14371. if ( acceptData( elem ) ) {
  14372. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14373. if ( data.events ) {
  14374. for ( type in data.events ) {
  14375. if ( special[ type ] ) {
  14376. jQuery.event.remove( elem, type );
  14377. // This is a shortcut to avoid jQuery.event.remove's overhead
  14378. } else {
  14379. jQuery.removeEvent( elem, type, data.handle );
  14380. }
  14381. }
  14382. }
  14383. // Support: Chrome <=35 - 45+
  14384. // Assign undefined instead of using delete, see Data#remove
  14385. elem[ dataPriv.expando ] = undefined;
  14386. }
  14387. if ( elem[ dataUser.expando ] ) {
  14388. // Support: Chrome <=35 - 45+
  14389. // Assign undefined instead of using delete, see Data#remove
  14390. elem[ dataUser.expando ] = undefined;
  14391. }
  14392. }
  14393. }
  14394. }
  14395. } );
  14396. jQuery.fn.extend( {
  14397. detach: function( selector ) {
  14398. return remove( this, selector, true );
  14399. },
  14400. remove: function( selector ) {
  14401. return remove( this, selector );
  14402. },
  14403. text: function( value ) {
  14404. return access( this, function( value ) {
  14405. return value === undefined ?
  14406. jQuery.text( this ) :
  14407. this.empty().each( function() {
  14408. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14409. this.textContent = value;
  14410. }
  14411. } );
  14412. }, null, value, arguments.length );
  14413. },
  14414. append: function() {
  14415. return domManip( this, arguments, function( elem ) {
  14416. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14417. var target = manipulationTarget( this, elem );
  14418. target.appendChild( elem );
  14419. }
  14420. } );
  14421. },
  14422. prepend: function() {
  14423. return domManip( this, arguments, function( elem ) {
  14424. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14425. var target = manipulationTarget( this, elem );
  14426. target.insertBefore( elem, target.firstChild );
  14427. }
  14428. } );
  14429. },
  14430. before: function() {
  14431. return domManip( this, arguments, function( elem ) {
  14432. if ( this.parentNode ) {
  14433. this.parentNode.insertBefore( elem, this );
  14434. }
  14435. } );
  14436. },
  14437. after: function() {
  14438. return domManip( this, arguments, function( elem ) {
  14439. if ( this.parentNode ) {
  14440. this.parentNode.insertBefore( elem, this.nextSibling );
  14441. }
  14442. } );
  14443. },
  14444. empty: function() {
  14445. var elem,
  14446. i = 0;
  14447. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14448. if ( elem.nodeType === 1 ) {
  14449. // Prevent memory leaks
  14450. jQuery.cleanData( getAll( elem, false ) );
  14451. // Remove any remaining nodes
  14452. elem.textContent = "";
  14453. }
  14454. }
  14455. return this;
  14456. },
  14457. clone: function( dataAndEvents, deepDataAndEvents ) {
  14458. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14459. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14460. return this.map( function() {
  14461. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14462. } );
  14463. },
  14464. html: function( value ) {
  14465. return access( this, function( value ) {
  14466. var elem = this[ 0 ] || {},
  14467. i = 0,
  14468. l = this.length;
  14469. if ( value === undefined && elem.nodeType === 1 ) {
  14470. return elem.innerHTML;
  14471. }
  14472. // See if we can take a shortcut and just use innerHTML
  14473. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14474. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14475. value = jQuery.htmlPrefilter( value );
  14476. try {
  14477. for ( ; i < l; i++ ) {
  14478. elem = this[ i ] || {};
  14479. // Remove element nodes and prevent memory leaks
  14480. if ( elem.nodeType === 1 ) {
  14481. jQuery.cleanData( getAll( elem, false ) );
  14482. elem.innerHTML = value;
  14483. }
  14484. }
  14485. elem = 0;
  14486. // If using innerHTML throws an exception, use the fallback method
  14487. } catch ( e ) {}
  14488. }
  14489. if ( elem ) {
  14490. this.empty().append( value );
  14491. }
  14492. }, null, value, arguments.length );
  14493. },
  14494. replaceWith: function() {
  14495. var ignored = [];
  14496. // Make the changes, replacing each non-ignored context element with the new content
  14497. return domManip( this, arguments, function( elem ) {
  14498. var parent = this.parentNode;
  14499. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14500. jQuery.cleanData( getAll( this ) );
  14501. if ( parent ) {
  14502. parent.replaceChild( elem, this );
  14503. }
  14504. }
  14505. // Force callback invocation
  14506. }, ignored );
  14507. }
  14508. } );
  14509. jQuery.each( {
  14510. appendTo: "append",
  14511. prependTo: "prepend",
  14512. insertBefore: "before",
  14513. insertAfter: "after",
  14514. replaceAll: "replaceWith"
  14515. }, function( name, original ) {
  14516. jQuery.fn[ name ] = function( selector ) {
  14517. var elems,
  14518. ret = [],
  14519. insert = jQuery( selector ),
  14520. last = insert.length - 1,
  14521. i = 0;
  14522. for ( ; i <= last; i++ ) {
  14523. elems = i === last ? this : this.clone( true );
  14524. jQuery( insert[ i ] )[ original ]( elems );
  14525. // Support: Android <=4.0 only, PhantomJS 1 only
  14526. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14527. push.apply( ret, elems.get() );
  14528. }
  14529. return this.pushStack( ret );
  14530. };
  14531. } );
  14532. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14533. var getStyles = function( elem ) {
  14534. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14535. // IE throws on elements created in popups
  14536. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14537. var view = elem.ownerDocument.defaultView;
  14538. if ( !view || !view.opener ) {
  14539. view = window;
  14540. }
  14541. return view.getComputedStyle( elem );
  14542. };
  14543. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14544. ( function() {
  14545. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14546. // so they're executed at the same time to save the second computation.
  14547. function computeStyleTests() {
  14548. // This is a singleton, we need to execute it only once
  14549. if ( !div ) {
  14550. return;
  14551. }
  14552. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14553. "margin-top:1px;padding:0;border:0";
  14554. div.style.cssText =
  14555. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14556. "margin:auto;border:1px;padding:1px;" +
  14557. "width:60%;top:1%";
  14558. documentElement.appendChild( container ).appendChild( div );
  14559. var divStyle = window.getComputedStyle( div );
  14560. pixelPositionVal = divStyle.top !== "1%";
  14561. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14562. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14563. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14564. // Some styles come back with percentage values, even though they shouldn't
  14565. div.style.right = "60%";
  14566. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14567. // Support: IE 9 - 11 only
  14568. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14569. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14570. // Support: IE 9 only
  14571. // Detect overflow:scroll screwiness (gh-3699)
  14572. // Support: Chrome <=64
  14573. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14574. div.style.position = "absolute";
  14575. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14576. documentElement.removeChild( container );
  14577. // Nullify the div so it wouldn't be stored in the memory and
  14578. // it will also be a sign that checks already performed
  14579. div = null;
  14580. }
  14581. function roundPixelMeasures( measure ) {
  14582. return Math.round( parseFloat( measure ) );
  14583. }
  14584. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14585. reliableMarginLeftVal,
  14586. container = document.createElement( "div" ),
  14587. div = document.createElement( "div" );
  14588. // Finish early in limited (non-browser) environments
  14589. if ( !div.style ) {
  14590. return;
  14591. }
  14592. // Support: IE <=9 - 11 only
  14593. // Style of cloned element affects source element cloned (#8908)
  14594. div.style.backgroundClip = "content-box";
  14595. div.cloneNode( true ).style.backgroundClip = "";
  14596. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14597. jQuery.extend( support, {
  14598. boxSizingReliable: function() {
  14599. computeStyleTests();
  14600. return boxSizingReliableVal;
  14601. },
  14602. pixelBoxStyles: function() {
  14603. computeStyleTests();
  14604. return pixelBoxStylesVal;
  14605. },
  14606. pixelPosition: function() {
  14607. computeStyleTests();
  14608. return pixelPositionVal;
  14609. },
  14610. reliableMarginLeft: function() {
  14611. computeStyleTests();
  14612. return reliableMarginLeftVal;
  14613. },
  14614. scrollboxSize: function() {
  14615. computeStyleTests();
  14616. return scrollboxSizeVal;
  14617. }
  14618. } );
  14619. } )();
  14620. function curCSS( elem, name, computed ) {
  14621. var width, minWidth, maxWidth, ret,
  14622. // Support: Firefox 51+
  14623. // Retrieving style before computed somehow
  14624. // fixes an issue with getting wrong values
  14625. // on detached elements
  14626. style = elem.style;
  14627. computed = computed || getStyles( elem );
  14628. // getPropertyValue is needed for:
  14629. // .css('filter') (IE 9 only, #12537)
  14630. // .css('--customProperty) (#3144)
  14631. if ( computed ) {
  14632. ret = computed.getPropertyValue( name ) || computed[ name ];
  14633. if ( ret === "" && !isAttached( elem ) ) {
  14634. ret = jQuery.style( elem, name );
  14635. }
  14636. // A tribute to the "awesome hack by Dean Edwards"
  14637. // Android Browser returns percentage for some values,
  14638. // but width seems to be reliably pixels.
  14639. // This is against the CSSOM draft spec:
  14640. // https://drafts.csswg.org/cssom/#resolved-values
  14641. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14642. // Remember the original values
  14643. width = style.width;
  14644. minWidth = style.minWidth;
  14645. maxWidth = style.maxWidth;
  14646. // Put in the new values to get a computed value out
  14647. style.minWidth = style.maxWidth = style.width = ret;
  14648. ret = computed.width;
  14649. // Revert the changed values
  14650. style.width = width;
  14651. style.minWidth = minWidth;
  14652. style.maxWidth = maxWidth;
  14653. }
  14654. }
  14655. return ret !== undefined ?
  14656. // Support: IE <=9 - 11 only
  14657. // IE returns zIndex value as an integer.
  14658. ret + "" :
  14659. ret;
  14660. }
  14661. function addGetHookIf( conditionFn, hookFn ) {
  14662. // Define the hook, we'll check on the first run if it's really needed.
  14663. return {
  14664. get: function() {
  14665. if ( conditionFn() ) {
  14666. // Hook not needed (or it's not possible to use it due
  14667. // to missing dependency), remove it.
  14668. delete this.get;
  14669. return;
  14670. }
  14671. // Hook needed; redefine it so that the support test is not executed again.
  14672. return ( this.get = hookFn ).apply( this, arguments );
  14673. }
  14674. };
  14675. }
  14676. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14677. emptyStyle = document.createElement( "div" ).style,
  14678. vendorProps = {};
  14679. // Return a vendor-prefixed property or undefined
  14680. function vendorPropName( name ) {
  14681. // Check for vendor prefixed names
  14682. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14683. i = cssPrefixes.length;
  14684. while ( i-- ) {
  14685. name = cssPrefixes[ i ] + capName;
  14686. if ( name in emptyStyle ) {
  14687. return name;
  14688. }
  14689. }
  14690. }
  14691. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14692. function finalPropName( name ) {
  14693. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14694. if ( final ) {
  14695. return final;
  14696. }
  14697. if ( name in emptyStyle ) {
  14698. return name;
  14699. }
  14700. return vendorProps[ name ] = vendorPropName( name ) || name;
  14701. }
  14702. var
  14703. // Swappable if display is none or starts with table
  14704. // except "table", "table-cell", or "table-caption"
  14705. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14706. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14707. rcustomProp = /^--/,
  14708. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14709. cssNormalTransform = {
  14710. letterSpacing: "0",
  14711. fontWeight: "400"
  14712. };
  14713. function setPositiveNumber( elem, value, subtract ) {
  14714. // Any relative (+/-) values have already been
  14715. // normalized at this point
  14716. var matches = rcssNum.exec( value );
  14717. return matches ?
  14718. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14719. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14720. value;
  14721. }
  14722. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14723. var i = dimension === "width" ? 1 : 0,
  14724. extra = 0,
  14725. delta = 0;
  14726. // Adjustment may not be necessary
  14727. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14728. return 0;
  14729. }
  14730. for ( ; i < 4; i += 2 ) {
  14731. // Both box models exclude margin
  14732. if ( box === "margin" ) {
  14733. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14734. }
  14735. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14736. if ( !isBorderBox ) {
  14737. // Add padding
  14738. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14739. // For "border" or "margin", add border
  14740. if ( box !== "padding" ) {
  14741. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14742. // But still keep track of it otherwise
  14743. } else {
  14744. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14745. }
  14746. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14747. // "padding" or "margin"
  14748. } else {
  14749. // For "content", subtract padding
  14750. if ( box === "content" ) {
  14751. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14752. }
  14753. // For "content" or "padding", subtract border
  14754. if ( box !== "margin" ) {
  14755. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14756. }
  14757. }
  14758. }
  14759. // Account for positive content-box scroll gutter when requested by providing computedVal
  14760. if ( !isBorderBox && computedVal >= 0 ) {
  14761. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14762. // Assuming integer scroll gutter, subtract the rest and round down
  14763. delta += Math.max( 0, Math.ceil(
  14764. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14765. computedVal -
  14766. delta -
  14767. extra -
  14768. 0.5
  14769. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14770. // Use an explicit zero to avoid NaN (gh-3964)
  14771. ) ) || 0;
  14772. }
  14773. return delta;
  14774. }
  14775. function getWidthOrHeight( elem, dimension, extra ) {
  14776. // Start with computed style
  14777. var styles = getStyles( elem ),
  14778. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14779. // Fake content-box until we know it's needed to know the true value.
  14780. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14781. isBorderBox = boxSizingNeeded &&
  14782. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14783. valueIsBorderBox = isBorderBox,
  14784. val = curCSS( elem, dimension, styles ),
  14785. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14786. // Support: Firefox <=54
  14787. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14788. if ( rnumnonpx.test( val ) ) {
  14789. if ( !extra ) {
  14790. return val;
  14791. }
  14792. val = "auto";
  14793. }
  14794. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14795. // This happens for inline elements with no explicit setting (gh-3571)
  14796. // Support: Android <=4.1 - 4.3 only
  14797. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14798. // Support: IE 9-11 only
  14799. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14800. // We use getClientRects() to check for hidden/disconnected.
  14801. // In those cases, the computed value can be trusted to be border-box
  14802. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14803. val === "auto" ||
  14804. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14805. elem.getClientRects().length ) {
  14806. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14807. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14808. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14809. // retrieved value as a content box dimension.
  14810. valueIsBorderBox = offsetProp in elem;
  14811. if ( valueIsBorderBox ) {
  14812. val = elem[ offsetProp ];
  14813. }
  14814. }
  14815. // Normalize "" and auto
  14816. val = parseFloat( val ) || 0;
  14817. // Adjust for the element's box model
  14818. return ( val +
  14819. boxModelAdjustment(
  14820. elem,
  14821. dimension,
  14822. extra || ( isBorderBox ? "border" : "content" ),
  14823. valueIsBorderBox,
  14824. styles,
  14825. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14826. val
  14827. )
  14828. ) + "px";
  14829. }
  14830. jQuery.extend( {
  14831. // Add in style property hooks for overriding the default
  14832. // behavior of getting and setting a style property
  14833. cssHooks: {
  14834. opacity: {
  14835. get: function( elem, computed ) {
  14836. if ( computed ) {
  14837. // We should always get a number back from opacity
  14838. var ret = curCSS( elem, "opacity" );
  14839. return ret === "" ? "1" : ret;
  14840. }
  14841. }
  14842. }
  14843. },
  14844. // Don't automatically add "px" to these possibly-unitless properties
  14845. cssNumber: {
  14846. "animationIterationCount": true,
  14847. "columnCount": true,
  14848. "fillOpacity": true,
  14849. "flexGrow": true,
  14850. "flexShrink": true,
  14851. "fontWeight": true,
  14852. "gridArea": true,
  14853. "gridColumn": true,
  14854. "gridColumnEnd": true,
  14855. "gridColumnStart": true,
  14856. "gridRow": true,
  14857. "gridRowEnd": true,
  14858. "gridRowStart": true,
  14859. "lineHeight": true,
  14860. "opacity": true,
  14861. "order": true,
  14862. "orphans": true,
  14863. "widows": true,
  14864. "zIndex": true,
  14865. "zoom": true
  14866. },
  14867. // Add in properties whose names you wish to fix before
  14868. // setting or getting the value
  14869. cssProps: {},
  14870. // Get and set the style property on a DOM Node
  14871. style: function( elem, name, value, extra ) {
  14872. // Don't set styles on text and comment nodes
  14873. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14874. return;
  14875. }
  14876. // Make sure that we're working with the right name
  14877. var ret, type, hooks,
  14878. origName = camelCase( name ),
  14879. isCustomProp = rcustomProp.test( name ),
  14880. style = elem.style;
  14881. // Make sure that we're working with the right name. We don't
  14882. // want to query the value if it is a CSS custom property
  14883. // since they are user-defined.
  14884. if ( !isCustomProp ) {
  14885. name = finalPropName( origName );
  14886. }
  14887. // Gets hook for the prefixed version, then unprefixed version
  14888. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14889. // Check if we're setting a value
  14890. if ( value !== undefined ) {
  14891. type = typeof value;
  14892. // Convert "+=" or "-=" to relative numbers (#7345)
  14893. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14894. value = adjustCSS( elem, name, ret );
  14895. // Fixes bug #9237
  14896. type = "number";
  14897. }
  14898. // Make sure that null and NaN values aren't set (#7116)
  14899. if ( value == null || value !== value ) {
  14900. return;
  14901. }
  14902. // If a number was passed in, add the unit (except for certain CSS properties)
  14903. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14904. // "px" to a few hardcoded values.
  14905. if ( type === "number" && !isCustomProp ) {
  14906. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14907. }
  14908. // background-* props affect original clone's values
  14909. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14910. style[ name ] = "inherit";
  14911. }
  14912. // If a hook was provided, use that value, otherwise just set the specified value
  14913. if ( !hooks || !( "set" in hooks ) ||
  14914. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14915. if ( isCustomProp ) {
  14916. style.setProperty( name, value );
  14917. } else {
  14918. style[ name ] = value;
  14919. }
  14920. }
  14921. } else {
  14922. // If a hook was provided get the non-computed value from there
  14923. if ( hooks && "get" in hooks &&
  14924. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14925. return ret;
  14926. }
  14927. // Otherwise just get the value from the style object
  14928. return style[ name ];
  14929. }
  14930. },
  14931. css: function( elem, name, extra, styles ) {
  14932. var val, num, hooks,
  14933. origName = camelCase( name ),
  14934. isCustomProp = rcustomProp.test( name );
  14935. // Make sure that we're working with the right name. We don't
  14936. // want to modify the value if it is a CSS custom property
  14937. // since they are user-defined.
  14938. if ( !isCustomProp ) {
  14939. name = finalPropName( origName );
  14940. }
  14941. // Try prefixed name followed by the unprefixed name
  14942. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14943. // If a hook was provided get the computed value from there
  14944. if ( hooks && "get" in hooks ) {
  14945. val = hooks.get( elem, true, extra );
  14946. }
  14947. // Otherwise, if a way to get the computed value exists, use that
  14948. if ( val === undefined ) {
  14949. val = curCSS( elem, name, styles );
  14950. }
  14951. // Convert "normal" to computed value
  14952. if ( val === "normal" && name in cssNormalTransform ) {
  14953. val = cssNormalTransform[ name ];
  14954. }
  14955. // Make numeric if forced or a qualifier was provided and val looks numeric
  14956. if ( extra === "" || extra ) {
  14957. num = parseFloat( val );
  14958. return extra === true || isFinite( num ) ? num || 0 : val;
  14959. }
  14960. return val;
  14961. }
  14962. } );
  14963. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14964. jQuery.cssHooks[ dimension ] = {
  14965. get: function( elem, computed, extra ) {
  14966. if ( computed ) {
  14967. // Certain elements can have dimension info if we invisibly show them
  14968. // but it must have a current display style that would benefit
  14969. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14970. // Support: Safari 8+
  14971. // Table columns in Safari have non-zero offsetWidth & zero
  14972. // getBoundingClientRect().width unless display is changed.
  14973. // Support: IE <=11 only
  14974. // Running getBoundingClientRect on a disconnected node
  14975. // in IE throws an error.
  14976. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14977. swap( elem, cssShow, function() {
  14978. return getWidthOrHeight( elem, dimension, extra );
  14979. } ) :
  14980. getWidthOrHeight( elem, dimension, extra );
  14981. }
  14982. },
  14983. set: function( elem, value, extra ) {
  14984. var matches,
  14985. styles = getStyles( elem ),
  14986. // Only read styles.position if the test has a chance to fail
  14987. // to avoid forcing a reflow.
  14988. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14989. styles.position === "absolute",
  14990. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14991. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14992. isBorderBox = boxSizingNeeded &&
  14993. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14994. subtract = extra ?
  14995. boxModelAdjustment(
  14996. elem,
  14997. dimension,
  14998. extra,
  14999. isBorderBox,
  15000. styles
  15001. ) :
  15002. 0;
  15003. // Account for unreliable border-box dimensions by comparing offset* to computed and
  15004. // faking a content-box to get border and padding (gh-3699)
  15005. if ( isBorderBox && scrollboxSizeBuggy ) {
  15006. subtract -= Math.ceil(
  15007. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  15008. parseFloat( styles[ dimension ] ) -
  15009. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  15010. 0.5
  15011. );
  15012. }
  15013. // Convert to pixels if value adjustment is needed
  15014. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15015. ( matches[ 3 ] || "px" ) !== "px" ) {
  15016. elem.style[ dimension ] = value;
  15017. value = jQuery.css( elem, dimension );
  15018. }
  15019. return setPositiveNumber( elem, value, subtract );
  15020. }
  15021. };
  15022. } );
  15023. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15024. function( elem, computed ) {
  15025. if ( computed ) {
  15026. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15027. elem.getBoundingClientRect().left -
  15028. swap( elem, { marginLeft: 0 }, function() {
  15029. return elem.getBoundingClientRect().left;
  15030. } )
  15031. ) + "px";
  15032. }
  15033. }
  15034. );
  15035. // These hooks are used by animate to expand properties
  15036. jQuery.each( {
  15037. margin: "",
  15038. padding: "",
  15039. border: "Width"
  15040. }, function( prefix, suffix ) {
  15041. jQuery.cssHooks[ prefix + suffix ] = {
  15042. expand: function( value ) {
  15043. var i = 0,
  15044. expanded = {},
  15045. // Assumes a single number if not a string
  15046. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15047. for ( ; i < 4; i++ ) {
  15048. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15049. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15050. }
  15051. return expanded;
  15052. }
  15053. };
  15054. if ( prefix !== "margin" ) {
  15055. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15056. }
  15057. } );
  15058. jQuery.fn.extend( {
  15059. css: function( name, value ) {
  15060. return access( this, function( elem, name, value ) {
  15061. var styles, len,
  15062. map = {},
  15063. i = 0;
  15064. if ( Array.isArray( name ) ) {
  15065. styles = getStyles( elem );
  15066. len = name.length;
  15067. for ( ; i < len; i++ ) {
  15068. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15069. }
  15070. return map;
  15071. }
  15072. return value !== undefined ?
  15073. jQuery.style( elem, name, value ) :
  15074. jQuery.css( elem, name );
  15075. }, name, value, arguments.length > 1 );
  15076. }
  15077. } );
  15078. function Tween( elem, options, prop, end, easing ) {
  15079. return new Tween.prototype.init( elem, options, prop, end, easing );
  15080. }
  15081. jQuery.Tween = Tween;
  15082. Tween.prototype = {
  15083. constructor: Tween,
  15084. init: function( elem, options, prop, end, easing, unit ) {
  15085. this.elem = elem;
  15086. this.prop = prop;
  15087. this.easing = easing || jQuery.easing._default;
  15088. this.options = options;
  15089. this.start = this.now = this.cur();
  15090. this.end = end;
  15091. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15092. },
  15093. cur: function() {
  15094. var hooks = Tween.propHooks[ this.prop ];
  15095. return hooks && hooks.get ?
  15096. hooks.get( this ) :
  15097. Tween.propHooks._default.get( this );
  15098. },
  15099. run: function( percent ) {
  15100. var eased,
  15101. hooks = Tween.propHooks[ this.prop ];
  15102. if ( this.options.duration ) {
  15103. this.pos = eased = jQuery.easing[ this.easing ](
  15104. percent, this.options.duration * percent, 0, 1, this.options.duration
  15105. );
  15106. } else {
  15107. this.pos = eased = percent;
  15108. }
  15109. this.now = ( this.end - this.start ) * eased + this.start;
  15110. if ( this.options.step ) {
  15111. this.options.step.call( this.elem, this.now, this );
  15112. }
  15113. if ( hooks && hooks.set ) {
  15114. hooks.set( this );
  15115. } else {
  15116. Tween.propHooks._default.set( this );
  15117. }
  15118. return this;
  15119. }
  15120. };
  15121. Tween.prototype.init.prototype = Tween.prototype;
  15122. Tween.propHooks = {
  15123. _default: {
  15124. get: function( tween ) {
  15125. var result;
  15126. // Use a property on the element directly when it is not a DOM element,
  15127. // or when there is no matching style property that exists.
  15128. if ( tween.elem.nodeType !== 1 ||
  15129. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15130. return tween.elem[ tween.prop ];
  15131. }
  15132. // Passing an empty string as a 3rd parameter to .css will automatically
  15133. // attempt a parseFloat and fallback to a string if the parse fails.
  15134. // Simple values such as "10px" are parsed to Float;
  15135. // complex values such as "rotate(1rad)" are returned as-is.
  15136. result = jQuery.css( tween.elem, tween.prop, "" );
  15137. // Empty strings, null, undefined and "auto" are converted to 0.
  15138. return !result || result === "auto" ? 0 : result;
  15139. },
  15140. set: function( tween ) {
  15141. // Use step hook for back compat.
  15142. // Use cssHook if its there.
  15143. // Use .style if available and use plain properties where available.
  15144. if ( jQuery.fx.step[ tween.prop ] ) {
  15145. jQuery.fx.step[ tween.prop ]( tween );
  15146. } else if ( tween.elem.nodeType === 1 && (
  15147. jQuery.cssHooks[ tween.prop ] ||
  15148. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15149. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15150. } else {
  15151. tween.elem[ tween.prop ] = tween.now;
  15152. }
  15153. }
  15154. }
  15155. };
  15156. // Support: IE <=9 only
  15157. // Panic based approach to setting things on disconnected nodes
  15158. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15159. set: function( tween ) {
  15160. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15161. tween.elem[ tween.prop ] = tween.now;
  15162. }
  15163. }
  15164. };
  15165. jQuery.easing = {
  15166. linear: function( p ) {
  15167. return p;
  15168. },
  15169. swing: function( p ) {
  15170. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15171. },
  15172. _default: "swing"
  15173. };
  15174. jQuery.fx = Tween.prototype.init;
  15175. // Back compat <1.8 extension point
  15176. jQuery.fx.step = {};
  15177. var
  15178. fxNow, inProgress,
  15179. rfxtypes = /^(?:toggle|show|hide)$/,
  15180. rrun = /queueHooks$/;
  15181. function schedule() {
  15182. if ( inProgress ) {
  15183. if ( document.hidden === false && window.requestAnimationFrame ) {
  15184. window.requestAnimationFrame( schedule );
  15185. } else {
  15186. window.setTimeout( schedule, jQuery.fx.interval );
  15187. }
  15188. jQuery.fx.tick();
  15189. }
  15190. }
  15191. // Animations created synchronously will run synchronously
  15192. function createFxNow() {
  15193. window.setTimeout( function() {
  15194. fxNow = undefined;
  15195. } );
  15196. return ( fxNow = Date.now() );
  15197. }
  15198. // Generate parameters to create a standard animation
  15199. function genFx( type, includeWidth ) {
  15200. var which,
  15201. i = 0,
  15202. attrs = { height: type };
  15203. // If we include width, step value is 1 to do all cssExpand values,
  15204. // otherwise step value is 2 to skip over Left and Right
  15205. includeWidth = includeWidth ? 1 : 0;
  15206. for ( ; i < 4; i += 2 - includeWidth ) {
  15207. which = cssExpand[ i ];
  15208. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15209. }
  15210. if ( includeWidth ) {
  15211. attrs.opacity = attrs.width = type;
  15212. }
  15213. return attrs;
  15214. }
  15215. function createTween( value, prop, animation ) {
  15216. var tween,
  15217. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15218. index = 0,
  15219. length = collection.length;
  15220. for ( ; index < length; index++ ) {
  15221. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15222. // We're done with this property
  15223. return tween;
  15224. }
  15225. }
  15226. }
  15227. function defaultPrefilter( elem, props, opts ) {
  15228. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15229. isBox = "width" in props || "height" in props,
  15230. anim = this,
  15231. orig = {},
  15232. style = elem.style,
  15233. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15234. dataShow = dataPriv.get( elem, "fxshow" );
  15235. // Queue-skipping animations hijack the fx hooks
  15236. if ( !opts.queue ) {
  15237. hooks = jQuery._queueHooks( elem, "fx" );
  15238. if ( hooks.unqueued == null ) {
  15239. hooks.unqueued = 0;
  15240. oldfire = hooks.empty.fire;
  15241. hooks.empty.fire = function() {
  15242. if ( !hooks.unqueued ) {
  15243. oldfire();
  15244. }
  15245. };
  15246. }
  15247. hooks.unqueued++;
  15248. anim.always( function() {
  15249. // Ensure the complete handler is called before this completes
  15250. anim.always( function() {
  15251. hooks.unqueued--;
  15252. if ( !jQuery.queue( elem, "fx" ).length ) {
  15253. hooks.empty.fire();
  15254. }
  15255. } );
  15256. } );
  15257. }
  15258. // Detect show/hide animations
  15259. for ( prop in props ) {
  15260. value = props[ prop ];
  15261. if ( rfxtypes.test( value ) ) {
  15262. delete props[ prop ];
  15263. toggle = toggle || value === "toggle";
  15264. if ( value === ( hidden ? "hide" : "show" ) ) {
  15265. // Pretend to be hidden if this is a "show" and
  15266. // there is still data from a stopped show/hide
  15267. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15268. hidden = true;
  15269. // Ignore all other no-op show/hide data
  15270. } else {
  15271. continue;
  15272. }
  15273. }
  15274. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15275. }
  15276. }
  15277. // Bail out if this is a no-op like .hide().hide()
  15278. propTween = !jQuery.isEmptyObject( props );
  15279. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15280. return;
  15281. }
  15282. // Restrict "overflow" and "display" styles during box animations
  15283. if ( isBox && elem.nodeType === 1 ) {
  15284. // Support: IE <=9 - 11, Edge 12 - 15
  15285. // Record all 3 overflow attributes because IE does not infer the shorthand
  15286. // from identically-valued overflowX and overflowY and Edge just mirrors
  15287. // the overflowX value there.
  15288. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15289. // Identify a display type, preferring old show/hide data over the CSS cascade
  15290. restoreDisplay = dataShow && dataShow.display;
  15291. if ( restoreDisplay == null ) {
  15292. restoreDisplay = dataPriv.get( elem, "display" );
  15293. }
  15294. display = jQuery.css( elem, "display" );
  15295. if ( display === "none" ) {
  15296. if ( restoreDisplay ) {
  15297. display = restoreDisplay;
  15298. } else {
  15299. // Get nonempty value(s) by temporarily forcing visibility
  15300. showHide( [ elem ], true );
  15301. restoreDisplay = elem.style.display || restoreDisplay;
  15302. display = jQuery.css( elem, "display" );
  15303. showHide( [ elem ] );
  15304. }
  15305. }
  15306. // Animate inline elements as inline-block
  15307. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15308. if ( jQuery.css( elem, "float" ) === "none" ) {
  15309. // Restore the original display value at the end of pure show/hide animations
  15310. if ( !propTween ) {
  15311. anim.done( function() {
  15312. style.display = restoreDisplay;
  15313. } );
  15314. if ( restoreDisplay == null ) {
  15315. display = style.display;
  15316. restoreDisplay = display === "none" ? "" : display;
  15317. }
  15318. }
  15319. style.display = "inline-block";
  15320. }
  15321. }
  15322. }
  15323. if ( opts.overflow ) {
  15324. style.overflow = "hidden";
  15325. anim.always( function() {
  15326. style.overflow = opts.overflow[ 0 ];
  15327. style.overflowX = opts.overflow[ 1 ];
  15328. style.overflowY = opts.overflow[ 2 ];
  15329. } );
  15330. }
  15331. // Implement show/hide animations
  15332. propTween = false;
  15333. for ( prop in orig ) {
  15334. // General show/hide setup for this element animation
  15335. if ( !propTween ) {
  15336. if ( dataShow ) {
  15337. if ( "hidden" in dataShow ) {
  15338. hidden = dataShow.hidden;
  15339. }
  15340. } else {
  15341. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15342. }
  15343. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15344. if ( toggle ) {
  15345. dataShow.hidden = !hidden;
  15346. }
  15347. // Show elements before animating them
  15348. if ( hidden ) {
  15349. showHide( [ elem ], true );
  15350. }
  15351. /* eslint-disable no-loop-func */
  15352. anim.done( function() {
  15353. /* eslint-enable no-loop-func */
  15354. // The final step of a "hide" animation is actually hiding the element
  15355. if ( !hidden ) {
  15356. showHide( [ elem ] );
  15357. }
  15358. dataPriv.remove( elem, "fxshow" );
  15359. for ( prop in orig ) {
  15360. jQuery.style( elem, prop, orig[ prop ] );
  15361. }
  15362. } );
  15363. }
  15364. // Per-property setup
  15365. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15366. if ( !( prop in dataShow ) ) {
  15367. dataShow[ prop ] = propTween.start;
  15368. if ( hidden ) {
  15369. propTween.end = propTween.start;
  15370. propTween.start = 0;
  15371. }
  15372. }
  15373. }
  15374. }
  15375. function propFilter( props, specialEasing ) {
  15376. var index, name, easing, value, hooks;
  15377. // camelCase, specialEasing and expand cssHook pass
  15378. for ( index in props ) {
  15379. name = camelCase( index );
  15380. easing = specialEasing[ name ];
  15381. value = props[ index ];
  15382. if ( Array.isArray( value ) ) {
  15383. easing = value[ 1 ];
  15384. value = props[ index ] = value[ 0 ];
  15385. }
  15386. if ( index !== name ) {
  15387. props[ name ] = value;
  15388. delete props[ index ];
  15389. }
  15390. hooks = jQuery.cssHooks[ name ];
  15391. if ( hooks && "expand" in hooks ) {
  15392. value = hooks.expand( value );
  15393. delete props[ name ];
  15394. // Not quite $.extend, this won't overwrite existing keys.
  15395. // Reusing 'index' because we have the correct "name"
  15396. for ( index in value ) {
  15397. if ( !( index in props ) ) {
  15398. props[ index ] = value[ index ];
  15399. specialEasing[ index ] = easing;
  15400. }
  15401. }
  15402. } else {
  15403. specialEasing[ name ] = easing;
  15404. }
  15405. }
  15406. }
  15407. function Animation( elem, properties, options ) {
  15408. var result,
  15409. stopped,
  15410. index = 0,
  15411. length = Animation.prefilters.length,
  15412. deferred = jQuery.Deferred().always( function() {
  15413. // Don't match elem in the :animated selector
  15414. delete tick.elem;
  15415. } ),
  15416. tick = function() {
  15417. if ( stopped ) {
  15418. return false;
  15419. }
  15420. var currentTime = fxNow || createFxNow(),
  15421. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15422. // Support: Android 2.3 only
  15423. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15424. temp = remaining / animation.duration || 0,
  15425. percent = 1 - temp,
  15426. index = 0,
  15427. length = animation.tweens.length;
  15428. for ( ; index < length; index++ ) {
  15429. animation.tweens[ index ].run( percent );
  15430. }
  15431. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15432. // If there's more to do, yield
  15433. if ( percent < 1 && length ) {
  15434. return remaining;
  15435. }
  15436. // If this was an empty animation, synthesize a final progress notification
  15437. if ( !length ) {
  15438. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15439. }
  15440. // Resolve the animation and report its conclusion
  15441. deferred.resolveWith( elem, [ animation ] );
  15442. return false;
  15443. },
  15444. animation = deferred.promise( {
  15445. elem: elem,
  15446. props: jQuery.extend( {}, properties ),
  15447. opts: jQuery.extend( true, {
  15448. specialEasing: {},
  15449. easing: jQuery.easing._default
  15450. }, options ),
  15451. originalProperties: properties,
  15452. originalOptions: options,
  15453. startTime: fxNow || createFxNow(),
  15454. duration: options.duration,
  15455. tweens: [],
  15456. createTween: function( prop, end ) {
  15457. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15458. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15459. animation.tweens.push( tween );
  15460. return tween;
  15461. },
  15462. stop: function( gotoEnd ) {
  15463. var index = 0,
  15464. // If we are going to the end, we want to run all the tweens
  15465. // otherwise we skip this part
  15466. length = gotoEnd ? animation.tweens.length : 0;
  15467. if ( stopped ) {
  15468. return this;
  15469. }
  15470. stopped = true;
  15471. for ( ; index < length; index++ ) {
  15472. animation.tweens[ index ].run( 1 );
  15473. }
  15474. // Resolve when we played the last frame; otherwise, reject
  15475. if ( gotoEnd ) {
  15476. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15477. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15478. } else {
  15479. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15480. }
  15481. return this;
  15482. }
  15483. } ),
  15484. props = animation.props;
  15485. propFilter( props, animation.opts.specialEasing );
  15486. for ( ; index < length; index++ ) {
  15487. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15488. if ( result ) {
  15489. if ( isFunction( result.stop ) ) {
  15490. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15491. result.stop.bind( result );
  15492. }
  15493. return result;
  15494. }
  15495. }
  15496. jQuery.map( props, createTween, animation );
  15497. if ( isFunction( animation.opts.start ) ) {
  15498. animation.opts.start.call( elem, animation );
  15499. }
  15500. // Attach callbacks from options
  15501. animation
  15502. .progress( animation.opts.progress )
  15503. .done( animation.opts.done, animation.opts.complete )
  15504. .fail( animation.opts.fail )
  15505. .always( animation.opts.always );
  15506. jQuery.fx.timer(
  15507. jQuery.extend( tick, {
  15508. elem: elem,
  15509. anim: animation,
  15510. queue: animation.opts.queue
  15511. } )
  15512. );
  15513. return animation;
  15514. }
  15515. jQuery.Animation = jQuery.extend( Animation, {
  15516. tweeners: {
  15517. "*": [ function( prop, value ) {
  15518. var tween = this.createTween( prop, value );
  15519. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15520. return tween;
  15521. } ]
  15522. },
  15523. tweener: function( props, callback ) {
  15524. if ( isFunction( props ) ) {
  15525. callback = props;
  15526. props = [ "*" ];
  15527. } else {
  15528. props = props.match( rnothtmlwhite );
  15529. }
  15530. var prop,
  15531. index = 0,
  15532. length = props.length;
  15533. for ( ; index < length; index++ ) {
  15534. prop = props[ index ];
  15535. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15536. Animation.tweeners[ prop ].unshift( callback );
  15537. }
  15538. },
  15539. prefilters: [ defaultPrefilter ],
  15540. prefilter: function( callback, prepend ) {
  15541. if ( prepend ) {
  15542. Animation.prefilters.unshift( callback );
  15543. } else {
  15544. Animation.prefilters.push( callback );
  15545. }
  15546. }
  15547. } );
  15548. jQuery.speed = function( speed, easing, fn ) {
  15549. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15550. complete: fn || !fn && easing ||
  15551. isFunction( speed ) && speed,
  15552. duration: speed,
  15553. easing: fn && easing || easing && !isFunction( easing ) && easing
  15554. };
  15555. // Go to the end state if fx are off
  15556. if ( jQuery.fx.off ) {
  15557. opt.duration = 0;
  15558. } else {
  15559. if ( typeof opt.duration !== "number" ) {
  15560. if ( opt.duration in jQuery.fx.speeds ) {
  15561. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15562. } else {
  15563. opt.duration = jQuery.fx.speeds._default;
  15564. }
  15565. }
  15566. }
  15567. // Normalize opt.queue - true/undefined/null -> "fx"
  15568. if ( opt.queue == null || opt.queue === true ) {
  15569. opt.queue = "fx";
  15570. }
  15571. // Queueing
  15572. opt.old = opt.complete;
  15573. opt.complete = function() {
  15574. if ( isFunction( opt.old ) ) {
  15575. opt.old.call( this );
  15576. }
  15577. if ( opt.queue ) {
  15578. jQuery.dequeue( this, opt.queue );
  15579. }
  15580. };
  15581. return opt;
  15582. };
  15583. jQuery.fn.extend( {
  15584. fadeTo: function( speed, to, easing, callback ) {
  15585. // Show any hidden elements after setting opacity to 0
  15586. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15587. // Animate to the value specified
  15588. .end().animate( { opacity: to }, speed, easing, callback );
  15589. },
  15590. animate: function( prop, speed, easing, callback ) {
  15591. var empty = jQuery.isEmptyObject( prop ),
  15592. optall = jQuery.speed( speed, easing, callback ),
  15593. doAnimation = function() {
  15594. // Operate on a copy of prop so per-property easing won't be lost
  15595. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15596. // Empty animations, or finishing resolves immediately
  15597. if ( empty || dataPriv.get( this, "finish" ) ) {
  15598. anim.stop( true );
  15599. }
  15600. };
  15601. doAnimation.finish = doAnimation;
  15602. return empty || optall.queue === false ?
  15603. this.each( doAnimation ) :
  15604. this.queue( optall.queue, doAnimation );
  15605. },
  15606. stop: function( type, clearQueue, gotoEnd ) {
  15607. var stopQueue = function( hooks ) {
  15608. var stop = hooks.stop;
  15609. delete hooks.stop;
  15610. stop( gotoEnd );
  15611. };
  15612. if ( typeof type !== "string" ) {
  15613. gotoEnd = clearQueue;
  15614. clearQueue = type;
  15615. type = undefined;
  15616. }
  15617. if ( clearQueue && type !== false ) {
  15618. this.queue( type || "fx", [] );
  15619. }
  15620. return this.each( function() {
  15621. var dequeue = true,
  15622. index = type != null && type + "queueHooks",
  15623. timers = jQuery.timers,
  15624. data = dataPriv.get( this );
  15625. if ( index ) {
  15626. if ( data[ index ] && data[ index ].stop ) {
  15627. stopQueue( data[ index ] );
  15628. }
  15629. } else {
  15630. for ( index in data ) {
  15631. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15632. stopQueue( data[ index ] );
  15633. }
  15634. }
  15635. }
  15636. for ( index = timers.length; index--; ) {
  15637. if ( timers[ index ].elem === this &&
  15638. ( type == null || timers[ index ].queue === type ) ) {
  15639. timers[ index ].anim.stop( gotoEnd );
  15640. dequeue = false;
  15641. timers.splice( index, 1 );
  15642. }
  15643. }
  15644. // Start the next in the queue if the last step wasn't forced.
  15645. // Timers currently will call their complete callbacks, which
  15646. // will dequeue but only if they were gotoEnd.
  15647. if ( dequeue || !gotoEnd ) {
  15648. jQuery.dequeue( this, type );
  15649. }
  15650. } );
  15651. },
  15652. finish: function( type ) {
  15653. if ( type !== false ) {
  15654. type = type || "fx";
  15655. }
  15656. return this.each( function() {
  15657. var index,
  15658. data = dataPriv.get( this ),
  15659. queue = data[ type + "queue" ],
  15660. hooks = data[ type + "queueHooks" ],
  15661. timers = jQuery.timers,
  15662. length = queue ? queue.length : 0;
  15663. // Enable finishing flag on private data
  15664. data.finish = true;
  15665. // Empty the queue first
  15666. jQuery.queue( this, type, [] );
  15667. if ( hooks && hooks.stop ) {
  15668. hooks.stop.call( this, true );
  15669. }
  15670. // Look for any active animations, and finish them
  15671. for ( index = timers.length; index--; ) {
  15672. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15673. timers[ index ].anim.stop( true );
  15674. timers.splice( index, 1 );
  15675. }
  15676. }
  15677. // Look for any animations in the old queue and finish them
  15678. for ( index = 0; index < length; index++ ) {
  15679. if ( queue[ index ] && queue[ index ].finish ) {
  15680. queue[ index ].finish.call( this );
  15681. }
  15682. }
  15683. // Turn off finishing flag
  15684. delete data.finish;
  15685. } );
  15686. }
  15687. } );
  15688. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15689. var cssFn = jQuery.fn[ name ];
  15690. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15691. return speed == null || typeof speed === "boolean" ?
  15692. cssFn.apply( this, arguments ) :
  15693. this.animate( genFx( name, true ), speed, easing, callback );
  15694. };
  15695. } );
  15696. // Generate shortcuts for custom animations
  15697. jQuery.each( {
  15698. slideDown: genFx( "show" ),
  15699. slideUp: genFx( "hide" ),
  15700. slideToggle: genFx( "toggle" ),
  15701. fadeIn: { opacity: "show" },
  15702. fadeOut: { opacity: "hide" },
  15703. fadeToggle: { opacity: "toggle" }
  15704. }, function( name, props ) {
  15705. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15706. return this.animate( props, speed, easing, callback );
  15707. };
  15708. } );
  15709. jQuery.timers = [];
  15710. jQuery.fx.tick = function() {
  15711. var timer,
  15712. i = 0,
  15713. timers = jQuery.timers;
  15714. fxNow = Date.now();
  15715. for ( ; i < timers.length; i++ ) {
  15716. timer = timers[ i ];
  15717. // Run the timer and safely remove it when done (allowing for external removal)
  15718. if ( !timer() && timers[ i ] === timer ) {
  15719. timers.splice( i--, 1 );
  15720. }
  15721. }
  15722. if ( !timers.length ) {
  15723. jQuery.fx.stop();
  15724. }
  15725. fxNow = undefined;
  15726. };
  15727. jQuery.fx.timer = function( timer ) {
  15728. jQuery.timers.push( timer );
  15729. jQuery.fx.start();
  15730. };
  15731. jQuery.fx.interval = 13;
  15732. jQuery.fx.start = function() {
  15733. if ( inProgress ) {
  15734. return;
  15735. }
  15736. inProgress = true;
  15737. schedule();
  15738. };
  15739. jQuery.fx.stop = function() {
  15740. inProgress = null;
  15741. };
  15742. jQuery.fx.speeds = {
  15743. slow: 600,
  15744. fast: 200,
  15745. // Default speed
  15746. _default: 400
  15747. };
  15748. // Based off of the plugin by Clint Helfers, with permission.
  15749. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15750. jQuery.fn.delay = function( time, type ) {
  15751. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15752. type = type || "fx";
  15753. return this.queue( type, function( next, hooks ) {
  15754. var timeout = window.setTimeout( next, time );
  15755. hooks.stop = function() {
  15756. window.clearTimeout( timeout );
  15757. };
  15758. } );
  15759. };
  15760. ( function() {
  15761. var input = document.createElement( "input" ),
  15762. select = document.createElement( "select" ),
  15763. opt = select.appendChild( document.createElement( "option" ) );
  15764. input.type = "checkbox";
  15765. // Support: Android <=4.3 only
  15766. // Default value for a checkbox should be "on"
  15767. support.checkOn = input.value !== "";
  15768. // Support: IE <=11 only
  15769. // Must access selectedIndex to make default options select
  15770. support.optSelected = opt.selected;
  15771. // Support: IE <=11 only
  15772. // An input loses its value after becoming a radio
  15773. input = document.createElement( "input" );
  15774. input.value = "t";
  15775. input.type = "radio";
  15776. support.radioValue = input.value === "t";
  15777. } )();
  15778. var boolHook,
  15779. attrHandle = jQuery.expr.attrHandle;
  15780. jQuery.fn.extend( {
  15781. attr: function( name, value ) {
  15782. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15783. },
  15784. removeAttr: function( name ) {
  15785. return this.each( function() {
  15786. jQuery.removeAttr( this, name );
  15787. } );
  15788. }
  15789. } );
  15790. jQuery.extend( {
  15791. attr: function( elem, name, value ) {
  15792. var ret, hooks,
  15793. nType = elem.nodeType;
  15794. // Don't get/set attributes on text, comment and attribute nodes
  15795. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15796. return;
  15797. }
  15798. // Fallback to prop when attributes are not supported
  15799. if ( typeof elem.getAttribute === "undefined" ) {
  15800. return jQuery.prop( elem, name, value );
  15801. }
  15802. // Attribute hooks are determined by the lowercase version
  15803. // Grab necessary hook if one is defined
  15804. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15805. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15806. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15807. }
  15808. if ( value !== undefined ) {
  15809. if ( value === null ) {
  15810. jQuery.removeAttr( elem, name );
  15811. return;
  15812. }
  15813. if ( hooks && "set" in hooks &&
  15814. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15815. return ret;
  15816. }
  15817. elem.setAttribute( name, value + "" );
  15818. return value;
  15819. }
  15820. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15821. return ret;
  15822. }
  15823. ret = jQuery.find.attr( elem, name );
  15824. // Non-existent attributes return null, we normalize to undefined
  15825. return ret == null ? undefined : ret;
  15826. },
  15827. attrHooks: {
  15828. type: {
  15829. set: function( elem, value ) {
  15830. if ( !support.radioValue && value === "radio" &&
  15831. nodeName( elem, "input" ) ) {
  15832. var val = elem.value;
  15833. elem.setAttribute( "type", value );
  15834. if ( val ) {
  15835. elem.value = val;
  15836. }
  15837. return value;
  15838. }
  15839. }
  15840. }
  15841. },
  15842. removeAttr: function( elem, value ) {
  15843. var name,
  15844. i = 0,
  15845. // Attribute names can contain non-HTML whitespace characters
  15846. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15847. attrNames = value && value.match( rnothtmlwhite );
  15848. if ( attrNames && elem.nodeType === 1 ) {
  15849. while ( ( name = attrNames[ i++ ] ) ) {
  15850. elem.removeAttribute( name );
  15851. }
  15852. }
  15853. }
  15854. } );
  15855. // Hooks for boolean attributes
  15856. boolHook = {
  15857. set: function( elem, value, name ) {
  15858. if ( value === false ) {
  15859. // Remove boolean attributes when set to false
  15860. jQuery.removeAttr( elem, name );
  15861. } else {
  15862. elem.setAttribute( name, name );
  15863. }
  15864. return name;
  15865. }
  15866. };
  15867. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15868. var getter = attrHandle[ name ] || jQuery.find.attr;
  15869. attrHandle[ name ] = function( elem, name, isXML ) {
  15870. var ret, handle,
  15871. lowercaseName = name.toLowerCase();
  15872. if ( !isXML ) {
  15873. // Avoid an infinite loop by temporarily removing this function from the getter
  15874. handle = attrHandle[ lowercaseName ];
  15875. attrHandle[ lowercaseName ] = ret;
  15876. ret = getter( elem, name, isXML ) != null ?
  15877. lowercaseName :
  15878. null;
  15879. attrHandle[ lowercaseName ] = handle;
  15880. }
  15881. return ret;
  15882. };
  15883. } );
  15884. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15885. rclickable = /^(?:a|area)$/i;
  15886. jQuery.fn.extend( {
  15887. prop: function( name, value ) {
  15888. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15889. },
  15890. removeProp: function( name ) {
  15891. return this.each( function() {
  15892. delete this[ jQuery.propFix[ name ] || name ];
  15893. } );
  15894. }
  15895. } );
  15896. jQuery.extend( {
  15897. prop: function( elem, name, value ) {
  15898. var ret, hooks,
  15899. nType = elem.nodeType;
  15900. // Don't get/set properties on text, comment and attribute nodes
  15901. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15902. return;
  15903. }
  15904. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15905. // Fix name and attach hooks
  15906. name = jQuery.propFix[ name ] || name;
  15907. hooks = jQuery.propHooks[ name ];
  15908. }
  15909. if ( value !== undefined ) {
  15910. if ( hooks && "set" in hooks &&
  15911. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15912. return ret;
  15913. }
  15914. return ( elem[ name ] = value );
  15915. }
  15916. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15917. return ret;
  15918. }
  15919. return elem[ name ];
  15920. },
  15921. propHooks: {
  15922. tabIndex: {
  15923. get: function( elem ) {
  15924. // Support: IE <=9 - 11 only
  15925. // elem.tabIndex doesn't always return the
  15926. // correct value when it hasn't been explicitly set
  15927. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15928. // Use proper attribute retrieval(#12072)
  15929. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15930. if ( tabindex ) {
  15931. return parseInt( tabindex, 10 );
  15932. }
  15933. if (
  15934. rfocusable.test( elem.nodeName ) ||
  15935. rclickable.test( elem.nodeName ) &&
  15936. elem.href
  15937. ) {
  15938. return 0;
  15939. }
  15940. return -1;
  15941. }
  15942. }
  15943. },
  15944. propFix: {
  15945. "for": "htmlFor",
  15946. "class": "className"
  15947. }
  15948. } );
  15949. // Support: IE <=11 only
  15950. // Accessing the selectedIndex property
  15951. // forces the browser to respect setting selected
  15952. // on the option
  15953. // The getter ensures a default option is selected
  15954. // when in an optgroup
  15955. // eslint rule "no-unused-expressions" is disabled for this code
  15956. // since it considers such accessions noop
  15957. if ( !support.optSelected ) {
  15958. jQuery.propHooks.selected = {
  15959. get: function( elem ) {
  15960. /* eslint no-unused-expressions: "off" */
  15961. var parent = elem.parentNode;
  15962. if ( parent && parent.parentNode ) {
  15963. parent.parentNode.selectedIndex;
  15964. }
  15965. return null;
  15966. },
  15967. set: function( elem ) {
  15968. /* eslint no-unused-expressions: "off" */
  15969. var parent = elem.parentNode;
  15970. if ( parent ) {
  15971. parent.selectedIndex;
  15972. if ( parent.parentNode ) {
  15973. parent.parentNode.selectedIndex;
  15974. }
  15975. }
  15976. }
  15977. };
  15978. }
  15979. jQuery.each( [
  15980. "tabIndex",
  15981. "readOnly",
  15982. "maxLength",
  15983. "cellSpacing",
  15984. "cellPadding",
  15985. "rowSpan",
  15986. "colSpan",
  15987. "useMap",
  15988. "frameBorder",
  15989. "contentEditable"
  15990. ], function() {
  15991. jQuery.propFix[ this.toLowerCase() ] = this;
  15992. } );
  15993. // Strip and collapse whitespace according to HTML spec
  15994. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15995. function stripAndCollapse( value ) {
  15996. var tokens = value.match( rnothtmlwhite ) || [];
  15997. return tokens.join( " " );
  15998. }
  15999. function getClass( elem ) {
  16000. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  16001. }
  16002. function classesToArray( value ) {
  16003. if ( Array.isArray( value ) ) {
  16004. return value;
  16005. }
  16006. if ( typeof value === "string" ) {
  16007. return value.match( rnothtmlwhite ) || [];
  16008. }
  16009. return [];
  16010. }
  16011. jQuery.fn.extend( {
  16012. addClass: function( value ) {
  16013. var classes, elem, cur, curValue, clazz, j, finalValue,
  16014. i = 0;
  16015. if ( isFunction( value ) ) {
  16016. return this.each( function( j ) {
  16017. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16018. } );
  16019. }
  16020. classes = classesToArray( value );
  16021. if ( classes.length ) {
  16022. while ( ( elem = this[ i++ ] ) ) {
  16023. curValue = getClass( elem );
  16024. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16025. if ( cur ) {
  16026. j = 0;
  16027. while ( ( clazz = classes[ j++ ] ) ) {
  16028. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16029. cur += clazz + " ";
  16030. }
  16031. }
  16032. // Only assign if different to avoid unneeded rendering.
  16033. finalValue = stripAndCollapse( cur );
  16034. if ( curValue !== finalValue ) {
  16035. elem.setAttribute( "class", finalValue );
  16036. }
  16037. }
  16038. }
  16039. }
  16040. return this;
  16041. },
  16042. removeClass: function( value ) {
  16043. var classes, elem, cur, curValue, clazz, j, finalValue,
  16044. i = 0;
  16045. if ( isFunction( value ) ) {
  16046. return this.each( function( j ) {
  16047. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16048. } );
  16049. }
  16050. if ( !arguments.length ) {
  16051. return this.attr( "class", "" );
  16052. }
  16053. classes = classesToArray( value );
  16054. if ( classes.length ) {
  16055. while ( ( elem = this[ i++ ] ) ) {
  16056. curValue = getClass( elem );
  16057. // This expression is here for better compressibility (see addClass)
  16058. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16059. if ( cur ) {
  16060. j = 0;
  16061. while ( ( clazz = classes[ j++ ] ) ) {
  16062. // Remove *all* instances
  16063. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16064. cur = cur.replace( " " + clazz + " ", " " );
  16065. }
  16066. }
  16067. // Only assign if different to avoid unneeded rendering.
  16068. finalValue = stripAndCollapse( cur );
  16069. if ( curValue !== finalValue ) {
  16070. elem.setAttribute( "class", finalValue );
  16071. }
  16072. }
  16073. }
  16074. }
  16075. return this;
  16076. },
  16077. toggleClass: function( value, stateVal ) {
  16078. var type = typeof value,
  16079. isValidValue = type === "string" || Array.isArray( value );
  16080. if ( typeof stateVal === "boolean" && isValidValue ) {
  16081. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16082. }
  16083. if ( isFunction( value ) ) {
  16084. return this.each( function( i ) {
  16085. jQuery( this ).toggleClass(
  16086. value.call( this, i, getClass( this ), stateVal ),
  16087. stateVal
  16088. );
  16089. } );
  16090. }
  16091. return this.each( function() {
  16092. var className, i, self, classNames;
  16093. if ( isValidValue ) {
  16094. // Toggle individual class names
  16095. i = 0;
  16096. self = jQuery( this );
  16097. classNames = classesToArray( value );
  16098. while ( ( className = classNames[ i++ ] ) ) {
  16099. // Check each className given, space separated list
  16100. if ( self.hasClass( className ) ) {
  16101. self.removeClass( className );
  16102. } else {
  16103. self.addClass( className );
  16104. }
  16105. }
  16106. // Toggle whole class name
  16107. } else if ( value === undefined || type === "boolean" ) {
  16108. className = getClass( this );
  16109. if ( className ) {
  16110. // Store className if set
  16111. dataPriv.set( this, "__className__", className );
  16112. }
  16113. // If the element has a class name or if we're passed `false`,
  16114. // then remove the whole classname (if there was one, the above saved it).
  16115. // Otherwise bring back whatever was previously saved (if anything),
  16116. // falling back to the empty string if nothing was stored.
  16117. if ( this.setAttribute ) {
  16118. this.setAttribute( "class",
  16119. className || value === false ?
  16120. "" :
  16121. dataPriv.get( this, "__className__" ) || ""
  16122. );
  16123. }
  16124. }
  16125. } );
  16126. },
  16127. hasClass: function( selector ) {
  16128. var className, elem,
  16129. i = 0;
  16130. className = " " + selector + " ";
  16131. while ( ( elem = this[ i++ ] ) ) {
  16132. if ( elem.nodeType === 1 &&
  16133. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16134. return true;
  16135. }
  16136. }
  16137. return false;
  16138. }
  16139. } );
  16140. var rreturn = /\r/g;
  16141. jQuery.fn.extend( {
  16142. val: function( value ) {
  16143. var hooks, ret, valueIsFunction,
  16144. elem = this[ 0 ];
  16145. if ( !arguments.length ) {
  16146. if ( elem ) {
  16147. hooks = jQuery.valHooks[ elem.type ] ||
  16148. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16149. if ( hooks &&
  16150. "get" in hooks &&
  16151. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16152. ) {
  16153. return ret;
  16154. }
  16155. ret = elem.value;
  16156. // Handle most common string cases
  16157. if ( typeof ret === "string" ) {
  16158. return ret.replace( rreturn, "" );
  16159. }
  16160. // Handle cases where value is null/undef or number
  16161. return ret == null ? "" : ret;
  16162. }
  16163. return;
  16164. }
  16165. valueIsFunction = isFunction( value );
  16166. return this.each( function( i ) {
  16167. var val;
  16168. if ( this.nodeType !== 1 ) {
  16169. return;
  16170. }
  16171. if ( valueIsFunction ) {
  16172. val = value.call( this, i, jQuery( this ).val() );
  16173. } else {
  16174. val = value;
  16175. }
  16176. // Treat null/undefined as ""; convert numbers to string
  16177. if ( val == null ) {
  16178. val = "";
  16179. } else if ( typeof val === "number" ) {
  16180. val += "";
  16181. } else if ( Array.isArray( val ) ) {
  16182. val = jQuery.map( val, function( value ) {
  16183. return value == null ? "" : value + "";
  16184. } );
  16185. }
  16186. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16187. // If set returns undefined, fall back to normal setting
  16188. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16189. this.value = val;
  16190. }
  16191. } );
  16192. }
  16193. } );
  16194. jQuery.extend( {
  16195. valHooks: {
  16196. option: {
  16197. get: function( elem ) {
  16198. var val = jQuery.find.attr( elem, "value" );
  16199. return val != null ?
  16200. val :
  16201. // Support: IE <=10 - 11 only
  16202. // option.text throws exceptions (#14686, #14858)
  16203. // Strip and collapse whitespace
  16204. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16205. stripAndCollapse( jQuery.text( elem ) );
  16206. }
  16207. },
  16208. select: {
  16209. get: function( elem ) {
  16210. var value, option, i,
  16211. options = elem.options,
  16212. index = elem.selectedIndex,
  16213. one = elem.type === "select-one",
  16214. values = one ? null : [],
  16215. max = one ? index + 1 : options.length;
  16216. if ( index < 0 ) {
  16217. i = max;
  16218. } else {
  16219. i = one ? index : 0;
  16220. }
  16221. // Loop through all the selected options
  16222. for ( ; i < max; i++ ) {
  16223. option = options[ i ];
  16224. // Support: IE <=9 only
  16225. // IE8-9 doesn't update selected after form reset (#2551)
  16226. if ( ( option.selected || i === index ) &&
  16227. // Don't return options that are disabled or in a disabled optgroup
  16228. !option.disabled &&
  16229. ( !option.parentNode.disabled ||
  16230. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16231. // Get the specific value for the option
  16232. value = jQuery( option ).val();
  16233. // We don't need an array for one selects
  16234. if ( one ) {
  16235. return value;
  16236. }
  16237. // Multi-Selects return an array
  16238. values.push( value );
  16239. }
  16240. }
  16241. return values;
  16242. },
  16243. set: function( elem, value ) {
  16244. var optionSet, option,
  16245. options = elem.options,
  16246. values = jQuery.makeArray( value ),
  16247. i = options.length;
  16248. while ( i-- ) {
  16249. option = options[ i ];
  16250. /* eslint-disable no-cond-assign */
  16251. if ( option.selected =
  16252. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16253. ) {
  16254. optionSet = true;
  16255. }
  16256. /* eslint-enable no-cond-assign */
  16257. }
  16258. // Force browsers to behave consistently when non-matching value is set
  16259. if ( !optionSet ) {
  16260. elem.selectedIndex = -1;
  16261. }
  16262. return values;
  16263. }
  16264. }
  16265. }
  16266. } );
  16267. // Radios and checkboxes getter/setter
  16268. jQuery.each( [ "radio", "checkbox" ], function() {
  16269. jQuery.valHooks[ this ] = {
  16270. set: function( elem, value ) {
  16271. if ( Array.isArray( value ) ) {
  16272. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16273. }
  16274. }
  16275. };
  16276. if ( !support.checkOn ) {
  16277. jQuery.valHooks[ this ].get = function( elem ) {
  16278. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16279. };
  16280. }
  16281. } );
  16282. // Return jQuery for attributes-only inclusion
  16283. support.focusin = "onfocusin" in window;
  16284. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16285. stopPropagationCallback = function( e ) {
  16286. e.stopPropagation();
  16287. };
  16288. jQuery.extend( jQuery.event, {
  16289. trigger: function( event, data, elem, onlyHandlers ) {
  16290. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16291. eventPath = [ elem || document ],
  16292. type = hasOwn.call( event, "type" ) ? event.type : event,
  16293. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16294. cur = lastElement = tmp = elem = elem || document;
  16295. // Don't do events on text and comment nodes
  16296. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16297. return;
  16298. }
  16299. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16300. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16301. return;
  16302. }
  16303. if ( type.indexOf( "." ) > -1 ) {
  16304. // Namespaced trigger; create a regexp to match event type in handle()
  16305. namespaces = type.split( "." );
  16306. type = namespaces.shift();
  16307. namespaces.sort();
  16308. }
  16309. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16310. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16311. event = event[ jQuery.expando ] ?
  16312. event :
  16313. new jQuery.Event( type, typeof event === "object" && event );
  16314. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16315. event.isTrigger = onlyHandlers ? 2 : 3;
  16316. event.namespace = namespaces.join( "." );
  16317. event.rnamespace = event.namespace ?
  16318. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16319. null;
  16320. // Clean up the event in case it is being reused
  16321. event.result = undefined;
  16322. if ( !event.target ) {
  16323. event.target = elem;
  16324. }
  16325. // Clone any incoming data and prepend the event, creating the handler arg list
  16326. data = data == null ?
  16327. [ event ] :
  16328. jQuery.makeArray( data, [ event ] );
  16329. // Allow special events to draw outside the lines
  16330. special = jQuery.event.special[ type ] || {};
  16331. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16332. return;
  16333. }
  16334. // Determine event propagation path in advance, per W3C events spec (#9951)
  16335. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16336. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16337. bubbleType = special.delegateType || type;
  16338. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16339. cur = cur.parentNode;
  16340. }
  16341. for ( ; cur; cur = cur.parentNode ) {
  16342. eventPath.push( cur );
  16343. tmp = cur;
  16344. }
  16345. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16346. if ( tmp === ( elem.ownerDocument || document ) ) {
  16347. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16348. }
  16349. }
  16350. // Fire handlers on the event path
  16351. i = 0;
  16352. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16353. lastElement = cur;
  16354. event.type = i > 1 ?
  16355. bubbleType :
  16356. special.bindType || type;
  16357. // jQuery handler
  16358. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16359. dataPriv.get( cur, "handle" );
  16360. if ( handle ) {
  16361. handle.apply( cur, data );
  16362. }
  16363. // Native handler
  16364. handle = ontype && cur[ ontype ];
  16365. if ( handle && handle.apply && acceptData( cur ) ) {
  16366. event.result = handle.apply( cur, data );
  16367. if ( event.result === false ) {
  16368. event.preventDefault();
  16369. }
  16370. }
  16371. }
  16372. event.type = type;
  16373. // If nobody prevented the default action, do it now
  16374. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16375. if ( ( !special._default ||
  16376. special._default.apply( eventPath.pop(), data ) === false ) &&
  16377. acceptData( elem ) ) {
  16378. // Call a native DOM method on the target with the same name as the event.
  16379. // Don't do default actions on window, that's where global variables be (#6170)
  16380. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16381. // Don't re-trigger an onFOO event when we call its FOO() method
  16382. tmp = elem[ ontype ];
  16383. if ( tmp ) {
  16384. elem[ ontype ] = null;
  16385. }
  16386. // Prevent re-triggering of the same event, since we already bubbled it above
  16387. jQuery.event.triggered = type;
  16388. if ( event.isPropagationStopped() ) {
  16389. lastElement.addEventListener( type, stopPropagationCallback );
  16390. }
  16391. elem[ type ]();
  16392. if ( event.isPropagationStopped() ) {
  16393. lastElement.removeEventListener( type, stopPropagationCallback );
  16394. }
  16395. jQuery.event.triggered = undefined;
  16396. if ( tmp ) {
  16397. elem[ ontype ] = tmp;
  16398. }
  16399. }
  16400. }
  16401. }
  16402. return event.result;
  16403. },
  16404. // Piggyback on a donor event to simulate a different one
  16405. // Used only for `focus(in | out)` events
  16406. simulate: function( type, elem, event ) {
  16407. var e = jQuery.extend(
  16408. new jQuery.Event(),
  16409. event,
  16410. {
  16411. type: type,
  16412. isSimulated: true
  16413. }
  16414. );
  16415. jQuery.event.trigger( e, null, elem );
  16416. }
  16417. } );
  16418. jQuery.fn.extend( {
  16419. trigger: function( type, data ) {
  16420. return this.each( function() {
  16421. jQuery.event.trigger( type, data, this );
  16422. } );
  16423. },
  16424. triggerHandler: function( type, data ) {
  16425. var elem = this[ 0 ];
  16426. if ( elem ) {
  16427. return jQuery.event.trigger( type, data, elem, true );
  16428. }
  16429. }
  16430. } );
  16431. // Support: Firefox <=44
  16432. // Firefox doesn't have focus(in | out) events
  16433. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16434. //
  16435. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16436. // focus(in | out) events fire after focus & blur events,
  16437. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16438. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16439. if ( !support.focusin ) {
  16440. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16441. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16442. var handler = function( event ) {
  16443. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16444. };
  16445. jQuery.event.special[ fix ] = {
  16446. setup: function() {
  16447. var doc = this.ownerDocument || this,
  16448. attaches = dataPriv.access( doc, fix );
  16449. if ( !attaches ) {
  16450. doc.addEventListener( orig, handler, true );
  16451. }
  16452. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16453. },
  16454. teardown: function() {
  16455. var doc = this.ownerDocument || this,
  16456. attaches = dataPriv.access( doc, fix ) - 1;
  16457. if ( !attaches ) {
  16458. doc.removeEventListener( orig, handler, true );
  16459. dataPriv.remove( doc, fix );
  16460. } else {
  16461. dataPriv.access( doc, fix, attaches );
  16462. }
  16463. }
  16464. };
  16465. } );
  16466. }
  16467. var location = window.location;
  16468. var nonce = Date.now();
  16469. var rquery = ( /\?/ );
  16470. // Cross-browser xml parsing
  16471. jQuery.parseXML = function( data ) {
  16472. var xml;
  16473. if ( !data || typeof data !== "string" ) {
  16474. return null;
  16475. }
  16476. // Support: IE 9 - 11 only
  16477. // IE throws on parseFromString with invalid input.
  16478. try {
  16479. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16480. } catch ( e ) {
  16481. xml = undefined;
  16482. }
  16483. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16484. jQuery.error( "Invalid XML: " + data );
  16485. }
  16486. return xml;
  16487. };
  16488. var
  16489. rbracket = /\[\]$/,
  16490. rCRLF = /\r?\n/g,
  16491. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16492. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16493. function buildParams( prefix, obj, traditional, add ) {
  16494. var name;
  16495. if ( Array.isArray( obj ) ) {
  16496. // Serialize array item.
  16497. jQuery.each( obj, function( i, v ) {
  16498. if ( traditional || rbracket.test( prefix ) ) {
  16499. // Treat each array item as a scalar.
  16500. add( prefix, v );
  16501. } else {
  16502. // Item is non-scalar (array or object), encode its numeric index.
  16503. buildParams(
  16504. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16505. v,
  16506. traditional,
  16507. add
  16508. );
  16509. }
  16510. } );
  16511. } else if ( !traditional && toType( obj ) === "object" ) {
  16512. // Serialize object item.
  16513. for ( name in obj ) {
  16514. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16515. }
  16516. } else {
  16517. // Serialize scalar item.
  16518. add( prefix, obj );
  16519. }
  16520. }
  16521. // Serialize an array of form elements or a set of
  16522. // key/values into a query string
  16523. jQuery.param = function( a, traditional ) {
  16524. var prefix,
  16525. s = [],
  16526. add = function( key, valueOrFunction ) {
  16527. // If value is a function, invoke it and use its return value
  16528. var value = isFunction( valueOrFunction ) ?
  16529. valueOrFunction() :
  16530. valueOrFunction;
  16531. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16532. encodeURIComponent( value == null ? "" : value );
  16533. };
  16534. if ( a == null ) {
  16535. return "";
  16536. }
  16537. // If an array was passed in, assume that it is an array of form elements.
  16538. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16539. // Serialize the form elements
  16540. jQuery.each( a, function() {
  16541. add( this.name, this.value );
  16542. } );
  16543. } else {
  16544. // If traditional, encode the "old" way (the way 1.3.2 or older
  16545. // did it), otherwise encode params recursively.
  16546. for ( prefix in a ) {
  16547. buildParams( prefix, a[ prefix ], traditional, add );
  16548. }
  16549. }
  16550. // Return the resulting serialization
  16551. return s.join( "&" );
  16552. };
  16553. jQuery.fn.extend( {
  16554. serialize: function() {
  16555. return jQuery.param( this.serializeArray() );
  16556. },
  16557. serializeArray: function() {
  16558. return this.map( function() {
  16559. // Can add propHook for "elements" to filter or add form elements
  16560. var elements = jQuery.prop( this, "elements" );
  16561. return elements ? jQuery.makeArray( elements ) : this;
  16562. } )
  16563. .filter( function() {
  16564. var type = this.type;
  16565. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16566. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16567. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16568. ( this.checked || !rcheckableType.test( type ) );
  16569. } )
  16570. .map( function( i, elem ) {
  16571. var val = jQuery( this ).val();
  16572. if ( val == null ) {
  16573. return null;
  16574. }
  16575. if ( Array.isArray( val ) ) {
  16576. return jQuery.map( val, function( val ) {
  16577. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16578. } );
  16579. }
  16580. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16581. } ).get();
  16582. }
  16583. } );
  16584. var
  16585. r20 = /%20/g,
  16586. rhash = /#.*$/,
  16587. rantiCache = /([?&])_=[^&]*/,
  16588. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16589. // #7653, #8125, #8152: local protocol detection
  16590. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16591. rnoContent = /^(?:GET|HEAD)$/,
  16592. rprotocol = /^\/\//,
  16593. /* Prefilters
  16594. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16595. * 2) These are called:
  16596. * - BEFORE asking for a transport
  16597. * - AFTER param serialization (s.data is a string if s.processData is true)
  16598. * 3) key is the dataType
  16599. * 4) the catchall symbol "*" can be used
  16600. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16601. */
  16602. prefilters = {},
  16603. /* Transports bindings
  16604. * 1) key is the dataType
  16605. * 2) the catchall symbol "*" can be used
  16606. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16607. */
  16608. transports = {},
  16609. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16610. allTypes = "*/".concat( "*" ),
  16611. // Anchor tag for parsing the document origin
  16612. originAnchor = document.createElement( "a" );
  16613. originAnchor.href = location.href;
  16614. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16615. function addToPrefiltersOrTransports( structure ) {
  16616. // dataTypeExpression is optional and defaults to "*"
  16617. return function( dataTypeExpression, func ) {
  16618. if ( typeof dataTypeExpression !== "string" ) {
  16619. func = dataTypeExpression;
  16620. dataTypeExpression = "*";
  16621. }
  16622. var dataType,
  16623. i = 0,
  16624. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16625. if ( isFunction( func ) ) {
  16626. // For each dataType in the dataTypeExpression
  16627. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16628. // Prepend if requested
  16629. if ( dataType[ 0 ] === "+" ) {
  16630. dataType = dataType.slice( 1 ) || "*";
  16631. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16632. // Otherwise append
  16633. } else {
  16634. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16635. }
  16636. }
  16637. }
  16638. };
  16639. }
  16640. // Base inspection function for prefilters and transports
  16641. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16642. var inspected = {},
  16643. seekingTransport = ( structure === transports );
  16644. function inspect( dataType ) {
  16645. var selected;
  16646. inspected[ dataType ] = true;
  16647. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16648. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16649. if ( typeof dataTypeOrTransport === "string" &&
  16650. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16651. options.dataTypes.unshift( dataTypeOrTransport );
  16652. inspect( dataTypeOrTransport );
  16653. return false;
  16654. } else if ( seekingTransport ) {
  16655. return !( selected = dataTypeOrTransport );
  16656. }
  16657. } );
  16658. return selected;
  16659. }
  16660. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16661. }
  16662. // A special extend for ajax options
  16663. // that takes "flat" options (not to be deep extended)
  16664. // Fixes #9887
  16665. function ajaxExtend( target, src ) {
  16666. var key, deep,
  16667. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16668. for ( key in src ) {
  16669. if ( src[ key ] !== undefined ) {
  16670. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16671. }
  16672. }
  16673. if ( deep ) {
  16674. jQuery.extend( true, target, deep );
  16675. }
  16676. return target;
  16677. }
  16678. /* Handles responses to an ajax request:
  16679. * - finds the right dataType (mediates between content-type and expected dataType)
  16680. * - returns the corresponding response
  16681. */
  16682. function ajaxHandleResponses( s, jqXHR, responses ) {
  16683. var ct, type, finalDataType, firstDataType,
  16684. contents = s.contents,
  16685. dataTypes = s.dataTypes;
  16686. // Remove auto dataType and get content-type in the process
  16687. while ( dataTypes[ 0 ] === "*" ) {
  16688. dataTypes.shift();
  16689. if ( ct === undefined ) {
  16690. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16691. }
  16692. }
  16693. // Check if we're dealing with a known content-type
  16694. if ( ct ) {
  16695. for ( type in contents ) {
  16696. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16697. dataTypes.unshift( type );
  16698. break;
  16699. }
  16700. }
  16701. }
  16702. // Check to see if we have a response for the expected dataType
  16703. if ( dataTypes[ 0 ] in responses ) {
  16704. finalDataType = dataTypes[ 0 ];
  16705. } else {
  16706. // Try convertible dataTypes
  16707. for ( type in responses ) {
  16708. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16709. finalDataType = type;
  16710. break;
  16711. }
  16712. if ( !firstDataType ) {
  16713. firstDataType = type;
  16714. }
  16715. }
  16716. // Or just use first one
  16717. finalDataType = finalDataType || firstDataType;
  16718. }
  16719. // If we found a dataType
  16720. // We add the dataType to the list if needed
  16721. // and return the corresponding response
  16722. if ( finalDataType ) {
  16723. if ( finalDataType !== dataTypes[ 0 ] ) {
  16724. dataTypes.unshift( finalDataType );
  16725. }
  16726. return responses[ finalDataType ];
  16727. }
  16728. }
  16729. /* Chain conversions given the request and the original response
  16730. * Also sets the responseXXX fields on the jqXHR instance
  16731. */
  16732. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16733. var conv2, current, conv, tmp, prev,
  16734. converters = {},
  16735. // Work with a copy of dataTypes in case we need to modify it for conversion
  16736. dataTypes = s.dataTypes.slice();
  16737. // Create converters map with lowercased keys
  16738. if ( dataTypes[ 1 ] ) {
  16739. for ( conv in s.converters ) {
  16740. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16741. }
  16742. }
  16743. current = dataTypes.shift();
  16744. // Convert to each sequential dataType
  16745. while ( current ) {
  16746. if ( s.responseFields[ current ] ) {
  16747. jqXHR[ s.responseFields[ current ] ] = response;
  16748. }
  16749. // Apply the dataFilter if provided
  16750. if ( !prev && isSuccess && s.dataFilter ) {
  16751. response = s.dataFilter( response, s.dataType );
  16752. }
  16753. prev = current;
  16754. current = dataTypes.shift();
  16755. if ( current ) {
  16756. // There's only work to do if current dataType is non-auto
  16757. if ( current === "*" ) {
  16758. current = prev;
  16759. // Convert response if prev dataType is non-auto and differs from current
  16760. } else if ( prev !== "*" && prev !== current ) {
  16761. // Seek a direct converter
  16762. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16763. // If none found, seek a pair
  16764. if ( !conv ) {
  16765. for ( conv2 in converters ) {
  16766. // If conv2 outputs current
  16767. tmp = conv2.split( " " );
  16768. if ( tmp[ 1 ] === current ) {
  16769. // If prev can be converted to accepted input
  16770. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16771. converters[ "* " + tmp[ 0 ] ];
  16772. if ( conv ) {
  16773. // Condense equivalence converters
  16774. if ( conv === true ) {
  16775. conv = converters[ conv2 ];
  16776. // Otherwise, insert the intermediate dataType
  16777. } else if ( converters[ conv2 ] !== true ) {
  16778. current = tmp[ 0 ];
  16779. dataTypes.unshift( tmp[ 1 ] );
  16780. }
  16781. break;
  16782. }
  16783. }
  16784. }
  16785. }
  16786. // Apply converter (if not an equivalence)
  16787. if ( conv !== true ) {
  16788. // Unless errors are allowed to bubble, catch and return them
  16789. if ( conv && s.throws ) {
  16790. response = conv( response );
  16791. } else {
  16792. try {
  16793. response = conv( response );
  16794. } catch ( e ) {
  16795. return {
  16796. state: "parsererror",
  16797. error: conv ? e : "No conversion from " + prev + " to " + current
  16798. };
  16799. }
  16800. }
  16801. }
  16802. }
  16803. }
  16804. }
  16805. return { state: "success", data: response };
  16806. }
  16807. jQuery.extend( {
  16808. // Counter for holding the number of active queries
  16809. active: 0,
  16810. // Last-Modified header cache for next request
  16811. lastModified: {},
  16812. etag: {},
  16813. ajaxSettings: {
  16814. url: location.href,
  16815. type: "GET",
  16816. isLocal: rlocalProtocol.test( location.protocol ),
  16817. global: true,
  16818. processData: true,
  16819. async: true,
  16820. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16821. /*
  16822. timeout: 0,
  16823. data: null,
  16824. dataType: null,
  16825. username: null,
  16826. password: null,
  16827. cache: null,
  16828. throws: false,
  16829. traditional: false,
  16830. headers: {},
  16831. */
  16832. accepts: {
  16833. "*": allTypes,
  16834. text: "text/plain",
  16835. html: "text/html",
  16836. xml: "application/xml, text/xml",
  16837. json: "application/json, text/javascript"
  16838. },
  16839. contents: {
  16840. xml: /\bxml\b/,
  16841. html: /\bhtml/,
  16842. json: /\bjson\b/
  16843. },
  16844. responseFields: {
  16845. xml: "responseXML",
  16846. text: "responseText",
  16847. json: "responseJSON"
  16848. },
  16849. // Data converters
  16850. // Keys separate source (or catchall "*") and destination types with a single space
  16851. converters: {
  16852. // Convert anything to text
  16853. "* text": String,
  16854. // Text to html (true = no transformation)
  16855. "text html": true,
  16856. // Evaluate text as a json expression
  16857. "text json": JSON.parse,
  16858. // Parse text as xml
  16859. "text xml": jQuery.parseXML
  16860. },
  16861. // For options that shouldn't be deep extended:
  16862. // you can add your own custom options here if
  16863. // and when you create one that shouldn't be
  16864. // deep extended (see ajaxExtend)
  16865. flatOptions: {
  16866. url: true,
  16867. context: true
  16868. }
  16869. },
  16870. // Creates a full fledged settings object into target
  16871. // with both ajaxSettings and settings fields.
  16872. // If target is omitted, writes into ajaxSettings.
  16873. ajaxSetup: function( target, settings ) {
  16874. return settings ?
  16875. // Building a settings object
  16876. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16877. // Extending ajaxSettings
  16878. ajaxExtend( jQuery.ajaxSettings, target );
  16879. },
  16880. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16881. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16882. // Main method
  16883. ajax: function( url, options ) {
  16884. // If url is an object, simulate pre-1.5 signature
  16885. if ( typeof url === "object" ) {
  16886. options = url;
  16887. url = undefined;
  16888. }
  16889. // Force options to be an object
  16890. options = options || {};
  16891. var transport,
  16892. // URL without anti-cache param
  16893. cacheURL,
  16894. // Response headers
  16895. responseHeadersString,
  16896. responseHeaders,
  16897. // timeout handle
  16898. timeoutTimer,
  16899. // Url cleanup var
  16900. urlAnchor,
  16901. // Request state (becomes false upon send and true upon completion)
  16902. completed,
  16903. // To know if global events are to be dispatched
  16904. fireGlobals,
  16905. // Loop variable
  16906. i,
  16907. // uncached part of the url
  16908. uncached,
  16909. // Create the final options object
  16910. s = jQuery.ajaxSetup( {}, options ),
  16911. // Callbacks context
  16912. callbackContext = s.context || s,
  16913. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16914. globalEventContext = s.context &&
  16915. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16916. jQuery( callbackContext ) :
  16917. jQuery.event,
  16918. // Deferreds
  16919. deferred = jQuery.Deferred(),
  16920. completeDeferred = jQuery.Callbacks( "once memory" ),
  16921. // Status-dependent callbacks
  16922. statusCode = s.statusCode || {},
  16923. // Headers (they are sent all at once)
  16924. requestHeaders = {},
  16925. requestHeadersNames = {},
  16926. // Default abort message
  16927. strAbort = "canceled",
  16928. // Fake xhr
  16929. jqXHR = {
  16930. readyState: 0,
  16931. // Builds headers hashtable if needed
  16932. getResponseHeader: function( key ) {
  16933. var match;
  16934. if ( completed ) {
  16935. if ( !responseHeaders ) {
  16936. responseHeaders = {};
  16937. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16938. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16939. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16940. .concat( match[ 2 ] );
  16941. }
  16942. }
  16943. match = responseHeaders[ key.toLowerCase() + " " ];
  16944. }
  16945. return match == null ? null : match.join( ", " );
  16946. },
  16947. // Raw string
  16948. getAllResponseHeaders: function() {
  16949. return completed ? responseHeadersString : null;
  16950. },
  16951. // Caches the header
  16952. setRequestHeader: function( name, value ) {
  16953. if ( completed == null ) {
  16954. name = requestHeadersNames[ name.toLowerCase() ] =
  16955. requestHeadersNames[ name.toLowerCase() ] || name;
  16956. requestHeaders[ name ] = value;
  16957. }
  16958. return this;
  16959. },
  16960. // Overrides response content-type header
  16961. overrideMimeType: function( type ) {
  16962. if ( completed == null ) {
  16963. s.mimeType = type;
  16964. }
  16965. return this;
  16966. },
  16967. // Status-dependent callbacks
  16968. statusCode: function( map ) {
  16969. var code;
  16970. if ( map ) {
  16971. if ( completed ) {
  16972. // Execute the appropriate callbacks
  16973. jqXHR.always( map[ jqXHR.status ] );
  16974. } else {
  16975. // Lazy-add the new callbacks in a way that preserves old ones
  16976. for ( code in map ) {
  16977. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16978. }
  16979. }
  16980. }
  16981. return this;
  16982. },
  16983. // Cancel the request
  16984. abort: function( statusText ) {
  16985. var finalText = statusText || strAbort;
  16986. if ( transport ) {
  16987. transport.abort( finalText );
  16988. }
  16989. done( 0, finalText );
  16990. return this;
  16991. }
  16992. };
  16993. // Attach deferreds
  16994. deferred.promise( jqXHR );
  16995. // Add protocol if not provided (prefilters might expect it)
  16996. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16997. // We also use the url parameter if available
  16998. s.url = ( ( url || s.url || location.href ) + "" )
  16999. .replace( rprotocol, location.protocol + "//" );
  17000. // Alias method option to type as per ticket #12004
  17001. s.type = options.method || options.type || s.method || s.type;
  17002. // Extract dataTypes list
  17003. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  17004. // A cross-domain request is in order when the origin doesn't match the current origin.
  17005. if ( s.crossDomain == null ) {
  17006. urlAnchor = document.createElement( "a" );
  17007. // Support: IE <=8 - 11, Edge 12 - 15
  17008. // IE throws exception on accessing the href property if url is malformed,
  17009. // e.g. http://example.com:80x/
  17010. try {
  17011. urlAnchor.href = s.url;
  17012. // Support: IE <=8 - 11 only
  17013. // Anchor's host property isn't correctly set when s.url is relative
  17014. urlAnchor.href = urlAnchor.href;
  17015. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17016. urlAnchor.protocol + "//" + urlAnchor.host;
  17017. } catch ( e ) {
  17018. // If there is an error parsing the URL, assume it is crossDomain,
  17019. // it can be rejected by the transport if it is invalid
  17020. s.crossDomain = true;
  17021. }
  17022. }
  17023. // Convert data if not already a string
  17024. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17025. s.data = jQuery.param( s.data, s.traditional );
  17026. }
  17027. // Apply prefilters
  17028. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17029. // If request was aborted inside a prefilter, stop there
  17030. if ( completed ) {
  17031. return jqXHR;
  17032. }
  17033. // We can fire global events as of now if asked to
  17034. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17035. fireGlobals = jQuery.event && s.global;
  17036. // Watch for a new set of requests
  17037. if ( fireGlobals && jQuery.active++ === 0 ) {
  17038. jQuery.event.trigger( "ajaxStart" );
  17039. }
  17040. // Uppercase the type
  17041. s.type = s.type.toUpperCase();
  17042. // Determine if request has content
  17043. s.hasContent = !rnoContent.test( s.type );
  17044. // Save the URL in case we're toying with the If-Modified-Since
  17045. // and/or If-None-Match header later on
  17046. // Remove hash to simplify url manipulation
  17047. cacheURL = s.url.replace( rhash, "" );
  17048. // More options handling for requests with no content
  17049. if ( !s.hasContent ) {
  17050. // Remember the hash so we can put it back
  17051. uncached = s.url.slice( cacheURL.length );
  17052. // If data is available and should be processed, append data to url
  17053. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17054. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17055. // #9682: remove data so that it's not used in an eventual retry
  17056. delete s.data;
  17057. }
  17058. // Add or update anti-cache param if needed
  17059. if ( s.cache === false ) {
  17060. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17061. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17062. }
  17063. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17064. s.url = cacheURL + uncached;
  17065. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17066. } else if ( s.data && s.processData &&
  17067. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17068. s.data = s.data.replace( r20, "+" );
  17069. }
  17070. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17071. if ( s.ifModified ) {
  17072. if ( jQuery.lastModified[ cacheURL ] ) {
  17073. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17074. }
  17075. if ( jQuery.etag[ cacheURL ] ) {
  17076. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17077. }
  17078. }
  17079. // Set the correct header, if data is being sent
  17080. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17081. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17082. }
  17083. // Set the Accepts header for the server, depending on the dataType
  17084. jqXHR.setRequestHeader(
  17085. "Accept",
  17086. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17087. s.accepts[ s.dataTypes[ 0 ] ] +
  17088. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17089. s.accepts[ "*" ]
  17090. );
  17091. // Check for headers option
  17092. for ( i in s.headers ) {
  17093. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17094. }
  17095. // Allow custom headers/mimetypes and early abort
  17096. if ( s.beforeSend &&
  17097. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17098. // Abort if not done already and return
  17099. return jqXHR.abort();
  17100. }
  17101. // Aborting is no longer a cancellation
  17102. strAbort = "abort";
  17103. // Install callbacks on deferreds
  17104. completeDeferred.add( s.complete );
  17105. jqXHR.done( s.success );
  17106. jqXHR.fail( s.error );
  17107. // Get transport
  17108. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17109. // If no transport, we auto-abort
  17110. if ( !transport ) {
  17111. done( -1, "No Transport" );
  17112. } else {
  17113. jqXHR.readyState = 1;
  17114. // Send global event
  17115. if ( fireGlobals ) {
  17116. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17117. }
  17118. // If request was aborted inside ajaxSend, stop there
  17119. if ( completed ) {
  17120. return jqXHR;
  17121. }
  17122. // Timeout
  17123. if ( s.async && s.timeout > 0 ) {
  17124. timeoutTimer = window.setTimeout( function() {
  17125. jqXHR.abort( "timeout" );
  17126. }, s.timeout );
  17127. }
  17128. try {
  17129. completed = false;
  17130. transport.send( requestHeaders, done );
  17131. } catch ( e ) {
  17132. // Rethrow post-completion exceptions
  17133. if ( completed ) {
  17134. throw e;
  17135. }
  17136. // Propagate others as results
  17137. done( -1, e );
  17138. }
  17139. }
  17140. // Callback for when everything is done
  17141. function done( status, nativeStatusText, responses, headers ) {
  17142. var isSuccess, success, error, response, modified,
  17143. statusText = nativeStatusText;
  17144. // Ignore repeat invocations
  17145. if ( completed ) {
  17146. return;
  17147. }
  17148. completed = true;
  17149. // Clear timeout if it exists
  17150. if ( timeoutTimer ) {
  17151. window.clearTimeout( timeoutTimer );
  17152. }
  17153. // Dereference transport for early garbage collection
  17154. // (no matter how long the jqXHR object will be used)
  17155. transport = undefined;
  17156. // Cache response headers
  17157. responseHeadersString = headers || "";
  17158. // Set readyState
  17159. jqXHR.readyState = status > 0 ? 4 : 0;
  17160. // Determine if successful
  17161. isSuccess = status >= 200 && status < 300 || status === 304;
  17162. // Get response data
  17163. if ( responses ) {
  17164. response = ajaxHandleResponses( s, jqXHR, responses );
  17165. }
  17166. // Convert no matter what (that way responseXXX fields are always set)
  17167. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17168. // If successful, handle type chaining
  17169. if ( isSuccess ) {
  17170. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17171. if ( s.ifModified ) {
  17172. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17173. if ( modified ) {
  17174. jQuery.lastModified[ cacheURL ] = modified;
  17175. }
  17176. modified = jqXHR.getResponseHeader( "etag" );
  17177. if ( modified ) {
  17178. jQuery.etag[ cacheURL ] = modified;
  17179. }
  17180. }
  17181. // if no content
  17182. if ( status === 204 || s.type === "HEAD" ) {
  17183. statusText = "nocontent";
  17184. // if not modified
  17185. } else if ( status === 304 ) {
  17186. statusText = "notmodified";
  17187. // If we have data, let's convert it
  17188. } else {
  17189. statusText = response.state;
  17190. success = response.data;
  17191. error = response.error;
  17192. isSuccess = !error;
  17193. }
  17194. } else {
  17195. // Extract error from statusText and normalize for non-aborts
  17196. error = statusText;
  17197. if ( status || !statusText ) {
  17198. statusText = "error";
  17199. if ( status < 0 ) {
  17200. status = 0;
  17201. }
  17202. }
  17203. }
  17204. // Set data for the fake xhr object
  17205. jqXHR.status = status;
  17206. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17207. // Success/Error
  17208. if ( isSuccess ) {
  17209. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17210. } else {
  17211. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17212. }
  17213. // Status-dependent callbacks
  17214. jqXHR.statusCode( statusCode );
  17215. statusCode = undefined;
  17216. if ( fireGlobals ) {
  17217. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17218. [ jqXHR, s, isSuccess ? success : error ] );
  17219. }
  17220. // Complete
  17221. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17222. if ( fireGlobals ) {
  17223. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17224. // Handle the global AJAX counter
  17225. if ( !( --jQuery.active ) ) {
  17226. jQuery.event.trigger( "ajaxStop" );
  17227. }
  17228. }
  17229. }
  17230. return jqXHR;
  17231. },
  17232. getJSON: function( url, data, callback ) {
  17233. return jQuery.get( url, data, callback, "json" );
  17234. },
  17235. getScript: function( url, callback ) {
  17236. return jQuery.get( url, undefined, callback, "script" );
  17237. }
  17238. } );
  17239. jQuery.each( [ "get", "post" ], function( i, method ) {
  17240. jQuery[ method ] = function( url, data, callback, type ) {
  17241. // Shift arguments if data argument was omitted
  17242. if ( isFunction( data ) ) {
  17243. type = type || callback;
  17244. callback = data;
  17245. data = undefined;
  17246. }
  17247. // The url can be an options object (which then must have .url)
  17248. return jQuery.ajax( jQuery.extend( {
  17249. url: url,
  17250. type: method,
  17251. dataType: type,
  17252. data: data,
  17253. success: callback
  17254. }, jQuery.isPlainObject( url ) && url ) );
  17255. };
  17256. } );
  17257. jQuery._evalUrl = function( url, options ) {
  17258. return jQuery.ajax( {
  17259. url: url,
  17260. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17261. type: "GET",
  17262. dataType: "script",
  17263. cache: true,
  17264. async: false,
  17265. global: false,
  17266. // Only evaluate the response if it is successful (gh-4126)
  17267. // dataFilter is not invoked for failure responses, so using it instead
  17268. // of the default converter is kludgy but it works.
  17269. converters: {
  17270. "text script": function() {}
  17271. },
  17272. dataFilter: function( response ) {
  17273. jQuery.globalEval( response, options );
  17274. }
  17275. } );
  17276. };
  17277. jQuery.fn.extend( {
  17278. wrapAll: function( html ) {
  17279. var wrap;
  17280. if ( this[ 0 ] ) {
  17281. if ( isFunction( html ) ) {
  17282. html = html.call( this[ 0 ] );
  17283. }
  17284. // The elements to wrap the target around
  17285. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17286. if ( this[ 0 ].parentNode ) {
  17287. wrap.insertBefore( this[ 0 ] );
  17288. }
  17289. wrap.map( function() {
  17290. var elem = this;
  17291. while ( elem.firstElementChild ) {
  17292. elem = elem.firstElementChild;
  17293. }
  17294. return elem;
  17295. } ).append( this );
  17296. }
  17297. return this;
  17298. },
  17299. wrapInner: function( html ) {
  17300. if ( isFunction( html ) ) {
  17301. return this.each( function( i ) {
  17302. jQuery( this ).wrapInner( html.call( this, i ) );
  17303. } );
  17304. }
  17305. return this.each( function() {
  17306. var self = jQuery( this ),
  17307. contents = self.contents();
  17308. if ( contents.length ) {
  17309. contents.wrapAll( html );
  17310. } else {
  17311. self.append( html );
  17312. }
  17313. } );
  17314. },
  17315. wrap: function( html ) {
  17316. var htmlIsFunction = isFunction( html );
  17317. return this.each( function( i ) {
  17318. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17319. } );
  17320. },
  17321. unwrap: function( selector ) {
  17322. this.parent( selector ).not( "body" ).each( function() {
  17323. jQuery( this ).replaceWith( this.childNodes );
  17324. } );
  17325. return this;
  17326. }
  17327. } );
  17328. jQuery.expr.pseudos.hidden = function( elem ) {
  17329. return !jQuery.expr.pseudos.visible( elem );
  17330. };
  17331. jQuery.expr.pseudos.visible = function( elem ) {
  17332. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17333. };
  17334. jQuery.ajaxSettings.xhr = function() {
  17335. try {
  17336. return new window.XMLHttpRequest();
  17337. } catch ( e ) {}
  17338. };
  17339. var xhrSuccessStatus = {
  17340. // File protocol always yields status code 0, assume 200
  17341. 0: 200,
  17342. // Support: IE <=9 only
  17343. // #1450: sometimes IE returns 1223 when it should be 204
  17344. 1223: 204
  17345. },
  17346. xhrSupported = jQuery.ajaxSettings.xhr();
  17347. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17348. support.ajax = xhrSupported = !!xhrSupported;
  17349. jQuery.ajaxTransport( function( options ) {
  17350. var callback, errorCallback;
  17351. // Cross domain only allowed if supported through XMLHttpRequest
  17352. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17353. return {
  17354. send: function( headers, complete ) {
  17355. var i,
  17356. xhr = options.xhr();
  17357. xhr.open(
  17358. options.type,
  17359. options.url,
  17360. options.async,
  17361. options.username,
  17362. options.password
  17363. );
  17364. // Apply custom fields if provided
  17365. if ( options.xhrFields ) {
  17366. for ( i in options.xhrFields ) {
  17367. xhr[ i ] = options.xhrFields[ i ];
  17368. }
  17369. }
  17370. // Override mime type if needed
  17371. if ( options.mimeType && xhr.overrideMimeType ) {
  17372. xhr.overrideMimeType( options.mimeType );
  17373. }
  17374. // X-Requested-With header
  17375. // For cross-domain requests, seeing as conditions for a preflight are
  17376. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17377. // (it can always be set on a per-request basis or even using ajaxSetup)
  17378. // For same-domain requests, won't change header if already provided.
  17379. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17380. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17381. }
  17382. // Set headers
  17383. for ( i in headers ) {
  17384. xhr.setRequestHeader( i, headers[ i ] );
  17385. }
  17386. // Callback
  17387. callback = function( type ) {
  17388. return function() {
  17389. if ( callback ) {
  17390. callback = errorCallback = xhr.onload =
  17391. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17392. xhr.onreadystatechange = null;
  17393. if ( type === "abort" ) {
  17394. xhr.abort();
  17395. } else if ( type === "error" ) {
  17396. // Support: IE <=9 only
  17397. // On a manual native abort, IE9 throws
  17398. // errors on any property access that is not readyState
  17399. if ( typeof xhr.status !== "number" ) {
  17400. complete( 0, "error" );
  17401. } else {
  17402. complete(
  17403. // File: protocol always yields status 0; see #8605, #14207
  17404. xhr.status,
  17405. xhr.statusText
  17406. );
  17407. }
  17408. } else {
  17409. complete(
  17410. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17411. xhr.statusText,
  17412. // Support: IE <=9 only
  17413. // IE9 has no XHR2 but throws on binary (trac-11426)
  17414. // For XHR2 non-text, let the caller handle it (gh-2498)
  17415. ( xhr.responseType || "text" ) !== "text" ||
  17416. typeof xhr.responseText !== "string" ?
  17417. { binary: xhr.response } :
  17418. { text: xhr.responseText },
  17419. xhr.getAllResponseHeaders()
  17420. );
  17421. }
  17422. }
  17423. };
  17424. };
  17425. // Listen to events
  17426. xhr.onload = callback();
  17427. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17428. // Support: IE 9 only
  17429. // Use onreadystatechange to replace onabort
  17430. // to handle uncaught aborts
  17431. if ( xhr.onabort !== undefined ) {
  17432. xhr.onabort = errorCallback;
  17433. } else {
  17434. xhr.onreadystatechange = function() {
  17435. // Check readyState before timeout as it changes
  17436. if ( xhr.readyState === 4 ) {
  17437. // Allow onerror to be called first,
  17438. // but that will not handle a native abort
  17439. // Also, save errorCallback to a variable
  17440. // as xhr.onerror cannot be accessed
  17441. window.setTimeout( function() {
  17442. if ( callback ) {
  17443. errorCallback();
  17444. }
  17445. } );
  17446. }
  17447. };
  17448. }
  17449. // Create the abort callback
  17450. callback = callback( "abort" );
  17451. try {
  17452. // Do send the request (this may raise an exception)
  17453. xhr.send( options.hasContent && options.data || null );
  17454. } catch ( e ) {
  17455. // #14683: Only rethrow if this hasn't been notified as an error yet
  17456. if ( callback ) {
  17457. throw e;
  17458. }
  17459. }
  17460. },
  17461. abort: function() {
  17462. if ( callback ) {
  17463. callback();
  17464. }
  17465. }
  17466. };
  17467. }
  17468. } );
  17469. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17470. jQuery.ajaxPrefilter( function( s ) {
  17471. if ( s.crossDomain ) {
  17472. s.contents.script = false;
  17473. }
  17474. } );
  17475. // Install script dataType
  17476. jQuery.ajaxSetup( {
  17477. accepts: {
  17478. script: "text/javascript, application/javascript, " +
  17479. "application/ecmascript, application/x-ecmascript"
  17480. },
  17481. contents: {
  17482. script: /\b(?:java|ecma)script\b/
  17483. },
  17484. converters: {
  17485. "text script": function( text ) {
  17486. jQuery.globalEval( text );
  17487. return text;
  17488. }
  17489. }
  17490. } );
  17491. // Handle cache's special case and crossDomain
  17492. jQuery.ajaxPrefilter( "script", function( s ) {
  17493. if ( s.cache === undefined ) {
  17494. s.cache = false;
  17495. }
  17496. if ( s.crossDomain ) {
  17497. s.type = "GET";
  17498. }
  17499. } );
  17500. // Bind script tag hack transport
  17501. jQuery.ajaxTransport( "script", function( s ) {
  17502. // This transport only deals with cross domain or forced-by-attrs requests
  17503. if ( s.crossDomain || s.scriptAttrs ) {
  17504. var script, callback;
  17505. return {
  17506. send: function( _, complete ) {
  17507. script = jQuery( "<script>" )
  17508. .attr( s.scriptAttrs || {} )
  17509. .prop( { charset: s.scriptCharset, src: s.url } )
  17510. .on( "load error", callback = function( evt ) {
  17511. script.remove();
  17512. callback = null;
  17513. if ( evt ) {
  17514. complete( evt.type === "error" ? 404 : 200, evt.type );
  17515. }
  17516. } );
  17517. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17518. document.head.appendChild( script[ 0 ] );
  17519. },
  17520. abort: function() {
  17521. if ( callback ) {
  17522. callback();
  17523. }
  17524. }
  17525. };
  17526. }
  17527. } );
  17528. var oldCallbacks = [],
  17529. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17530. // Default jsonp settings
  17531. jQuery.ajaxSetup( {
  17532. jsonp: "callback",
  17533. jsonpCallback: function() {
  17534. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17535. this[ callback ] = true;
  17536. return callback;
  17537. }
  17538. } );
  17539. // Detect, normalize options and install callbacks for jsonp requests
  17540. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17541. var callbackName, overwritten, responseContainer,
  17542. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17543. "url" :
  17544. typeof s.data === "string" &&
  17545. ( s.contentType || "" )
  17546. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17547. rjsonp.test( s.data ) && "data"
  17548. );
  17549. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17550. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17551. // Get callback name, remembering preexisting value associated with it
  17552. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17553. s.jsonpCallback() :
  17554. s.jsonpCallback;
  17555. // Insert callback into url or form data
  17556. if ( jsonProp ) {
  17557. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17558. } else if ( s.jsonp !== false ) {
  17559. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17560. }
  17561. // Use data converter to retrieve json after script execution
  17562. s.converters[ "script json" ] = function() {
  17563. if ( !responseContainer ) {
  17564. jQuery.error( callbackName + " was not called" );
  17565. }
  17566. return responseContainer[ 0 ];
  17567. };
  17568. // Force json dataType
  17569. s.dataTypes[ 0 ] = "json";
  17570. // Install callback
  17571. overwritten = window[ callbackName ];
  17572. window[ callbackName ] = function() {
  17573. responseContainer = arguments;
  17574. };
  17575. // Clean-up function (fires after converters)
  17576. jqXHR.always( function() {
  17577. // If previous value didn't exist - remove it
  17578. if ( overwritten === undefined ) {
  17579. jQuery( window ).removeProp( callbackName );
  17580. // Otherwise restore preexisting value
  17581. } else {
  17582. window[ callbackName ] = overwritten;
  17583. }
  17584. // Save back as free
  17585. if ( s[ callbackName ] ) {
  17586. // Make sure that re-using the options doesn't screw things around
  17587. s.jsonpCallback = originalSettings.jsonpCallback;
  17588. // Save the callback name for future use
  17589. oldCallbacks.push( callbackName );
  17590. }
  17591. // Call if it was a function and we have a response
  17592. if ( responseContainer && isFunction( overwritten ) ) {
  17593. overwritten( responseContainer[ 0 ] );
  17594. }
  17595. responseContainer = overwritten = undefined;
  17596. } );
  17597. // Delegate to script
  17598. return "script";
  17599. }
  17600. } );
  17601. // Support: Safari 8 only
  17602. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17603. // collapse sibling forms: the second one becomes a child of the first one.
  17604. // Because of that, this security measure has to be disabled in Safari 8.
  17605. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17606. support.createHTMLDocument = ( function() {
  17607. var body = document.implementation.createHTMLDocument( "" ).body;
  17608. body.innerHTML = "<form></form><form></form>";
  17609. return body.childNodes.length === 2;
  17610. } )();
  17611. // Argument "data" should be string of html
  17612. // context (optional): If specified, the fragment will be created in this context,
  17613. // defaults to document
  17614. // keepScripts (optional): If true, will include scripts passed in the html string
  17615. jQuery.parseHTML = function( data, context, keepScripts ) {
  17616. if ( typeof data !== "string" ) {
  17617. return [];
  17618. }
  17619. if ( typeof context === "boolean" ) {
  17620. keepScripts = context;
  17621. context = false;
  17622. }
  17623. var base, parsed, scripts;
  17624. if ( !context ) {
  17625. // Stop scripts or inline event handlers from being executed immediately
  17626. // by using document.implementation
  17627. if ( support.createHTMLDocument ) {
  17628. context = document.implementation.createHTMLDocument( "" );
  17629. // Set the base href for the created document
  17630. // so any parsed elements with URLs
  17631. // are based on the document's URL (gh-2965)
  17632. base = context.createElement( "base" );
  17633. base.href = document.location.href;
  17634. context.head.appendChild( base );
  17635. } else {
  17636. context = document;
  17637. }
  17638. }
  17639. parsed = rsingleTag.exec( data );
  17640. scripts = !keepScripts && [];
  17641. // Single tag
  17642. if ( parsed ) {
  17643. return [ context.createElement( parsed[ 1 ] ) ];
  17644. }
  17645. parsed = buildFragment( [ data ], context, scripts );
  17646. if ( scripts && scripts.length ) {
  17647. jQuery( scripts ).remove();
  17648. }
  17649. return jQuery.merge( [], parsed.childNodes );
  17650. };
  17651. /**
  17652. * Load a url into a page
  17653. */
  17654. jQuery.fn.load = function( url, params, callback ) {
  17655. var selector, type, response,
  17656. self = this,
  17657. off = url.indexOf( " " );
  17658. if ( off > -1 ) {
  17659. selector = stripAndCollapse( url.slice( off ) );
  17660. url = url.slice( 0, off );
  17661. }
  17662. // If it's a function
  17663. if ( isFunction( params ) ) {
  17664. // We assume that it's the callback
  17665. callback = params;
  17666. params = undefined;
  17667. // Otherwise, build a param string
  17668. } else if ( params && typeof params === "object" ) {
  17669. type = "POST";
  17670. }
  17671. // If we have elements to modify, make the request
  17672. if ( self.length > 0 ) {
  17673. jQuery.ajax( {
  17674. url: url,
  17675. // If "type" variable is undefined, then "GET" method will be used.
  17676. // Make value of this field explicit since
  17677. // user can override it through ajaxSetup method
  17678. type: type || "GET",
  17679. dataType: "html",
  17680. data: params
  17681. } ).done( function( responseText ) {
  17682. // Save response for use in complete callback
  17683. response = arguments;
  17684. self.html( selector ?
  17685. // If a selector was specified, locate the right elements in a dummy div
  17686. // Exclude scripts to avoid IE 'Permission Denied' errors
  17687. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17688. // Otherwise use the full result
  17689. responseText );
  17690. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17691. // but they are ignored because response was set above.
  17692. // If it fails, this function gets "jqXHR", "status", "error"
  17693. } ).always( callback && function( jqXHR, status ) {
  17694. self.each( function() {
  17695. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17696. } );
  17697. } );
  17698. }
  17699. return this;
  17700. };
  17701. // Attach a bunch of functions for handling common AJAX events
  17702. jQuery.each( [
  17703. "ajaxStart",
  17704. "ajaxStop",
  17705. "ajaxComplete",
  17706. "ajaxError",
  17707. "ajaxSuccess",
  17708. "ajaxSend"
  17709. ], function( i, type ) {
  17710. jQuery.fn[ type ] = function( fn ) {
  17711. return this.on( type, fn );
  17712. };
  17713. } );
  17714. jQuery.expr.pseudos.animated = function( elem ) {
  17715. return jQuery.grep( jQuery.timers, function( fn ) {
  17716. return elem === fn.elem;
  17717. } ).length;
  17718. };
  17719. jQuery.offset = {
  17720. setOffset: function( elem, options, i ) {
  17721. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17722. position = jQuery.css( elem, "position" ),
  17723. curElem = jQuery( elem ),
  17724. props = {};
  17725. // Set position first, in-case top/left are set even on static elem
  17726. if ( position === "static" ) {
  17727. elem.style.position = "relative";
  17728. }
  17729. curOffset = curElem.offset();
  17730. curCSSTop = jQuery.css( elem, "top" );
  17731. curCSSLeft = jQuery.css( elem, "left" );
  17732. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17733. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17734. // Need to be able to calculate position if either
  17735. // top or left is auto and position is either absolute or fixed
  17736. if ( calculatePosition ) {
  17737. curPosition = curElem.position();
  17738. curTop = curPosition.top;
  17739. curLeft = curPosition.left;
  17740. } else {
  17741. curTop = parseFloat( curCSSTop ) || 0;
  17742. curLeft = parseFloat( curCSSLeft ) || 0;
  17743. }
  17744. if ( isFunction( options ) ) {
  17745. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17746. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17747. }
  17748. if ( options.top != null ) {
  17749. props.top = ( options.top - curOffset.top ) + curTop;
  17750. }
  17751. if ( options.left != null ) {
  17752. props.left = ( options.left - curOffset.left ) + curLeft;
  17753. }
  17754. if ( "using" in options ) {
  17755. options.using.call( elem, props );
  17756. } else {
  17757. curElem.css( props );
  17758. }
  17759. }
  17760. };
  17761. jQuery.fn.extend( {
  17762. // offset() relates an element's border box to the document origin
  17763. offset: function( options ) {
  17764. // Preserve chaining for setter
  17765. if ( arguments.length ) {
  17766. return options === undefined ?
  17767. this :
  17768. this.each( function( i ) {
  17769. jQuery.offset.setOffset( this, options, i );
  17770. } );
  17771. }
  17772. var rect, win,
  17773. elem = this[ 0 ];
  17774. if ( !elem ) {
  17775. return;
  17776. }
  17777. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17778. // Support: IE <=11 only
  17779. // Running getBoundingClientRect on a
  17780. // disconnected node in IE throws an error
  17781. if ( !elem.getClientRects().length ) {
  17782. return { top: 0, left: 0 };
  17783. }
  17784. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17785. rect = elem.getBoundingClientRect();
  17786. win = elem.ownerDocument.defaultView;
  17787. return {
  17788. top: rect.top + win.pageYOffset,
  17789. left: rect.left + win.pageXOffset
  17790. };
  17791. },
  17792. // position() relates an element's margin box to its offset parent's padding box
  17793. // This corresponds to the behavior of CSS absolute positioning
  17794. position: function() {
  17795. if ( !this[ 0 ] ) {
  17796. return;
  17797. }
  17798. var offsetParent, offset, doc,
  17799. elem = this[ 0 ],
  17800. parentOffset = { top: 0, left: 0 };
  17801. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17802. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17803. // Assume position:fixed implies availability of getBoundingClientRect
  17804. offset = elem.getBoundingClientRect();
  17805. } else {
  17806. offset = this.offset();
  17807. // Account for the *real* offset parent, which can be the document or its root element
  17808. // when a statically positioned element is identified
  17809. doc = elem.ownerDocument;
  17810. offsetParent = elem.offsetParent || doc.documentElement;
  17811. while ( offsetParent &&
  17812. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17813. jQuery.css( offsetParent, "position" ) === "static" ) {
  17814. offsetParent = offsetParent.parentNode;
  17815. }
  17816. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17817. // Incorporate borders into its offset, since they are outside its content origin
  17818. parentOffset = jQuery( offsetParent ).offset();
  17819. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17820. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17821. }
  17822. }
  17823. // Subtract parent offsets and element margins
  17824. return {
  17825. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17826. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17827. };
  17828. },
  17829. // This method will return documentElement in the following cases:
  17830. // 1) For the element inside the iframe without offsetParent, this method will return
  17831. // documentElement of the parent window
  17832. // 2) For the hidden or detached element
  17833. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17834. //
  17835. // but those exceptions were never presented as a real life use-cases
  17836. // and might be considered as more preferable results.
  17837. //
  17838. // This logic, however, is not guaranteed and can change at any point in the future
  17839. offsetParent: function() {
  17840. return this.map( function() {
  17841. var offsetParent = this.offsetParent;
  17842. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17843. offsetParent = offsetParent.offsetParent;
  17844. }
  17845. return offsetParent || documentElement;
  17846. } );
  17847. }
  17848. } );
  17849. // Create scrollLeft and scrollTop methods
  17850. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17851. var top = "pageYOffset" === prop;
  17852. jQuery.fn[ method ] = function( val ) {
  17853. return access( this, function( elem, method, val ) {
  17854. // Coalesce documents and windows
  17855. var win;
  17856. if ( isWindow( elem ) ) {
  17857. win = elem;
  17858. } else if ( elem.nodeType === 9 ) {
  17859. win = elem.defaultView;
  17860. }
  17861. if ( val === undefined ) {
  17862. return win ? win[ prop ] : elem[ method ];
  17863. }
  17864. if ( win ) {
  17865. win.scrollTo(
  17866. !top ? val : win.pageXOffset,
  17867. top ? val : win.pageYOffset
  17868. );
  17869. } else {
  17870. elem[ method ] = val;
  17871. }
  17872. }, method, val, arguments.length );
  17873. };
  17874. } );
  17875. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17876. // Add the top/left cssHooks using jQuery.fn.position
  17877. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17878. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17879. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17880. // rather than make the css module depend on the offset module, just check for it here
  17881. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17882. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17883. function( elem, computed ) {
  17884. if ( computed ) {
  17885. computed = curCSS( elem, prop );
  17886. // If curCSS returns percentage, fallback to offset
  17887. return rnumnonpx.test( computed ) ?
  17888. jQuery( elem ).position()[ prop ] + "px" :
  17889. computed;
  17890. }
  17891. }
  17892. );
  17893. } );
  17894. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17895. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17896. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17897. function( defaultExtra, funcName ) {
  17898. // Margin is only for outerHeight, outerWidth
  17899. jQuery.fn[ funcName ] = function( margin, value ) {
  17900. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17901. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17902. return access( this, function( elem, type, value ) {
  17903. var doc;
  17904. if ( isWindow( elem ) ) {
  17905. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17906. return funcName.indexOf( "outer" ) === 0 ?
  17907. elem[ "inner" + name ] :
  17908. elem.document.documentElement[ "client" + name ];
  17909. }
  17910. // Get document width or height
  17911. if ( elem.nodeType === 9 ) {
  17912. doc = elem.documentElement;
  17913. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17914. // whichever is greatest
  17915. return Math.max(
  17916. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17917. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17918. doc[ "client" + name ]
  17919. );
  17920. }
  17921. return value === undefined ?
  17922. // Get width or height on the element, requesting but not forcing parseFloat
  17923. jQuery.css( elem, type, extra ) :
  17924. // Set width or height on the element
  17925. jQuery.style( elem, type, value, extra );
  17926. }, type, chainable ? margin : undefined, chainable );
  17927. };
  17928. } );
  17929. } );
  17930. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17931. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17932. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17933. function( i, name ) {
  17934. // Handle event binding
  17935. jQuery.fn[ name ] = function( data, fn ) {
  17936. return arguments.length > 0 ?
  17937. this.on( name, null, data, fn ) :
  17938. this.trigger( name );
  17939. };
  17940. } );
  17941. jQuery.fn.extend( {
  17942. hover: function( fnOver, fnOut ) {
  17943. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17944. }
  17945. } );
  17946. jQuery.fn.extend( {
  17947. bind: function( types, data, fn ) {
  17948. return this.on( types, null, data, fn );
  17949. },
  17950. unbind: function( types, fn ) {
  17951. return this.off( types, null, fn );
  17952. },
  17953. delegate: function( selector, types, data, fn ) {
  17954. return this.on( types, selector, data, fn );
  17955. },
  17956. undelegate: function( selector, types, fn ) {
  17957. // ( namespace ) or ( selector, types [, fn] )
  17958. return arguments.length === 1 ?
  17959. this.off( selector, "**" ) :
  17960. this.off( types, selector || "**", fn );
  17961. }
  17962. } );
  17963. // Bind a function to a context, optionally partially applying any
  17964. // arguments.
  17965. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17966. // However, it is not slated for removal any time soon
  17967. jQuery.proxy = function( fn, context ) {
  17968. var tmp, args, proxy;
  17969. if ( typeof context === "string" ) {
  17970. tmp = fn[ context ];
  17971. context = fn;
  17972. fn = tmp;
  17973. }
  17974. // Quick check to determine if target is callable, in the spec
  17975. // this throws a TypeError, but we will just return undefined.
  17976. if ( !isFunction( fn ) ) {
  17977. return undefined;
  17978. }
  17979. // Simulated bind
  17980. args = slice.call( arguments, 2 );
  17981. proxy = function() {
  17982. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17983. };
  17984. // Set the guid of unique handler to the same of original handler, so it can be removed
  17985. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17986. return proxy;
  17987. };
  17988. jQuery.holdReady = function( hold ) {
  17989. if ( hold ) {
  17990. jQuery.readyWait++;
  17991. } else {
  17992. jQuery.ready( true );
  17993. }
  17994. };
  17995. jQuery.isArray = Array.isArray;
  17996. jQuery.parseJSON = JSON.parse;
  17997. jQuery.nodeName = nodeName;
  17998. jQuery.isFunction = isFunction;
  17999. jQuery.isWindow = isWindow;
  18000. jQuery.camelCase = camelCase;
  18001. jQuery.type = toType;
  18002. jQuery.now = Date.now;
  18003. jQuery.isNumeric = function( obj ) {
  18004. // As of jQuery 3.0, isNumeric is limited to
  18005. // strings and numbers (primitives or objects)
  18006. // that can be coerced to finite numbers (gh-2662)
  18007. var type = jQuery.type( obj );
  18008. return ( type === "number" || type === "string" ) &&
  18009. // parseFloat NaNs numeric-cast false positives ("")
  18010. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  18011. // subtraction forces infinities to NaN
  18012. !isNaN( obj - parseFloat( obj ) );
  18013. };
  18014. // Register as a named AMD module, since jQuery can be concatenated with other
  18015. // files that may use define, but not via a proper concatenation script that
  18016. // understands anonymous AMD modules. A named AMD is safest and most robust
  18017. // way to register. Lowercase jquery is used because AMD module names are
  18018. // derived from file names, and jQuery is normally delivered in a lowercase
  18019. // file name. Do this after creating the global so that if an AMD module wants
  18020. // to call noConflict to hide this version of jQuery, it will work.
  18021. // Note that for maximum portability, libraries that are not jQuery should
  18022. // declare themselves as anonymous modules, and avoid setting a global if an
  18023. // AMD loader is present. jQuery is a special case. For more information, see
  18024. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18025. if ( true ) {
  18026. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18027. return jQuery;
  18028. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18029. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18030. }
  18031. var
  18032. // Map over jQuery in case of overwrite
  18033. _jQuery = window.jQuery,
  18034. // Map over the $ in case of overwrite
  18035. _$ = window.$;
  18036. jQuery.noConflict = function( deep ) {
  18037. if ( window.$ === jQuery ) {
  18038. window.$ = _$;
  18039. }
  18040. if ( deep && window.jQuery === jQuery ) {
  18041. window.jQuery = _jQuery;
  18042. }
  18043. return jQuery;
  18044. };
  18045. // Expose jQuery and $ identifiers, even in AMD
  18046. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18047. // and CommonJS for browser emulators (#13566)
  18048. if ( !noGlobal ) {
  18049. window.jQuery = window.$ = jQuery;
  18050. }
  18051. return jQuery;
  18052. } );
  18053. /***/ }),
  18054. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18055. /*!************************************************!*\
  18056. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18057. \************************************************/
  18058. /*! exports provided: default */
  18059. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18060. "use strict";
  18061. __webpack_require__.r(__webpack_exports__);
  18062. var classCallCheck = function (instance, Constructor) {
  18063. if (!(instance instanceof Constructor)) {
  18064. throw new TypeError("Cannot call a class as a function");
  18065. }
  18066. };
  18067. var createClass = function () {
  18068. function defineProperties(target, props) {
  18069. for (var i = 0; i < props.length; i++) {
  18070. var descriptor = props[i];
  18071. descriptor.enumerable = descriptor.enumerable || false;
  18072. descriptor.configurable = true;
  18073. if ("value" in descriptor) descriptor.writable = true;
  18074. Object.defineProperty(target, descriptor.key, descriptor);
  18075. }
  18076. }
  18077. return function (Constructor, protoProps, staticProps) {
  18078. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18079. if (staticProps) defineProperties(Constructor, staticProps);
  18080. return Constructor;
  18081. };
  18082. }();
  18083. var _extends = Object.assign || function (target) {
  18084. for (var i = 1; i < arguments.length; i++) {
  18085. var source = arguments[i];
  18086. for (var key in source) {
  18087. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18088. target[key] = source[key];
  18089. }
  18090. }
  18091. }
  18092. return target;
  18093. };
  18094. var inherits = function (subClass, superClass) {
  18095. if (typeof superClass !== "function" && superClass !== null) {
  18096. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18097. }
  18098. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18099. constructor: {
  18100. value: subClass,
  18101. enumerable: false,
  18102. writable: true,
  18103. configurable: true
  18104. }
  18105. });
  18106. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18107. };
  18108. var possibleConstructorReturn = function (self, call) {
  18109. if (!self) {
  18110. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18111. }
  18112. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18113. };
  18114. var Connector = function () {
  18115. /**
  18116. * Create a new class instance.
  18117. */
  18118. function Connector(options) {
  18119. classCallCheck(this, Connector);
  18120. /**
  18121. * Default connector options.
  18122. */
  18123. this._defaultOptions = {
  18124. auth: {
  18125. headers: {}
  18126. },
  18127. authEndpoint: '/broadcasting/auth',
  18128. broadcaster: 'pusher',
  18129. csrfToken: null,
  18130. host: null,
  18131. key: null,
  18132. namespace: 'App.Events'
  18133. };
  18134. this.setOptions(options);
  18135. this.connect();
  18136. }
  18137. /**
  18138. * Merge the custom options with the defaults.
  18139. */
  18140. createClass(Connector, [{
  18141. key: 'setOptions',
  18142. value: function setOptions(options) {
  18143. this.options = _extends(this._defaultOptions, options);
  18144. if (this.csrfToken()) {
  18145. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18146. }
  18147. return options;
  18148. }
  18149. /**
  18150. * Extract the CSRF token from the page.
  18151. */
  18152. }, {
  18153. key: 'csrfToken',
  18154. value: function csrfToken() {
  18155. var selector = void 0;
  18156. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18157. return window['Laravel'].csrfToken;
  18158. } else if (this.options.csrfToken) {
  18159. return this.options.csrfToken;
  18160. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18161. return selector.getAttribute('content');
  18162. }
  18163. return null;
  18164. }
  18165. }]);
  18166. return Connector;
  18167. }();
  18168. /**
  18169. * This class represents a basic channel.
  18170. */
  18171. var Channel = function () {
  18172. function Channel() {
  18173. classCallCheck(this, Channel);
  18174. }
  18175. createClass(Channel, [{
  18176. key: 'listenForWhisper',
  18177. /**
  18178. * Listen for a whisper event on the channel instance.
  18179. */
  18180. value: function listenForWhisper(event, callback) {
  18181. return this.listen('.client-' + event, callback);
  18182. }
  18183. /**
  18184. * Listen for an event on the channel instance.
  18185. */
  18186. }, {
  18187. key: 'notification',
  18188. value: function notification(callback) {
  18189. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18190. }
  18191. /**
  18192. * Stop listening for a whispser event on the channel instance.
  18193. */
  18194. }, {
  18195. key: 'stopListeningForWhisper',
  18196. value: function stopListeningForWhisper(event) {
  18197. return this.stopListening('.client-' + event);
  18198. }
  18199. }]);
  18200. return Channel;
  18201. }();
  18202. /**
  18203. * Event name formatter
  18204. */
  18205. var EventFormatter = function () {
  18206. /**
  18207. * Create a new class instance.
  18208. */
  18209. function EventFormatter(namespace) {
  18210. classCallCheck(this, EventFormatter);
  18211. this.setNamespace(namespace);
  18212. }
  18213. /**
  18214. * Format the given event name.
  18215. */
  18216. createClass(EventFormatter, [{
  18217. key: 'format',
  18218. value: function format(event) {
  18219. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18220. return event.substr(1);
  18221. } else if (this.namespace) {
  18222. event = this.namespace + '.' + event;
  18223. }
  18224. return event.replace(/\./g, '\\');
  18225. }
  18226. /**
  18227. * Set the event namespace.
  18228. */
  18229. }, {
  18230. key: 'setNamespace',
  18231. value: function setNamespace(value) {
  18232. this.namespace = value;
  18233. }
  18234. }]);
  18235. return EventFormatter;
  18236. }();
  18237. /**
  18238. * This class represents a Pusher channel.
  18239. */
  18240. var PusherChannel = function (_Channel) {
  18241. inherits(PusherChannel, _Channel);
  18242. /**
  18243. * Create a new class instance.
  18244. */
  18245. function PusherChannel(pusher, name, options) {
  18246. classCallCheck(this, PusherChannel);
  18247. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18248. _this.name = name;
  18249. _this.pusher = pusher;
  18250. _this.options = options;
  18251. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18252. _this.subscribe();
  18253. return _this;
  18254. }
  18255. /**
  18256. * Subscribe to a Pusher channel.
  18257. */
  18258. createClass(PusherChannel, [{
  18259. key: 'subscribe',
  18260. value: function subscribe() {
  18261. this.subscription = this.pusher.subscribe(this.name);
  18262. }
  18263. /**
  18264. * Unsubscribe from a Pusher channel.
  18265. */
  18266. }, {
  18267. key: 'unsubscribe',
  18268. value: function unsubscribe() {
  18269. this.pusher.unsubscribe(this.name);
  18270. }
  18271. /**
  18272. * Listen for an event on the channel instance.
  18273. */
  18274. }, {
  18275. key: 'listen',
  18276. value: function listen(event, callback) {
  18277. this.on(this.eventFormatter.format(event), callback);
  18278. return this;
  18279. }
  18280. /**
  18281. * Stop listening for an event on the channel instance.
  18282. */
  18283. }, {
  18284. key: 'stopListening',
  18285. value: function stopListening(event) {
  18286. this.subscription.unbind(this.eventFormatter.format(event));
  18287. return this;
  18288. }
  18289. /**
  18290. * Bind a channel to an event.
  18291. */
  18292. }, {
  18293. key: 'on',
  18294. value: function on(event, callback) {
  18295. this.subscription.bind(event, callback);
  18296. return this;
  18297. }
  18298. }]);
  18299. return PusherChannel;
  18300. }(Channel);
  18301. /**
  18302. * This class represents a Pusher private channel.
  18303. */
  18304. var PusherPrivateChannel = function (_PusherChannel) {
  18305. inherits(PusherPrivateChannel, _PusherChannel);
  18306. function PusherPrivateChannel() {
  18307. classCallCheck(this, PusherPrivateChannel);
  18308. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18309. }
  18310. createClass(PusherPrivateChannel, [{
  18311. key: 'whisper',
  18312. /**
  18313. * Trigger client event on the channel.
  18314. */
  18315. value: function whisper(eventName, data) {
  18316. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18317. return this;
  18318. }
  18319. }]);
  18320. return PusherPrivateChannel;
  18321. }(PusherChannel);
  18322. /**
  18323. * This class represents a Pusher presence channel.
  18324. */
  18325. var PusherPresenceChannel = function (_PusherChannel) {
  18326. inherits(PusherPresenceChannel, _PusherChannel);
  18327. function PusherPresenceChannel() {
  18328. classCallCheck(this, PusherPresenceChannel);
  18329. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18330. }
  18331. createClass(PusherPresenceChannel, [{
  18332. key: 'here',
  18333. /**
  18334. * Register a callback to be called anytime the member list changes.
  18335. */
  18336. value: function here(callback) {
  18337. this.on('pusher:subscription_succeeded', function (data) {
  18338. callback(Object.keys(data.members).map(function (k) {
  18339. return data.members[k];
  18340. }));
  18341. });
  18342. return this;
  18343. }
  18344. /**
  18345. * Listen for someone joining the channel.
  18346. */
  18347. }, {
  18348. key: 'joining',
  18349. value: function joining(callback) {
  18350. this.on('pusher:member_added', function (member) {
  18351. callback(member.info);
  18352. });
  18353. return this;
  18354. }
  18355. /**
  18356. * Listen for someone leaving the channel.
  18357. */
  18358. }, {
  18359. key: 'leaving',
  18360. value: function leaving(callback) {
  18361. this.on('pusher:member_removed', function (member) {
  18362. callback(member.info);
  18363. });
  18364. return this;
  18365. }
  18366. /**
  18367. * Trigger client event on the channel.
  18368. */
  18369. }, {
  18370. key: 'whisper',
  18371. value: function whisper(eventName, data) {
  18372. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18373. return this;
  18374. }
  18375. }]);
  18376. return PusherPresenceChannel;
  18377. }(PusherChannel);
  18378. /**
  18379. * This class represents a Socket.io channel.
  18380. */
  18381. var SocketIoChannel = function (_Channel) {
  18382. inherits(SocketIoChannel, _Channel);
  18383. /**
  18384. * Create a new class instance.
  18385. */
  18386. function SocketIoChannel(socket, name, options) {
  18387. classCallCheck(this, SocketIoChannel);
  18388. /**
  18389. * The event callbacks applied to the channel.
  18390. */
  18391. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18392. _this.events = {};
  18393. _this.name = name;
  18394. _this.socket = socket;
  18395. _this.options = options;
  18396. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18397. _this.subscribe();
  18398. _this.configureReconnector();
  18399. return _this;
  18400. }
  18401. /**
  18402. * Subscribe to a Socket.io channel.
  18403. */
  18404. createClass(SocketIoChannel, [{
  18405. key: 'subscribe',
  18406. value: function subscribe() {
  18407. this.socket.emit('subscribe', {
  18408. channel: this.name,
  18409. auth: this.options.auth || {}
  18410. });
  18411. }
  18412. /**
  18413. * Unsubscribe from channel and ubind event callbacks.
  18414. */
  18415. }, {
  18416. key: 'unsubscribe',
  18417. value: function unsubscribe() {
  18418. this.unbind();
  18419. this.socket.emit('unsubscribe', {
  18420. channel: this.name,
  18421. auth: this.options.auth || {}
  18422. });
  18423. }
  18424. /**
  18425. * Listen for an event on the channel instance.
  18426. */
  18427. }, {
  18428. key: 'listen',
  18429. value: function listen(event, callback) {
  18430. this.on(this.eventFormatter.format(event), callback);
  18431. return this;
  18432. }
  18433. /**
  18434. * Stop listening for an event on the channel instance.
  18435. */
  18436. }, {
  18437. key: 'stopListening',
  18438. value: function stopListening(event) {
  18439. var name = this.eventFormatter.format(event);
  18440. this.socket.removeListener(name);
  18441. delete this.events[name];
  18442. return this;
  18443. }
  18444. /**
  18445. * Bind the channel's socket to an event and store the callback.
  18446. */
  18447. }, {
  18448. key: 'on',
  18449. value: function on(event, callback) {
  18450. var _this2 = this;
  18451. var listener = function listener(channel, data) {
  18452. if (_this2.name == channel) {
  18453. callback(data);
  18454. }
  18455. };
  18456. this.socket.on(event, listener);
  18457. this.bind(event, listener);
  18458. }
  18459. /**
  18460. * Attach a 'reconnect' listener and bind the event.
  18461. */
  18462. }, {
  18463. key: 'configureReconnector',
  18464. value: function configureReconnector() {
  18465. var _this3 = this;
  18466. var listener = function listener() {
  18467. _this3.subscribe();
  18468. };
  18469. this.socket.on('reconnect', listener);
  18470. this.bind('reconnect', listener);
  18471. }
  18472. /**
  18473. * Bind the channel's socket to an event and store the callback.
  18474. */
  18475. }, {
  18476. key: 'bind',
  18477. value: function bind(event, callback) {
  18478. this.events[event] = this.events[event] || [];
  18479. this.events[event].push(callback);
  18480. }
  18481. /**
  18482. * Unbind the channel's socket from all stored event callbacks.
  18483. */
  18484. }, {
  18485. key: 'unbind',
  18486. value: function unbind() {
  18487. var _this4 = this;
  18488. Object.keys(this.events).forEach(function (event) {
  18489. _this4.events[event].forEach(function (callback) {
  18490. _this4.socket.removeListener(event, callback);
  18491. });
  18492. delete _this4.events[event];
  18493. });
  18494. }
  18495. }]);
  18496. return SocketIoChannel;
  18497. }(Channel);
  18498. /**
  18499. * This class represents a Socket.io presence channel.
  18500. */
  18501. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18502. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18503. function SocketIoPrivateChannel() {
  18504. classCallCheck(this, SocketIoPrivateChannel);
  18505. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18506. }
  18507. createClass(SocketIoPrivateChannel, [{
  18508. key: 'whisper',
  18509. /**
  18510. * Trigger client event on the channel.
  18511. */
  18512. value: function whisper(eventName, data) {
  18513. this.socket.emit('client event', {
  18514. channel: this.name,
  18515. event: 'client-' + eventName,
  18516. data: data
  18517. });
  18518. return this;
  18519. }
  18520. }]);
  18521. return SocketIoPrivateChannel;
  18522. }(SocketIoChannel);
  18523. /**
  18524. * This class represents a Socket.io presence channel.
  18525. */
  18526. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18527. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18528. function SocketIoPresenceChannel() {
  18529. classCallCheck(this, SocketIoPresenceChannel);
  18530. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18531. }
  18532. createClass(SocketIoPresenceChannel, [{
  18533. key: 'here',
  18534. /**
  18535. * Register a callback to be called anytime the member list changes.
  18536. */
  18537. value: function here(callback) {
  18538. this.on('presence:subscribed', function (members) {
  18539. callback(members.map(function (m) {
  18540. return m.user_info;
  18541. }));
  18542. });
  18543. return this;
  18544. }
  18545. /**
  18546. * Listen for someone joining the channel.
  18547. */
  18548. }, {
  18549. key: 'joining',
  18550. value: function joining(callback) {
  18551. this.on('presence:joining', function (member) {
  18552. return callback(member.user_info);
  18553. });
  18554. return this;
  18555. }
  18556. /**
  18557. * Listen for someone leaving the channel.
  18558. */
  18559. }, {
  18560. key: 'leaving',
  18561. value: function leaving(callback) {
  18562. this.on('presence:leaving', function (member) {
  18563. return callback(member.user_info);
  18564. });
  18565. return this;
  18566. }
  18567. }]);
  18568. return SocketIoPresenceChannel;
  18569. }(SocketIoPrivateChannel);
  18570. /**
  18571. * This class represents a null channel.
  18572. */
  18573. var NullChannel = function (_Channel) {
  18574. inherits(NullChannel, _Channel);
  18575. function NullChannel() {
  18576. classCallCheck(this, NullChannel);
  18577. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18578. }
  18579. createClass(NullChannel, [{
  18580. key: 'subscribe',
  18581. /**
  18582. * Subscribe to a channel.
  18583. */
  18584. value: function subscribe() {}
  18585. //
  18586. /**
  18587. * Unsubscribe from a channel.
  18588. */
  18589. }, {
  18590. key: 'unsubscribe',
  18591. value: function unsubscribe() {}
  18592. //
  18593. /**
  18594. * Listen for an event on the channel instance.
  18595. */
  18596. }, {
  18597. key: 'listen',
  18598. value: function listen(event, callback) {
  18599. return this;
  18600. }
  18601. /**
  18602. * Stop listening for an event on the channel instance.
  18603. */
  18604. }, {
  18605. key: 'stopListening',
  18606. value: function stopListening(event) {
  18607. return this;
  18608. }
  18609. /**
  18610. * Bind a channel to an event.
  18611. */
  18612. }, {
  18613. key: 'on',
  18614. value: function on(event, callback) {
  18615. return this;
  18616. }
  18617. }]);
  18618. return NullChannel;
  18619. }(Channel);
  18620. /**
  18621. * This class represents a null private channel.
  18622. */
  18623. var NullPrivateChannel = function (_NullChannel) {
  18624. inherits(NullPrivateChannel, _NullChannel);
  18625. function NullPrivateChannel() {
  18626. classCallCheck(this, NullPrivateChannel);
  18627. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18628. }
  18629. createClass(NullPrivateChannel, [{
  18630. key: 'whisper',
  18631. /**
  18632. * Trigger client event on the channel.
  18633. */
  18634. value: function whisper(eventName, data) {
  18635. return this;
  18636. }
  18637. }]);
  18638. return NullPrivateChannel;
  18639. }(NullChannel);
  18640. /**
  18641. * This class represents a null presence channel.
  18642. */
  18643. var NullPresenceChannel = function (_NullChannel) {
  18644. inherits(NullPresenceChannel, _NullChannel);
  18645. function NullPresenceChannel() {
  18646. classCallCheck(this, NullPresenceChannel);
  18647. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18648. }
  18649. createClass(NullPresenceChannel, [{
  18650. key: 'here',
  18651. /**
  18652. * Register a callback to be called anytime the member list changes.
  18653. */
  18654. value: function here(callback) {
  18655. return this;
  18656. }
  18657. /**
  18658. * Listen for someone joining the channel.
  18659. */
  18660. }, {
  18661. key: 'joining',
  18662. value: function joining(callback) {
  18663. return this;
  18664. }
  18665. /**
  18666. * Listen for someone leaving the channel.
  18667. */
  18668. }, {
  18669. key: 'leaving',
  18670. value: function leaving(callback) {
  18671. return this;
  18672. }
  18673. /**
  18674. * Trigger client event on the channel.
  18675. */
  18676. }, {
  18677. key: 'whisper',
  18678. value: function whisper(eventName, data) {
  18679. return this;
  18680. }
  18681. }]);
  18682. return NullPresenceChannel;
  18683. }(NullChannel);
  18684. /**
  18685. * This class creates a connector to Pusher.
  18686. */
  18687. var PusherConnector = function (_Connector) {
  18688. inherits(PusherConnector, _Connector);
  18689. function PusherConnector() {
  18690. classCallCheck(this, PusherConnector);
  18691. /**
  18692. * All of the subscribed channel names.
  18693. */
  18694. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18695. _this.channels = {};
  18696. return _this;
  18697. }
  18698. /**
  18699. * Create a fresh Pusher connection.
  18700. */
  18701. createClass(PusherConnector, [{
  18702. key: 'connect',
  18703. value: function connect() {
  18704. if (typeof this.options.client !== 'undefined') {
  18705. this.pusher = this.options.client;
  18706. } else {
  18707. this.pusher = new Pusher(this.options.key, this.options);
  18708. }
  18709. }
  18710. /**
  18711. * Listen for an event on a channel instance.
  18712. */
  18713. }, {
  18714. key: 'listen',
  18715. value: function listen(name, event, callback) {
  18716. return this.channel(name).listen(event, callback);
  18717. }
  18718. /**
  18719. * Get a channel instance by name.
  18720. */
  18721. }, {
  18722. key: 'channel',
  18723. value: function channel(name) {
  18724. if (!this.channels[name]) {
  18725. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18726. }
  18727. return this.channels[name];
  18728. }
  18729. /**
  18730. * Get a private channel instance by name.
  18731. */
  18732. }, {
  18733. key: 'privateChannel',
  18734. value: function privateChannel(name) {
  18735. if (!this.channels['private-' + name]) {
  18736. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18737. }
  18738. return this.channels['private-' + name];
  18739. }
  18740. /**
  18741. * Get a presence channel instance by name.
  18742. */
  18743. }, {
  18744. key: 'presenceChannel',
  18745. value: function presenceChannel(name) {
  18746. if (!this.channels['presence-' + name]) {
  18747. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18748. }
  18749. return this.channels['presence-' + name];
  18750. }
  18751. /**
  18752. * Leave the given channel, as well as its private and presence variants.
  18753. */
  18754. }, {
  18755. key: 'leave',
  18756. value: function leave(name) {
  18757. var _this2 = this;
  18758. var channels = [name, 'private-' + name, 'presence-' + name];
  18759. channels.forEach(function (name, index) {
  18760. _this2.leaveChannel(name);
  18761. });
  18762. }
  18763. /**
  18764. * Leave the given channel.
  18765. */
  18766. }, {
  18767. key: 'leaveChannel',
  18768. value: function leaveChannel(name) {
  18769. if (this.channels[name]) {
  18770. this.channels[name].unsubscribe();
  18771. delete this.channels[name];
  18772. }
  18773. }
  18774. /**
  18775. * Get the socket ID for the connection.
  18776. */
  18777. }, {
  18778. key: 'socketId',
  18779. value: function socketId() {
  18780. return this.pusher.connection.socket_id;
  18781. }
  18782. /**
  18783. * Disconnect Pusher connection.
  18784. */
  18785. }, {
  18786. key: 'disconnect',
  18787. value: function disconnect() {
  18788. this.pusher.disconnect();
  18789. }
  18790. }]);
  18791. return PusherConnector;
  18792. }(Connector);
  18793. /**
  18794. * This class creates a connnector to a Socket.io server.
  18795. */
  18796. var SocketIoConnector = function (_Connector) {
  18797. inherits(SocketIoConnector, _Connector);
  18798. function SocketIoConnector() {
  18799. classCallCheck(this, SocketIoConnector);
  18800. /**
  18801. * All of the subscribed channel names.
  18802. */
  18803. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18804. _this.channels = {};
  18805. return _this;
  18806. }
  18807. /**
  18808. * Create a fresh Socket.io connection.
  18809. */
  18810. createClass(SocketIoConnector, [{
  18811. key: 'connect',
  18812. value: function connect() {
  18813. var io = this.getSocketIO();
  18814. this.socket = io(this.options.host, this.options);
  18815. return this.socket;
  18816. }
  18817. /**
  18818. * Get socket.io module from global scope or options.
  18819. */
  18820. }, {
  18821. key: 'getSocketIO',
  18822. value: function getSocketIO() {
  18823. if (typeof this.options.client !== 'undefined') {
  18824. return this.options.client;
  18825. }
  18826. if (typeof io !== 'undefined') {
  18827. return io;
  18828. }
  18829. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18830. }
  18831. /**
  18832. * Listen for an event on a channel instance.
  18833. */
  18834. }, {
  18835. key: 'listen',
  18836. value: function listen(name, event, callback) {
  18837. return this.channel(name).listen(event, callback);
  18838. }
  18839. /**
  18840. * Get a channel instance by name.
  18841. */
  18842. }, {
  18843. key: 'channel',
  18844. value: function channel(name) {
  18845. if (!this.channels[name]) {
  18846. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18847. }
  18848. return this.channels[name];
  18849. }
  18850. /**
  18851. * Get a private channel instance by name.
  18852. */
  18853. }, {
  18854. key: 'privateChannel',
  18855. value: function privateChannel(name) {
  18856. if (!this.channels['private-' + name]) {
  18857. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18858. }
  18859. return this.channels['private-' + name];
  18860. }
  18861. /**
  18862. * Get a presence channel instance by name.
  18863. */
  18864. }, {
  18865. key: 'presenceChannel',
  18866. value: function presenceChannel(name) {
  18867. if (!this.channels['presence-' + name]) {
  18868. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18869. }
  18870. return this.channels['presence-' + name];
  18871. }
  18872. /**
  18873. * Leave the given channel, as well as its private and presence variants.
  18874. */
  18875. }, {
  18876. key: 'leave',
  18877. value: function leave(name) {
  18878. var _this2 = this;
  18879. var channels = [name, 'private-' + name, 'presence-' + name];
  18880. channels.forEach(function (name) {
  18881. _this2.leaveChannel(name);
  18882. });
  18883. }
  18884. /**
  18885. * Leave the given channel.
  18886. */
  18887. }, {
  18888. key: 'leaveChannel',
  18889. value: function leaveChannel(name) {
  18890. if (this.channels[name]) {
  18891. this.channels[name].unsubscribe();
  18892. delete this.channels[name];
  18893. }
  18894. }
  18895. /**
  18896. * Get the socket ID for the connection.
  18897. */
  18898. }, {
  18899. key: 'socketId',
  18900. value: function socketId() {
  18901. return this.socket.id;
  18902. }
  18903. /**
  18904. * Disconnect Socketio connection.
  18905. */
  18906. }, {
  18907. key: 'disconnect',
  18908. value: function disconnect() {
  18909. this.socket.disconnect();
  18910. }
  18911. }]);
  18912. return SocketIoConnector;
  18913. }(Connector);
  18914. /**
  18915. * This class creates a null connector.
  18916. */
  18917. var NullConnector = function (_Connector) {
  18918. inherits(NullConnector, _Connector);
  18919. function NullConnector() {
  18920. classCallCheck(this, NullConnector);
  18921. /**
  18922. * All of the subscribed channel names.
  18923. */
  18924. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18925. _this.channels = {};
  18926. return _this;
  18927. }
  18928. /**
  18929. * Create a fresh connection.
  18930. */
  18931. createClass(NullConnector, [{
  18932. key: 'connect',
  18933. value: function connect() {}
  18934. //
  18935. /**
  18936. * Listen for an event on a channel instance.
  18937. */
  18938. }, {
  18939. key: 'listen',
  18940. value: function listen(name, event, callback) {
  18941. return new NullChannel();
  18942. }
  18943. /**
  18944. * Get a channel instance by name.
  18945. */
  18946. }, {
  18947. key: 'channel',
  18948. value: function channel(name) {
  18949. return new NullChannel();
  18950. }
  18951. /**
  18952. * Get a private channel instance by name.
  18953. */
  18954. }, {
  18955. key: 'privateChannel',
  18956. value: function privateChannel(name) {
  18957. return new NullPrivateChannel();
  18958. }
  18959. /**
  18960. * Get a presence channel instance by name.
  18961. */
  18962. }, {
  18963. key: 'presenceChannel',
  18964. value: function presenceChannel(name) {
  18965. return new NullPresenceChannel();
  18966. }
  18967. /**
  18968. * Leave the given channel, as well as its private and presence variants.
  18969. */
  18970. }, {
  18971. key: 'leave',
  18972. value: function leave(name) {}
  18973. //
  18974. /**
  18975. * Leave the given channel.
  18976. */
  18977. }, {
  18978. key: 'leaveChannel',
  18979. value: function leaveChannel(name) {}
  18980. //
  18981. /**
  18982. * Get the socket ID for the connection.
  18983. */
  18984. }, {
  18985. key: 'socketId',
  18986. value: function socketId() {
  18987. return 'fake-socket-id';
  18988. }
  18989. /**
  18990. * Disconnect the connection.
  18991. */
  18992. }, {
  18993. key: 'disconnect',
  18994. value: function disconnect() {
  18995. //
  18996. }
  18997. }]);
  18998. return NullConnector;
  18999. }(Connector);
  19000. /**
  19001. * This class is the primary API for interacting with broadcasting.
  19002. */
  19003. var Echo = function () {
  19004. /**
  19005. * Create a new class instance.
  19006. */
  19007. function Echo(options) {
  19008. classCallCheck(this, Echo);
  19009. this.options = options;
  19010. this.connect();
  19011. if (!this.options.withoutInterceptors) {
  19012. this.registerInterceptors();
  19013. }
  19014. }
  19015. /**
  19016. * Get a channel instance by name.
  19017. */
  19018. createClass(Echo, [{
  19019. key: 'channel',
  19020. value: function channel(_channel) {
  19021. return this.connector.channel(_channel);
  19022. }
  19023. /**
  19024. * Create a new connection.
  19025. */
  19026. }, {
  19027. key: 'connect',
  19028. value: function connect() {
  19029. if (this.options.broadcaster == 'pusher') {
  19030. this.connector = new PusherConnector(this.options);
  19031. } else if (this.options.broadcaster == 'socket.io') {
  19032. this.connector = new SocketIoConnector(this.options);
  19033. } else if (this.options.broadcaster == 'null') {
  19034. this.connector = new NullConnector(this.options);
  19035. } else if (typeof this.options.broadcaster == 'function') {
  19036. this.connector = new this.options.broadcaster(this.options);
  19037. }
  19038. }
  19039. /**
  19040. * Disconnect from the Echo server.
  19041. */
  19042. }, {
  19043. key: 'disconnect',
  19044. value: function disconnect() {
  19045. this.connector.disconnect();
  19046. }
  19047. /**
  19048. * Get a presence channel instance by name.
  19049. */
  19050. }, {
  19051. key: 'join',
  19052. value: function join(channel) {
  19053. return this.connector.presenceChannel(channel);
  19054. }
  19055. /**
  19056. * Leave the given channel, as well as its private and presence variants.
  19057. */
  19058. }, {
  19059. key: 'leave',
  19060. value: function leave(channel) {
  19061. this.connector.leave(channel);
  19062. }
  19063. /**
  19064. * Leave the given channel.
  19065. */
  19066. }, {
  19067. key: 'leaveChannel',
  19068. value: function leaveChannel(channel) {
  19069. this.connector.leaveChannel(channel);
  19070. }
  19071. /**
  19072. * Listen for an event on a channel instance.
  19073. */
  19074. }, {
  19075. key: 'listen',
  19076. value: function listen(channel, event, callback) {
  19077. return this.connector.listen(channel, event, callback);
  19078. }
  19079. /**
  19080. * Get a private channel instance by name.
  19081. */
  19082. }, {
  19083. key: 'private',
  19084. value: function _private(channel) {
  19085. return this.connector.privateChannel(channel);
  19086. }
  19087. /**
  19088. * Get the Socket ID for the connection.
  19089. */
  19090. }, {
  19091. key: 'socketId',
  19092. value: function socketId() {
  19093. return this.connector.socketId();
  19094. }
  19095. /**
  19096. * Register 3rd party request interceptiors. These are used to automatically
  19097. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19098. */
  19099. }, {
  19100. key: 'registerInterceptors',
  19101. value: function registerInterceptors() {
  19102. if (typeof Vue === 'function' && Vue.http) {
  19103. this.registerVueRequestInterceptor();
  19104. }
  19105. if (typeof axios === 'function') {
  19106. this.registerAxiosRequestInterceptor();
  19107. }
  19108. if (typeof jQuery === 'function') {
  19109. this.registerjQueryAjaxSetup();
  19110. }
  19111. }
  19112. /**
  19113. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19114. */
  19115. }, {
  19116. key: 'registerVueRequestInterceptor',
  19117. value: function registerVueRequestInterceptor() {
  19118. var _this = this;
  19119. Vue.http.interceptors.push(function (request, next) {
  19120. if (_this.socketId()) {
  19121. request.headers.set('X-Socket-ID', _this.socketId());
  19122. }
  19123. next();
  19124. });
  19125. }
  19126. /**
  19127. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19128. */
  19129. }, {
  19130. key: 'registerAxiosRequestInterceptor',
  19131. value: function registerAxiosRequestInterceptor() {
  19132. var _this2 = this;
  19133. axios.interceptors.request.use(function (config) {
  19134. if (_this2.socketId()) {
  19135. config.headers['X-Socket-Id'] = _this2.socketId();
  19136. }
  19137. return config;
  19138. });
  19139. }
  19140. /**
  19141. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19142. */
  19143. }, {
  19144. key: 'registerjQueryAjaxSetup',
  19145. value: function registerjQueryAjaxSetup() {
  19146. var _this3 = this;
  19147. if (typeof jQuery.ajax != 'undefined') {
  19148. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19149. if (_this3.socketId()) {
  19150. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19151. }
  19152. });
  19153. }
  19154. }
  19155. }]);
  19156. return Echo;
  19157. }();
  19158. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19159. /***/ }),
  19160. /***/ "./node_modules/lodash/lodash.js":
  19161. /*!***************************************!*\
  19162. !*** ./node_modules/lodash/lodash.js ***!
  19163. \***************************************/
  19164. /*! no static exports found */
  19165. /***/ (function(module, exports, __webpack_require__) {
  19166. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19167. * @license
  19168. * Lodash <https://lodash.com/>
  19169. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19170. * Released under MIT license <https://lodash.com/license>
  19171. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19172. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19173. */
  19174. ;(function() {
  19175. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19176. var undefined;
  19177. /** Used as the semantic version number. */
  19178. var VERSION = '4.17.15';
  19179. /** Used as the size to enable large array optimizations. */
  19180. var LARGE_ARRAY_SIZE = 200;
  19181. /** Error message constants. */
  19182. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19183. FUNC_ERROR_TEXT = 'Expected a function';
  19184. /** Used to stand-in for `undefined` hash values. */
  19185. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19186. /** Used as the maximum memoize cache size. */
  19187. var MAX_MEMOIZE_SIZE = 500;
  19188. /** Used as the internal argument placeholder. */
  19189. var PLACEHOLDER = '__lodash_placeholder__';
  19190. /** Used to compose bitmasks for cloning. */
  19191. var CLONE_DEEP_FLAG = 1,
  19192. CLONE_FLAT_FLAG = 2,
  19193. CLONE_SYMBOLS_FLAG = 4;
  19194. /** Used to compose bitmasks for value comparisons. */
  19195. var COMPARE_PARTIAL_FLAG = 1,
  19196. COMPARE_UNORDERED_FLAG = 2;
  19197. /** Used to compose bitmasks for function metadata. */
  19198. var WRAP_BIND_FLAG = 1,
  19199. WRAP_BIND_KEY_FLAG = 2,
  19200. WRAP_CURRY_BOUND_FLAG = 4,
  19201. WRAP_CURRY_FLAG = 8,
  19202. WRAP_CURRY_RIGHT_FLAG = 16,
  19203. WRAP_PARTIAL_FLAG = 32,
  19204. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19205. WRAP_ARY_FLAG = 128,
  19206. WRAP_REARG_FLAG = 256,
  19207. WRAP_FLIP_FLAG = 512;
  19208. /** Used as default options for `_.truncate`. */
  19209. var DEFAULT_TRUNC_LENGTH = 30,
  19210. DEFAULT_TRUNC_OMISSION = '...';
  19211. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19212. var HOT_COUNT = 800,
  19213. HOT_SPAN = 16;
  19214. /** Used to indicate the type of lazy iteratees. */
  19215. var LAZY_FILTER_FLAG = 1,
  19216. LAZY_MAP_FLAG = 2,
  19217. LAZY_WHILE_FLAG = 3;
  19218. /** Used as references for various `Number` constants. */
  19219. var INFINITY = 1 / 0,
  19220. MAX_SAFE_INTEGER = 9007199254740991,
  19221. MAX_INTEGER = 1.7976931348623157e+308,
  19222. NAN = 0 / 0;
  19223. /** Used as references for the maximum length and index of an array. */
  19224. var MAX_ARRAY_LENGTH = 4294967295,
  19225. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19226. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19227. /** Used to associate wrap methods with their bit flags. */
  19228. var wrapFlags = [
  19229. ['ary', WRAP_ARY_FLAG],
  19230. ['bind', WRAP_BIND_FLAG],
  19231. ['bindKey', WRAP_BIND_KEY_FLAG],
  19232. ['curry', WRAP_CURRY_FLAG],
  19233. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19234. ['flip', WRAP_FLIP_FLAG],
  19235. ['partial', WRAP_PARTIAL_FLAG],
  19236. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19237. ['rearg', WRAP_REARG_FLAG]
  19238. ];
  19239. /** `Object#toString` result references. */
  19240. var argsTag = '[object Arguments]',
  19241. arrayTag = '[object Array]',
  19242. asyncTag = '[object AsyncFunction]',
  19243. boolTag = '[object Boolean]',
  19244. dateTag = '[object Date]',
  19245. domExcTag = '[object DOMException]',
  19246. errorTag = '[object Error]',
  19247. funcTag = '[object Function]',
  19248. genTag = '[object GeneratorFunction]',
  19249. mapTag = '[object Map]',
  19250. numberTag = '[object Number]',
  19251. nullTag = '[object Null]',
  19252. objectTag = '[object Object]',
  19253. promiseTag = '[object Promise]',
  19254. proxyTag = '[object Proxy]',
  19255. regexpTag = '[object RegExp]',
  19256. setTag = '[object Set]',
  19257. stringTag = '[object String]',
  19258. symbolTag = '[object Symbol]',
  19259. undefinedTag = '[object Undefined]',
  19260. weakMapTag = '[object WeakMap]',
  19261. weakSetTag = '[object WeakSet]';
  19262. var arrayBufferTag = '[object ArrayBuffer]',
  19263. dataViewTag = '[object DataView]',
  19264. float32Tag = '[object Float32Array]',
  19265. float64Tag = '[object Float64Array]',
  19266. int8Tag = '[object Int8Array]',
  19267. int16Tag = '[object Int16Array]',
  19268. int32Tag = '[object Int32Array]',
  19269. uint8Tag = '[object Uint8Array]',
  19270. uint8ClampedTag = '[object Uint8ClampedArray]',
  19271. uint16Tag = '[object Uint16Array]',
  19272. uint32Tag = '[object Uint32Array]';
  19273. /** Used to match empty string literals in compiled template source. */
  19274. var reEmptyStringLeading = /\b__p \+= '';/g,
  19275. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19276. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19277. /** Used to match HTML entities and HTML characters. */
  19278. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19279. reUnescapedHtml = /[&<>"']/g,
  19280. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19281. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19282. /** Used to match template delimiters. */
  19283. var reEscape = /<%-([\s\S]+?)%>/g,
  19284. reEvaluate = /<%([\s\S]+?)%>/g,
  19285. reInterpolate = /<%=([\s\S]+?)%>/g;
  19286. /** Used to match property names within property paths. */
  19287. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19288. reIsPlainProp = /^\w*$/,
  19289. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19290. /**
  19291. * Used to match `RegExp`
  19292. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19293. */
  19294. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19295. reHasRegExpChar = RegExp(reRegExpChar.source);
  19296. /** Used to match leading and trailing whitespace. */
  19297. var reTrim = /^\s+|\s+$/g,
  19298. reTrimStart = /^\s+/,
  19299. reTrimEnd = /\s+$/;
  19300. /** Used to match wrap detail comments. */
  19301. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19302. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19303. reSplitDetails = /,? & /;
  19304. /** Used to match words composed of alphanumeric characters. */
  19305. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19306. /** Used to match backslashes in property paths. */
  19307. var reEscapeChar = /\\(\\)?/g;
  19308. /**
  19309. * Used to match
  19310. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19311. */
  19312. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19313. /** Used to match `RegExp` flags from their coerced string values. */
  19314. var reFlags = /\w*$/;
  19315. /** Used to detect bad signed hexadecimal string values. */
  19316. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19317. /** Used to detect binary string values. */
  19318. var reIsBinary = /^0b[01]+$/i;
  19319. /** Used to detect host constructors (Safari). */
  19320. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19321. /** Used to detect octal string values. */
  19322. var reIsOctal = /^0o[0-7]+$/i;
  19323. /** Used to detect unsigned integer values. */
  19324. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19325. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19326. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19327. /** Used to ensure capturing order of template delimiters. */
  19328. var reNoMatch = /($^)/;
  19329. /** Used to match unescaped characters in compiled string literals. */
  19330. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19331. /** Used to compose unicode character classes. */
  19332. var rsAstralRange = '\\ud800-\\udfff',
  19333. rsComboMarksRange = '\\u0300-\\u036f',
  19334. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19335. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19336. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19337. rsDingbatRange = '\\u2700-\\u27bf',
  19338. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19339. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19340. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19341. rsPunctuationRange = '\\u2000-\\u206f',
  19342. 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',
  19343. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19344. rsVarRange = '\\ufe0e\\ufe0f',
  19345. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19346. /** Used to compose unicode capture groups. */
  19347. var rsApos = "['\u2019]",
  19348. rsAstral = '[' + rsAstralRange + ']',
  19349. rsBreak = '[' + rsBreakRange + ']',
  19350. rsCombo = '[' + rsComboRange + ']',
  19351. rsDigits = '\\d+',
  19352. rsDingbat = '[' + rsDingbatRange + ']',
  19353. rsLower = '[' + rsLowerRange + ']',
  19354. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19355. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19356. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19357. rsNonAstral = '[^' + rsAstralRange + ']',
  19358. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19359. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19360. rsUpper = '[' + rsUpperRange + ']',
  19361. rsZWJ = '\\u200d';
  19362. /** Used to compose unicode regexes. */
  19363. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19364. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19365. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19366. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19367. reOptMod = rsModifier + '?',
  19368. rsOptVar = '[' + rsVarRange + ']?',
  19369. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19370. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19371. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19372. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19373. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19374. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19375. /** Used to match apostrophes. */
  19376. var reApos = RegExp(rsApos, 'g');
  19377. /**
  19378. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19379. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19380. */
  19381. var reComboMark = RegExp(rsCombo, 'g');
  19382. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19383. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19384. /** Used to match complex or compound words. */
  19385. var reUnicodeWord = RegExp([
  19386. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19387. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19388. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19389. rsUpper + '+' + rsOptContrUpper,
  19390. rsOrdUpper,
  19391. rsOrdLower,
  19392. rsDigits,
  19393. rsEmoji
  19394. ].join('|'), 'g');
  19395. /** 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/). */
  19396. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19397. /** Used to detect strings that need a more robust regexp to match words. */
  19398. 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 ]/;
  19399. /** Used to assign default `context` object properties. */
  19400. var contextProps = [
  19401. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19402. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19403. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19404. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19405. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19406. ];
  19407. /** Used to make template sourceURLs easier to identify. */
  19408. var templateCounter = -1;
  19409. /** Used to identify `toStringTag` values of typed arrays. */
  19410. var typedArrayTags = {};
  19411. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19412. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19413. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19414. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19415. typedArrayTags[uint32Tag] = true;
  19416. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19417. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19418. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19419. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19420. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19421. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19422. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19423. typedArrayTags[weakMapTag] = false;
  19424. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19425. var cloneableTags = {};
  19426. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19427. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19428. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19429. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19430. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19431. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19432. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19433. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19434. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19435. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19436. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19437. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19438. cloneableTags[weakMapTag] = false;
  19439. /** Used to map Latin Unicode letters to basic Latin letters. */
  19440. var deburredLetters = {
  19441. // Latin-1 Supplement block.
  19442. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19443. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19444. '\xc7': 'C', '\xe7': 'c',
  19445. '\xd0': 'D', '\xf0': 'd',
  19446. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19447. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19448. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19449. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19450. '\xd1': 'N', '\xf1': 'n',
  19451. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19452. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19453. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19454. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19455. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19456. '\xc6': 'Ae', '\xe6': 'ae',
  19457. '\xde': 'Th', '\xfe': 'th',
  19458. '\xdf': 'ss',
  19459. // Latin Extended-A block.
  19460. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19461. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19462. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19463. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19464. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19465. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19466. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19467. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19468. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19469. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19470. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19471. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19472. '\u0134': 'J', '\u0135': 'j',
  19473. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19474. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19475. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19476. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19477. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19478. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19479. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19480. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19481. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19482. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19483. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19484. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19485. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19486. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19487. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19488. '\u0174': 'W', '\u0175': 'w',
  19489. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19490. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19491. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19492. '\u0132': 'IJ', '\u0133': 'ij',
  19493. '\u0152': 'Oe', '\u0153': 'oe',
  19494. '\u0149': "'n", '\u017f': 's'
  19495. };
  19496. /** Used to map characters to HTML entities. */
  19497. var htmlEscapes = {
  19498. '&': '&amp;',
  19499. '<': '&lt;',
  19500. '>': '&gt;',
  19501. '"': '&quot;',
  19502. "'": '&#39;'
  19503. };
  19504. /** Used to map HTML entities to characters. */
  19505. var htmlUnescapes = {
  19506. '&amp;': '&',
  19507. '&lt;': '<',
  19508. '&gt;': '>',
  19509. '&quot;': '"',
  19510. '&#39;': "'"
  19511. };
  19512. /** Used to escape characters for inclusion in compiled string literals. */
  19513. var stringEscapes = {
  19514. '\\': '\\',
  19515. "'": "'",
  19516. '\n': 'n',
  19517. '\r': 'r',
  19518. '\u2028': 'u2028',
  19519. '\u2029': 'u2029'
  19520. };
  19521. /** Built-in method references without a dependency on `root`. */
  19522. var freeParseFloat = parseFloat,
  19523. freeParseInt = parseInt;
  19524. /** Detect free variable `global` from Node.js. */
  19525. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19526. /** Detect free variable `self`. */
  19527. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19528. /** Used as a reference to the global object. */
  19529. var root = freeGlobal || freeSelf || Function('return this')();
  19530. /** Detect free variable `exports`. */
  19531. var freeExports = true && exports && !exports.nodeType && exports;
  19532. /** Detect free variable `module`. */
  19533. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19534. /** Detect the popular CommonJS extension `module.exports`. */
  19535. var moduleExports = freeModule && freeModule.exports === freeExports;
  19536. /** Detect free variable `process` from Node.js. */
  19537. var freeProcess = moduleExports && freeGlobal.process;
  19538. /** Used to access faster Node.js helpers. */
  19539. var nodeUtil = (function() {
  19540. try {
  19541. // Use `util.types` for Node.js 10+.
  19542. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19543. if (types) {
  19544. return types;
  19545. }
  19546. // Legacy `process.binding('util')` for Node.js < 10.
  19547. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19548. } catch (e) {}
  19549. }());
  19550. /* Node.js helper references. */
  19551. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19552. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19553. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19554. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19555. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19556. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19557. /*--------------------------------------------------------------------------*/
  19558. /**
  19559. * A faster alternative to `Function#apply`, this function invokes `func`
  19560. * with the `this` binding of `thisArg` and the arguments of `args`.
  19561. *
  19562. * @private
  19563. * @param {Function} func The function to invoke.
  19564. * @param {*} thisArg The `this` binding of `func`.
  19565. * @param {Array} args The arguments to invoke `func` with.
  19566. * @returns {*} Returns the result of `func`.
  19567. */
  19568. function apply(func, thisArg, args) {
  19569. switch (args.length) {
  19570. case 0: return func.call(thisArg);
  19571. case 1: return func.call(thisArg, args[0]);
  19572. case 2: return func.call(thisArg, args[0], args[1]);
  19573. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19574. }
  19575. return func.apply(thisArg, args);
  19576. }
  19577. /**
  19578. * A specialized version of `baseAggregator` for arrays.
  19579. *
  19580. * @private
  19581. * @param {Array} [array] The array to iterate over.
  19582. * @param {Function} setter The function to set `accumulator` values.
  19583. * @param {Function} iteratee The iteratee to transform keys.
  19584. * @param {Object} accumulator The initial aggregated object.
  19585. * @returns {Function} Returns `accumulator`.
  19586. */
  19587. function arrayAggregator(array, setter, iteratee, accumulator) {
  19588. var index = -1,
  19589. length = array == null ? 0 : array.length;
  19590. while (++index < length) {
  19591. var value = array[index];
  19592. setter(accumulator, value, iteratee(value), array);
  19593. }
  19594. return accumulator;
  19595. }
  19596. /**
  19597. * A specialized version of `_.forEach` for arrays without support for
  19598. * iteratee shorthands.
  19599. *
  19600. * @private
  19601. * @param {Array} [array] The array to iterate over.
  19602. * @param {Function} iteratee The function invoked per iteration.
  19603. * @returns {Array} Returns `array`.
  19604. */
  19605. function arrayEach(array, iteratee) {
  19606. var index = -1,
  19607. length = array == null ? 0 : array.length;
  19608. while (++index < length) {
  19609. if (iteratee(array[index], index, array) === false) {
  19610. break;
  19611. }
  19612. }
  19613. return array;
  19614. }
  19615. /**
  19616. * A specialized version of `_.forEachRight` for arrays without support for
  19617. * iteratee shorthands.
  19618. *
  19619. * @private
  19620. * @param {Array} [array] The array to iterate over.
  19621. * @param {Function} iteratee The function invoked per iteration.
  19622. * @returns {Array} Returns `array`.
  19623. */
  19624. function arrayEachRight(array, iteratee) {
  19625. var length = array == null ? 0 : array.length;
  19626. while (length--) {
  19627. if (iteratee(array[length], length, array) === false) {
  19628. break;
  19629. }
  19630. }
  19631. return array;
  19632. }
  19633. /**
  19634. * A specialized version of `_.every` for arrays without support for
  19635. * iteratee shorthands.
  19636. *
  19637. * @private
  19638. * @param {Array} [array] The array to iterate over.
  19639. * @param {Function} predicate The function invoked per iteration.
  19640. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19641. * else `false`.
  19642. */
  19643. function arrayEvery(array, predicate) {
  19644. var index = -1,
  19645. length = array == null ? 0 : array.length;
  19646. while (++index < length) {
  19647. if (!predicate(array[index], index, array)) {
  19648. return false;
  19649. }
  19650. }
  19651. return true;
  19652. }
  19653. /**
  19654. * A specialized version of `_.filter` for arrays without support for
  19655. * iteratee shorthands.
  19656. *
  19657. * @private
  19658. * @param {Array} [array] The array to iterate over.
  19659. * @param {Function} predicate The function invoked per iteration.
  19660. * @returns {Array} Returns the new filtered array.
  19661. */
  19662. function arrayFilter(array, predicate) {
  19663. var index = -1,
  19664. length = array == null ? 0 : array.length,
  19665. resIndex = 0,
  19666. result = [];
  19667. while (++index < length) {
  19668. var value = array[index];
  19669. if (predicate(value, index, array)) {
  19670. result[resIndex++] = value;
  19671. }
  19672. }
  19673. return result;
  19674. }
  19675. /**
  19676. * A specialized version of `_.includes` for arrays without support for
  19677. * specifying an index to search from.
  19678. *
  19679. * @private
  19680. * @param {Array} [array] The array to inspect.
  19681. * @param {*} target The value to search for.
  19682. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19683. */
  19684. function arrayIncludes(array, value) {
  19685. var length = array == null ? 0 : array.length;
  19686. return !!length && baseIndexOf(array, value, 0) > -1;
  19687. }
  19688. /**
  19689. * This function is like `arrayIncludes` except that it accepts a comparator.
  19690. *
  19691. * @private
  19692. * @param {Array} [array] The array to inspect.
  19693. * @param {*} target The value to search for.
  19694. * @param {Function} comparator The comparator invoked per element.
  19695. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19696. */
  19697. function arrayIncludesWith(array, value, comparator) {
  19698. var index = -1,
  19699. length = array == null ? 0 : array.length;
  19700. while (++index < length) {
  19701. if (comparator(value, array[index])) {
  19702. return true;
  19703. }
  19704. }
  19705. return false;
  19706. }
  19707. /**
  19708. * A specialized version of `_.map` for arrays without support for iteratee
  19709. * shorthands.
  19710. *
  19711. * @private
  19712. * @param {Array} [array] The array to iterate over.
  19713. * @param {Function} iteratee The function invoked per iteration.
  19714. * @returns {Array} Returns the new mapped array.
  19715. */
  19716. function arrayMap(array, iteratee) {
  19717. var index = -1,
  19718. length = array == null ? 0 : array.length,
  19719. result = Array(length);
  19720. while (++index < length) {
  19721. result[index] = iteratee(array[index], index, array);
  19722. }
  19723. return result;
  19724. }
  19725. /**
  19726. * Appends the elements of `values` to `array`.
  19727. *
  19728. * @private
  19729. * @param {Array} array The array to modify.
  19730. * @param {Array} values The values to append.
  19731. * @returns {Array} Returns `array`.
  19732. */
  19733. function arrayPush(array, values) {
  19734. var index = -1,
  19735. length = values.length,
  19736. offset = array.length;
  19737. while (++index < length) {
  19738. array[offset + index] = values[index];
  19739. }
  19740. return array;
  19741. }
  19742. /**
  19743. * A specialized version of `_.reduce` for arrays without support for
  19744. * iteratee shorthands.
  19745. *
  19746. * @private
  19747. * @param {Array} [array] The array to iterate over.
  19748. * @param {Function} iteratee The function invoked per iteration.
  19749. * @param {*} [accumulator] The initial value.
  19750. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19751. * the initial value.
  19752. * @returns {*} Returns the accumulated value.
  19753. */
  19754. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19755. var index = -1,
  19756. length = array == null ? 0 : array.length;
  19757. if (initAccum && length) {
  19758. accumulator = array[++index];
  19759. }
  19760. while (++index < length) {
  19761. accumulator = iteratee(accumulator, array[index], index, array);
  19762. }
  19763. return accumulator;
  19764. }
  19765. /**
  19766. * A specialized version of `_.reduceRight` for arrays without support for
  19767. * iteratee shorthands.
  19768. *
  19769. * @private
  19770. * @param {Array} [array] The array to iterate over.
  19771. * @param {Function} iteratee The function invoked per iteration.
  19772. * @param {*} [accumulator] The initial value.
  19773. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19774. * the initial value.
  19775. * @returns {*} Returns the accumulated value.
  19776. */
  19777. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19778. var length = array == null ? 0 : array.length;
  19779. if (initAccum && length) {
  19780. accumulator = array[--length];
  19781. }
  19782. while (length--) {
  19783. accumulator = iteratee(accumulator, array[length], length, array);
  19784. }
  19785. return accumulator;
  19786. }
  19787. /**
  19788. * A specialized version of `_.some` for arrays without support for iteratee
  19789. * shorthands.
  19790. *
  19791. * @private
  19792. * @param {Array} [array] The array to iterate over.
  19793. * @param {Function} predicate The function invoked per iteration.
  19794. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19795. * else `false`.
  19796. */
  19797. function arraySome(array, predicate) {
  19798. var index = -1,
  19799. length = array == null ? 0 : array.length;
  19800. while (++index < length) {
  19801. if (predicate(array[index], index, array)) {
  19802. return true;
  19803. }
  19804. }
  19805. return false;
  19806. }
  19807. /**
  19808. * Gets the size of an ASCII `string`.
  19809. *
  19810. * @private
  19811. * @param {string} string The string inspect.
  19812. * @returns {number} Returns the string size.
  19813. */
  19814. var asciiSize = baseProperty('length');
  19815. /**
  19816. * Converts an ASCII `string` to an array.
  19817. *
  19818. * @private
  19819. * @param {string} string The string to convert.
  19820. * @returns {Array} Returns the converted array.
  19821. */
  19822. function asciiToArray(string) {
  19823. return string.split('');
  19824. }
  19825. /**
  19826. * Splits an ASCII `string` into an array of its words.
  19827. *
  19828. * @private
  19829. * @param {string} The string to inspect.
  19830. * @returns {Array} Returns the words of `string`.
  19831. */
  19832. function asciiWords(string) {
  19833. return string.match(reAsciiWord) || [];
  19834. }
  19835. /**
  19836. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19837. * without support for iteratee shorthands, which iterates over `collection`
  19838. * using `eachFunc`.
  19839. *
  19840. * @private
  19841. * @param {Array|Object} collection The collection to inspect.
  19842. * @param {Function} predicate The function invoked per iteration.
  19843. * @param {Function} eachFunc The function to iterate over `collection`.
  19844. * @returns {*} Returns the found element or its key, else `undefined`.
  19845. */
  19846. function baseFindKey(collection, predicate, eachFunc) {
  19847. var result;
  19848. eachFunc(collection, function(value, key, collection) {
  19849. if (predicate(value, key, collection)) {
  19850. result = key;
  19851. return false;
  19852. }
  19853. });
  19854. return result;
  19855. }
  19856. /**
  19857. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19858. * support for iteratee shorthands.
  19859. *
  19860. * @private
  19861. * @param {Array} array The array to inspect.
  19862. * @param {Function} predicate The function invoked per iteration.
  19863. * @param {number} fromIndex The index to search from.
  19864. * @param {boolean} [fromRight] Specify iterating from right to left.
  19865. * @returns {number} Returns the index of the matched value, else `-1`.
  19866. */
  19867. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19868. var length = array.length,
  19869. index = fromIndex + (fromRight ? 1 : -1);
  19870. while ((fromRight ? index-- : ++index < length)) {
  19871. if (predicate(array[index], index, array)) {
  19872. return index;
  19873. }
  19874. }
  19875. return -1;
  19876. }
  19877. /**
  19878. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19879. *
  19880. * @private
  19881. * @param {Array} array The array to inspect.
  19882. * @param {*} value The value to search for.
  19883. * @param {number} fromIndex The index to search from.
  19884. * @returns {number} Returns the index of the matched value, else `-1`.
  19885. */
  19886. function baseIndexOf(array, value, fromIndex) {
  19887. return value === value
  19888. ? strictIndexOf(array, value, fromIndex)
  19889. : baseFindIndex(array, baseIsNaN, fromIndex);
  19890. }
  19891. /**
  19892. * This function is like `baseIndexOf` except that it accepts a comparator.
  19893. *
  19894. * @private
  19895. * @param {Array} array The array to inspect.
  19896. * @param {*} value The value to search for.
  19897. * @param {number} fromIndex The index to search from.
  19898. * @param {Function} comparator The comparator invoked per element.
  19899. * @returns {number} Returns the index of the matched value, else `-1`.
  19900. */
  19901. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19902. var index = fromIndex - 1,
  19903. length = array.length;
  19904. while (++index < length) {
  19905. if (comparator(array[index], value)) {
  19906. return index;
  19907. }
  19908. }
  19909. return -1;
  19910. }
  19911. /**
  19912. * The base implementation of `_.isNaN` without support for number objects.
  19913. *
  19914. * @private
  19915. * @param {*} value The value to check.
  19916. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19917. */
  19918. function baseIsNaN(value) {
  19919. return value !== value;
  19920. }
  19921. /**
  19922. * The base implementation of `_.mean` and `_.meanBy` without support for
  19923. * iteratee shorthands.
  19924. *
  19925. * @private
  19926. * @param {Array} array The array to iterate over.
  19927. * @param {Function} iteratee The function invoked per iteration.
  19928. * @returns {number} Returns the mean.
  19929. */
  19930. function baseMean(array, iteratee) {
  19931. var length = array == null ? 0 : array.length;
  19932. return length ? (baseSum(array, iteratee) / length) : NAN;
  19933. }
  19934. /**
  19935. * The base implementation of `_.property` without support for deep paths.
  19936. *
  19937. * @private
  19938. * @param {string} key The key of the property to get.
  19939. * @returns {Function} Returns the new accessor function.
  19940. */
  19941. function baseProperty(key) {
  19942. return function(object) {
  19943. return object == null ? undefined : object[key];
  19944. };
  19945. }
  19946. /**
  19947. * The base implementation of `_.propertyOf` without support for deep paths.
  19948. *
  19949. * @private
  19950. * @param {Object} object The object to query.
  19951. * @returns {Function} Returns the new accessor function.
  19952. */
  19953. function basePropertyOf(object) {
  19954. return function(key) {
  19955. return object == null ? undefined : object[key];
  19956. };
  19957. }
  19958. /**
  19959. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19960. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19961. *
  19962. * @private
  19963. * @param {Array|Object} collection The collection to iterate over.
  19964. * @param {Function} iteratee The function invoked per iteration.
  19965. * @param {*} accumulator The initial value.
  19966. * @param {boolean} initAccum Specify using the first or last element of
  19967. * `collection` as the initial value.
  19968. * @param {Function} eachFunc The function to iterate over `collection`.
  19969. * @returns {*} Returns the accumulated value.
  19970. */
  19971. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19972. eachFunc(collection, function(value, index, collection) {
  19973. accumulator = initAccum
  19974. ? (initAccum = false, value)
  19975. : iteratee(accumulator, value, index, collection);
  19976. });
  19977. return accumulator;
  19978. }
  19979. /**
  19980. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19981. * sort order of `array` and replaces criteria objects with their corresponding
  19982. * values.
  19983. *
  19984. * @private
  19985. * @param {Array} array The array to sort.
  19986. * @param {Function} comparer The function to define sort order.
  19987. * @returns {Array} Returns `array`.
  19988. */
  19989. function baseSortBy(array, comparer) {
  19990. var length = array.length;
  19991. array.sort(comparer);
  19992. while (length--) {
  19993. array[length] = array[length].value;
  19994. }
  19995. return array;
  19996. }
  19997. /**
  19998. * The base implementation of `_.sum` and `_.sumBy` without support for
  19999. * iteratee shorthands.
  20000. *
  20001. * @private
  20002. * @param {Array} array The array to iterate over.
  20003. * @param {Function} iteratee The function invoked per iteration.
  20004. * @returns {number} Returns the sum.
  20005. */
  20006. function baseSum(array, iteratee) {
  20007. var result,
  20008. index = -1,
  20009. length = array.length;
  20010. while (++index < length) {
  20011. var current = iteratee(array[index]);
  20012. if (current !== undefined) {
  20013. result = result === undefined ? current : (result + current);
  20014. }
  20015. }
  20016. return result;
  20017. }
  20018. /**
  20019. * The base implementation of `_.times` without support for iteratee shorthands
  20020. * or max array length checks.
  20021. *
  20022. * @private
  20023. * @param {number} n The number of times to invoke `iteratee`.
  20024. * @param {Function} iteratee The function invoked per iteration.
  20025. * @returns {Array} Returns the array of results.
  20026. */
  20027. function baseTimes(n, iteratee) {
  20028. var index = -1,
  20029. result = Array(n);
  20030. while (++index < n) {
  20031. result[index] = iteratee(index);
  20032. }
  20033. return result;
  20034. }
  20035. /**
  20036. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20037. * of key-value pairs for `object` corresponding to the property names of `props`.
  20038. *
  20039. * @private
  20040. * @param {Object} object The object to query.
  20041. * @param {Array} props The property names to get values for.
  20042. * @returns {Object} Returns the key-value pairs.
  20043. */
  20044. function baseToPairs(object, props) {
  20045. return arrayMap(props, function(key) {
  20046. return [key, object[key]];
  20047. });
  20048. }
  20049. /**
  20050. * The base implementation of `_.unary` without support for storing metadata.
  20051. *
  20052. * @private
  20053. * @param {Function} func The function to cap arguments for.
  20054. * @returns {Function} Returns the new capped function.
  20055. */
  20056. function baseUnary(func) {
  20057. return function(value) {
  20058. return func(value);
  20059. };
  20060. }
  20061. /**
  20062. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20063. * array of `object` property values corresponding to the property names
  20064. * of `props`.
  20065. *
  20066. * @private
  20067. * @param {Object} object The object to query.
  20068. * @param {Array} props The property names to get values for.
  20069. * @returns {Object} Returns the array of property values.
  20070. */
  20071. function baseValues(object, props) {
  20072. return arrayMap(props, function(key) {
  20073. return object[key];
  20074. });
  20075. }
  20076. /**
  20077. * Checks if a `cache` value for `key` exists.
  20078. *
  20079. * @private
  20080. * @param {Object} cache The cache to query.
  20081. * @param {string} key The key of the entry to check.
  20082. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20083. */
  20084. function cacheHas(cache, key) {
  20085. return cache.has(key);
  20086. }
  20087. /**
  20088. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20089. * that is not found in the character symbols.
  20090. *
  20091. * @private
  20092. * @param {Array} strSymbols The string symbols to inspect.
  20093. * @param {Array} chrSymbols The character symbols to find.
  20094. * @returns {number} Returns the index of the first unmatched string symbol.
  20095. */
  20096. function charsStartIndex(strSymbols, chrSymbols) {
  20097. var index = -1,
  20098. length = strSymbols.length;
  20099. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20100. return index;
  20101. }
  20102. /**
  20103. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20104. * that is not found in the character symbols.
  20105. *
  20106. * @private
  20107. * @param {Array} strSymbols The string symbols to inspect.
  20108. * @param {Array} chrSymbols The character symbols to find.
  20109. * @returns {number} Returns the index of the last unmatched string symbol.
  20110. */
  20111. function charsEndIndex(strSymbols, chrSymbols) {
  20112. var index = strSymbols.length;
  20113. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20114. return index;
  20115. }
  20116. /**
  20117. * Gets the number of `placeholder` occurrences in `array`.
  20118. *
  20119. * @private
  20120. * @param {Array} array The array to inspect.
  20121. * @param {*} placeholder The placeholder to search for.
  20122. * @returns {number} Returns the placeholder count.
  20123. */
  20124. function countHolders(array, placeholder) {
  20125. var length = array.length,
  20126. result = 0;
  20127. while (length--) {
  20128. if (array[length] === placeholder) {
  20129. ++result;
  20130. }
  20131. }
  20132. return result;
  20133. }
  20134. /**
  20135. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20136. * letters to basic Latin letters.
  20137. *
  20138. * @private
  20139. * @param {string} letter The matched letter to deburr.
  20140. * @returns {string} Returns the deburred letter.
  20141. */
  20142. var deburrLetter = basePropertyOf(deburredLetters);
  20143. /**
  20144. * Used by `_.escape` to convert characters to HTML entities.
  20145. *
  20146. * @private
  20147. * @param {string} chr The matched character to escape.
  20148. * @returns {string} Returns the escaped character.
  20149. */
  20150. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20151. /**
  20152. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20153. *
  20154. * @private
  20155. * @param {string} chr The matched character to escape.
  20156. * @returns {string} Returns the escaped character.
  20157. */
  20158. function escapeStringChar(chr) {
  20159. return '\\' + stringEscapes[chr];
  20160. }
  20161. /**
  20162. * Gets the value at `key` of `object`.
  20163. *
  20164. * @private
  20165. * @param {Object} [object] The object to query.
  20166. * @param {string} key The key of the property to get.
  20167. * @returns {*} Returns the property value.
  20168. */
  20169. function getValue(object, key) {
  20170. return object == null ? undefined : object[key];
  20171. }
  20172. /**
  20173. * Checks if `string` contains Unicode symbols.
  20174. *
  20175. * @private
  20176. * @param {string} string The string to inspect.
  20177. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20178. */
  20179. function hasUnicode(string) {
  20180. return reHasUnicode.test(string);
  20181. }
  20182. /**
  20183. * Checks if `string` contains a word composed of Unicode symbols.
  20184. *
  20185. * @private
  20186. * @param {string} string The string to inspect.
  20187. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20188. */
  20189. function hasUnicodeWord(string) {
  20190. return reHasUnicodeWord.test(string);
  20191. }
  20192. /**
  20193. * Converts `iterator` to an array.
  20194. *
  20195. * @private
  20196. * @param {Object} iterator The iterator to convert.
  20197. * @returns {Array} Returns the converted array.
  20198. */
  20199. function iteratorToArray(iterator) {
  20200. var data,
  20201. result = [];
  20202. while (!(data = iterator.next()).done) {
  20203. result.push(data.value);
  20204. }
  20205. return result;
  20206. }
  20207. /**
  20208. * Converts `map` to its key-value pairs.
  20209. *
  20210. * @private
  20211. * @param {Object} map The map to convert.
  20212. * @returns {Array} Returns the key-value pairs.
  20213. */
  20214. function mapToArray(map) {
  20215. var index = -1,
  20216. result = Array(map.size);
  20217. map.forEach(function(value, key) {
  20218. result[++index] = [key, value];
  20219. });
  20220. return result;
  20221. }
  20222. /**
  20223. * Creates a unary function that invokes `func` with its argument transformed.
  20224. *
  20225. * @private
  20226. * @param {Function} func The function to wrap.
  20227. * @param {Function} transform The argument transform.
  20228. * @returns {Function} Returns the new function.
  20229. */
  20230. function overArg(func, transform) {
  20231. return function(arg) {
  20232. return func(transform(arg));
  20233. };
  20234. }
  20235. /**
  20236. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20237. * and returns an array of their indexes.
  20238. *
  20239. * @private
  20240. * @param {Array} array The array to modify.
  20241. * @param {*} placeholder The placeholder to replace.
  20242. * @returns {Array} Returns the new array of placeholder indexes.
  20243. */
  20244. function replaceHolders(array, placeholder) {
  20245. var index = -1,
  20246. length = array.length,
  20247. resIndex = 0,
  20248. result = [];
  20249. while (++index < length) {
  20250. var value = array[index];
  20251. if (value === placeholder || value === PLACEHOLDER) {
  20252. array[index] = PLACEHOLDER;
  20253. result[resIndex++] = index;
  20254. }
  20255. }
  20256. return result;
  20257. }
  20258. /**
  20259. * Converts `set` to an array of its values.
  20260. *
  20261. * @private
  20262. * @param {Object} set The set to convert.
  20263. * @returns {Array} Returns the values.
  20264. */
  20265. function setToArray(set) {
  20266. var index = -1,
  20267. result = Array(set.size);
  20268. set.forEach(function(value) {
  20269. result[++index] = value;
  20270. });
  20271. return result;
  20272. }
  20273. /**
  20274. * Converts `set` to its value-value pairs.
  20275. *
  20276. * @private
  20277. * @param {Object} set The set to convert.
  20278. * @returns {Array} Returns the value-value pairs.
  20279. */
  20280. function setToPairs(set) {
  20281. var index = -1,
  20282. result = Array(set.size);
  20283. set.forEach(function(value) {
  20284. result[++index] = [value, value];
  20285. });
  20286. return result;
  20287. }
  20288. /**
  20289. * A specialized version of `_.indexOf` which performs strict equality
  20290. * comparisons of values, i.e. `===`.
  20291. *
  20292. * @private
  20293. * @param {Array} array The array to inspect.
  20294. * @param {*} value The value to search for.
  20295. * @param {number} fromIndex The index to search from.
  20296. * @returns {number} Returns the index of the matched value, else `-1`.
  20297. */
  20298. function strictIndexOf(array, value, fromIndex) {
  20299. var index = fromIndex - 1,
  20300. length = array.length;
  20301. while (++index < length) {
  20302. if (array[index] === value) {
  20303. return index;
  20304. }
  20305. }
  20306. return -1;
  20307. }
  20308. /**
  20309. * A specialized version of `_.lastIndexOf` which performs strict equality
  20310. * comparisons of values, i.e. `===`.
  20311. *
  20312. * @private
  20313. * @param {Array} array The array to inspect.
  20314. * @param {*} value The value to search for.
  20315. * @param {number} fromIndex The index to search from.
  20316. * @returns {number} Returns the index of the matched value, else `-1`.
  20317. */
  20318. function strictLastIndexOf(array, value, fromIndex) {
  20319. var index = fromIndex + 1;
  20320. while (index--) {
  20321. if (array[index] === value) {
  20322. return index;
  20323. }
  20324. }
  20325. return index;
  20326. }
  20327. /**
  20328. * Gets the number of symbols in `string`.
  20329. *
  20330. * @private
  20331. * @param {string} string The string to inspect.
  20332. * @returns {number} Returns the string size.
  20333. */
  20334. function stringSize(string) {
  20335. return hasUnicode(string)
  20336. ? unicodeSize(string)
  20337. : asciiSize(string);
  20338. }
  20339. /**
  20340. * Converts `string` to an array.
  20341. *
  20342. * @private
  20343. * @param {string} string The string to convert.
  20344. * @returns {Array} Returns the converted array.
  20345. */
  20346. function stringToArray(string) {
  20347. return hasUnicode(string)
  20348. ? unicodeToArray(string)
  20349. : asciiToArray(string);
  20350. }
  20351. /**
  20352. * Used by `_.unescape` to convert HTML entities to characters.
  20353. *
  20354. * @private
  20355. * @param {string} chr The matched character to unescape.
  20356. * @returns {string} Returns the unescaped character.
  20357. */
  20358. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20359. /**
  20360. * Gets the size of a Unicode `string`.
  20361. *
  20362. * @private
  20363. * @param {string} string The string inspect.
  20364. * @returns {number} Returns the string size.
  20365. */
  20366. function unicodeSize(string) {
  20367. var result = reUnicode.lastIndex = 0;
  20368. while (reUnicode.test(string)) {
  20369. ++result;
  20370. }
  20371. return result;
  20372. }
  20373. /**
  20374. * Converts a Unicode `string` to an array.
  20375. *
  20376. * @private
  20377. * @param {string} string The string to convert.
  20378. * @returns {Array} Returns the converted array.
  20379. */
  20380. function unicodeToArray(string) {
  20381. return string.match(reUnicode) || [];
  20382. }
  20383. /**
  20384. * Splits a Unicode `string` into an array of its words.
  20385. *
  20386. * @private
  20387. * @param {string} The string to inspect.
  20388. * @returns {Array} Returns the words of `string`.
  20389. */
  20390. function unicodeWords(string) {
  20391. return string.match(reUnicodeWord) || [];
  20392. }
  20393. /*--------------------------------------------------------------------------*/
  20394. /**
  20395. * Create a new pristine `lodash` function using the `context` object.
  20396. *
  20397. * @static
  20398. * @memberOf _
  20399. * @since 1.1.0
  20400. * @category Util
  20401. * @param {Object} [context=root] The context object.
  20402. * @returns {Function} Returns a new `lodash` function.
  20403. * @example
  20404. *
  20405. * _.mixin({ 'foo': _.constant('foo') });
  20406. *
  20407. * var lodash = _.runInContext();
  20408. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20409. *
  20410. * _.isFunction(_.foo);
  20411. * // => true
  20412. * _.isFunction(_.bar);
  20413. * // => false
  20414. *
  20415. * lodash.isFunction(lodash.foo);
  20416. * // => false
  20417. * lodash.isFunction(lodash.bar);
  20418. * // => true
  20419. *
  20420. * // Create a suped-up `defer` in Node.js.
  20421. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20422. */
  20423. var runInContext = (function runInContext(context) {
  20424. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20425. /** Built-in constructor references. */
  20426. var Array = context.Array,
  20427. Date = context.Date,
  20428. Error = context.Error,
  20429. Function = context.Function,
  20430. Math = context.Math,
  20431. Object = context.Object,
  20432. RegExp = context.RegExp,
  20433. String = context.String,
  20434. TypeError = context.TypeError;
  20435. /** Used for built-in method references. */
  20436. var arrayProto = Array.prototype,
  20437. funcProto = Function.prototype,
  20438. objectProto = Object.prototype;
  20439. /** Used to detect overreaching core-js shims. */
  20440. var coreJsData = context['__core-js_shared__'];
  20441. /** Used to resolve the decompiled source of functions. */
  20442. var funcToString = funcProto.toString;
  20443. /** Used to check objects for own properties. */
  20444. var hasOwnProperty = objectProto.hasOwnProperty;
  20445. /** Used to generate unique IDs. */
  20446. var idCounter = 0;
  20447. /** Used to detect methods masquerading as native. */
  20448. var maskSrcKey = (function() {
  20449. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20450. return uid ? ('Symbol(src)_1.' + uid) : '';
  20451. }());
  20452. /**
  20453. * Used to resolve the
  20454. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20455. * of values.
  20456. */
  20457. var nativeObjectToString = objectProto.toString;
  20458. /** Used to infer the `Object` constructor. */
  20459. var objectCtorString = funcToString.call(Object);
  20460. /** Used to restore the original `_` reference in `_.noConflict`. */
  20461. var oldDash = root._;
  20462. /** Used to detect if a method is native. */
  20463. var reIsNative = RegExp('^' +
  20464. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20465. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20466. );
  20467. /** Built-in value references. */
  20468. var Buffer = moduleExports ? context.Buffer : undefined,
  20469. Symbol = context.Symbol,
  20470. Uint8Array = context.Uint8Array,
  20471. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20472. getPrototype = overArg(Object.getPrototypeOf, Object),
  20473. objectCreate = Object.create,
  20474. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20475. splice = arrayProto.splice,
  20476. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20477. symIterator = Symbol ? Symbol.iterator : undefined,
  20478. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20479. var defineProperty = (function() {
  20480. try {
  20481. var func = getNative(Object, 'defineProperty');
  20482. func({}, '', {});
  20483. return func;
  20484. } catch (e) {}
  20485. }());
  20486. /** Mocked built-ins. */
  20487. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20488. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20489. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20490. /* Built-in method references for those with the same name as other `lodash` methods. */
  20491. var nativeCeil = Math.ceil,
  20492. nativeFloor = Math.floor,
  20493. nativeGetSymbols = Object.getOwnPropertySymbols,
  20494. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20495. nativeIsFinite = context.isFinite,
  20496. nativeJoin = arrayProto.join,
  20497. nativeKeys = overArg(Object.keys, Object),
  20498. nativeMax = Math.max,
  20499. nativeMin = Math.min,
  20500. nativeNow = Date.now,
  20501. nativeParseInt = context.parseInt,
  20502. nativeRandom = Math.random,
  20503. nativeReverse = arrayProto.reverse;
  20504. /* Built-in method references that are verified to be native. */
  20505. var DataView = getNative(context, 'DataView'),
  20506. Map = getNative(context, 'Map'),
  20507. Promise = getNative(context, 'Promise'),
  20508. Set = getNative(context, 'Set'),
  20509. WeakMap = getNative(context, 'WeakMap'),
  20510. nativeCreate = getNative(Object, 'create');
  20511. /** Used to store function metadata. */
  20512. var metaMap = WeakMap && new WeakMap;
  20513. /** Used to lookup unminified function names. */
  20514. var realNames = {};
  20515. /** Used to detect maps, sets, and weakmaps. */
  20516. var dataViewCtorString = toSource(DataView),
  20517. mapCtorString = toSource(Map),
  20518. promiseCtorString = toSource(Promise),
  20519. setCtorString = toSource(Set),
  20520. weakMapCtorString = toSource(WeakMap);
  20521. /** Used to convert symbols to primitives and strings. */
  20522. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20523. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20524. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20525. /*------------------------------------------------------------------------*/
  20526. /**
  20527. * Creates a `lodash` object which wraps `value` to enable implicit method
  20528. * chain sequences. Methods that operate on and return arrays, collections,
  20529. * and functions can be chained together. Methods that retrieve a single value
  20530. * or may return a primitive value will automatically end the chain sequence
  20531. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20532. * with `_#value`.
  20533. *
  20534. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20535. * enabled using `_.chain`.
  20536. *
  20537. * The execution of chained methods is lazy, that is, it's deferred until
  20538. * `_#value` is implicitly or explicitly called.
  20539. *
  20540. * Lazy evaluation allows several methods to support shortcut fusion.
  20541. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20542. * the creation of intermediate arrays and can greatly reduce the number of
  20543. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20544. * fusion if the section is applied to an array and iteratees accept only
  20545. * one argument. The heuristic for whether a section qualifies for shortcut
  20546. * fusion is subject to change.
  20547. *
  20548. * Chaining is supported in custom builds as long as the `_#value` method is
  20549. * directly or indirectly included in the build.
  20550. *
  20551. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20552. *
  20553. * The wrapper `Array` methods are:
  20554. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20555. *
  20556. * The wrapper `String` methods are:
  20557. * `replace` and `split`
  20558. *
  20559. * The wrapper methods that support shortcut fusion are:
  20560. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20561. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20562. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20563. *
  20564. * The chainable wrapper methods are:
  20565. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20566. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20567. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20568. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20569. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20570. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20571. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20572. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20573. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20574. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20575. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20576. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20577. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20578. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20579. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20580. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20581. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20582. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20583. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20584. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20585. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20586. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20587. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20588. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20589. *
  20590. * The wrapper methods that are **not** chainable by default are:
  20591. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20592. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20593. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20594. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20595. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20596. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20597. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20598. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20599. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20600. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20601. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20602. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20603. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20604. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20605. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20606. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20607. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20608. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20609. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20610. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20611. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20612. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20613. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20614. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20615. * `upperFirst`, `value`, and `words`
  20616. *
  20617. * @name _
  20618. * @constructor
  20619. * @category Seq
  20620. * @param {*} value The value to wrap in a `lodash` instance.
  20621. * @returns {Object} Returns the new `lodash` wrapper instance.
  20622. * @example
  20623. *
  20624. * function square(n) {
  20625. * return n * n;
  20626. * }
  20627. *
  20628. * var wrapped = _([1, 2, 3]);
  20629. *
  20630. * // Returns an unwrapped value.
  20631. * wrapped.reduce(_.add);
  20632. * // => 6
  20633. *
  20634. * // Returns a wrapped value.
  20635. * var squares = wrapped.map(square);
  20636. *
  20637. * _.isArray(squares);
  20638. * // => false
  20639. *
  20640. * _.isArray(squares.value());
  20641. * // => true
  20642. */
  20643. function lodash(value) {
  20644. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20645. if (value instanceof LodashWrapper) {
  20646. return value;
  20647. }
  20648. if (hasOwnProperty.call(value, '__wrapped__')) {
  20649. return wrapperClone(value);
  20650. }
  20651. }
  20652. return new LodashWrapper(value);
  20653. }
  20654. /**
  20655. * The base implementation of `_.create` without support for assigning
  20656. * properties to the created object.
  20657. *
  20658. * @private
  20659. * @param {Object} proto The object to inherit from.
  20660. * @returns {Object} Returns the new object.
  20661. */
  20662. var baseCreate = (function() {
  20663. function object() {}
  20664. return function(proto) {
  20665. if (!isObject(proto)) {
  20666. return {};
  20667. }
  20668. if (objectCreate) {
  20669. return objectCreate(proto);
  20670. }
  20671. object.prototype = proto;
  20672. var result = new object;
  20673. object.prototype = undefined;
  20674. return result;
  20675. };
  20676. }());
  20677. /**
  20678. * The function whose prototype chain sequence wrappers inherit from.
  20679. *
  20680. * @private
  20681. */
  20682. function baseLodash() {
  20683. // No operation performed.
  20684. }
  20685. /**
  20686. * The base constructor for creating `lodash` wrapper objects.
  20687. *
  20688. * @private
  20689. * @param {*} value The value to wrap.
  20690. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20691. */
  20692. function LodashWrapper(value, chainAll) {
  20693. this.__wrapped__ = value;
  20694. this.__actions__ = [];
  20695. this.__chain__ = !!chainAll;
  20696. this.__index__ = 0;
  20697. this.__values__ = undefined;
  20698. }
  20699. /**
  20700. * By default, the template delimiters used by lodash are like those in
  20701. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20702. * following template settings to use alternative delimiters.
  20703. *
  20704. * @static
  20705. * @memberOf _
  20706. * @type {Object}
  20707. */
  20708. lodash.templateSettings = {
  20709. /**
  20710. * Used to detect `data` property values to be HTML-escaped.
  20711. *
  20712. * @memberOf _.templateSettings
  20713. * @type {RegExp}
  20714. */
  20715. 'escape': reEscape,
  20716. /**
  20717. * Used to detect code to be evaluated.
  20718. *
  20719. * @memberOf _.templateSettings
  20720. * @type {RegExp}
  20721. */
  20722. 'evaluate': reEvaluate,
  20723. /**
  20724. * Used to detect `data` property values to inject.
  20725. *
  20726. * @memberOf _.templateSettings
  20727. * @type {RegExp}
  20728. */
  20729. 'interpolate': reInterpolate,
  20730. /**
  20731. * Used to reference the data object in the template text.
  20732. *
  20733. * @memberOf _.templateSettings
  20734. * @type {string}
  20735. */
  20736. 'variable': '',
  20737. /**
  20738. * Used to import variables into the compiled template.
  20739. *
  20740. * @memberOf _.templateSettings
  20741. * @type {Object}
  20742. */
  20743. 'imports': {
  20744. /**
  20745. * A reference to the `lodash` function.
  20746. *
  20747. * @memberOf _.templateSettings.imports
  20748. * @type {Function}
  20749. */
  20750. '_': lodash
  20751. }
  20752. };
  20753. // Ensure wrappers are instances of `baseLodash`.
  20754. lodash.prototype = baseLodash.prototype;
  20755. lodash.prototype.constructor = lodash;
  20756. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20757. LodashWrapper.prototype.constructor = LodashWrapper;
  20758. /*------------------------------------------------------------------------*/
  20759. /**
  20760. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20761. *
  20762. * @private
  20763. * @constructor
  20764. * @param {*} value The value to wrap.
  20765. */
  20766. function LazyWrapper(value) {
  20767. this.__wrapped__ = value;
  20768. this.__actions__ = [];
  20769. this.__dir__ = 1;
  20770. this.__filtered__ = false;
  20771. this.__iteratees__ = [];
  20772. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20773. this.__views__ = [];
  20774. }
  20775. /**
  20776. * Creates a clone of the lazy wrapper object.
  20777. *
  20778. * @private
  20779. * @name clone
  20780. * @memberOf LazyWrapper
  20781. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20782. */
  20783. function lazyClone() {
  20784. var result = new LazyWrapper(this.__wrapped__);
  20785. result.__actions__ = copyArray(this.__actions__);
  20786. result.__dir__ = this.__dir__;
  20787. result.__filtered__ = this.__filtered__;
  20788. result.__iteratees__ = copyArray(this.__iteratees__);
  20789. result.__takeCount__ = this.__takeCount__;
  20790. result.__views__ = copyArray(this.__views__);
  20791. return result;
  20792. }
  20793. /**
  20794. * Reverses the direction of lazy iteration.
  20795. *
  20796. * @private
  20797. * @name reverse
  20798. * @memberOf LazyWrapper
  20799. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20800. */
  20801. function lazyReverse() {
  20802. if (this.__filtered__) {
  20803. var result = new LazyWrapper(this);
  20804. result.__dir__ = -1;
  20805. result.__filtered__ = true;
  20806. } else {
  20807. result = this.clone();
  20808. result.__dir__ *= -1;
  20809. }
  20810. return result;
  20811. }
  20812. /**
  20813. * Extracts the unwrapped value from its lazy wrapper.
  20814. *
  20815. * @private
  20816. * @name value
  20817. * @memberOf LazyWrapper
  20818. * @returns {*} Returns the unwrapped value.
  20819. */
  20820. function lazyValue() {
  20821. var array = this.__wrapped__.value(),
  20822. dir = this.__dir__,
  20823. isArr = isArray(array),
  20824. isRight = dir < 0,
  20825. arrLength = isArr ? array.length : 0,
  20826. view = getView(0, arrLength, this.__views__),
  20827. start = view.start,
  20828. end = view.end,
  20829. length = end - start,
  20830. index = isRight ? end : (start - 1),
  20831. iteratees = this.__iteratees__,
  20832. iterLength = iteratees.length,
  20833. resIndex = 0,
  20834. takeCount = nativeMin(length, this.__takeCount__);
  20835. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20836. return baseWrapperValue(array, this.__actions__);
  20837. }
  20838. var result = [];
  20839. outer:
  20840. while (length-- && resIndex < takeCount) {
  20841. index += dir;
  20842. var iterIndex = -1,
  20843. value = array[index];
  20844. while (++iterIndex < iterLength) {
  20845. var data = iteratees[iterIndex],
  20846. iteratee = data.iteratee,
  20847. type = data.type,
  20848. computed = iteratee(value);
  20849. if (type == LAZY_MAP_FLAG) {
  20850. value = computed;
  20851. } else if (!computed) {
  20852. if (type == LAZY_FILTER_FLAG) {
  20853. continue outer;
  20854. } else {
  20855. break outer;
  20856. }
  20857. }
  20858. }
  20859. result[resIndex++] = value;
  20860. }
  20861. return result;
  20862. }
  20863. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20864. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20865. LazyWrapper.prototype.constructor = LazyWrapper;
  20866. /*------------------------------------------------------------------------*/
  20867. /**
  20868. * Creates a hash object.
  20869. *
  20870. * @private
  20871. * @constructor
  20872. * @param {Array} [entries] The key-value pairs to cache.
  20873. */
  20874. function Hash(entries) {
  20875. var index = -1,
  20876. length = entries == null ? 0 : entries.length;
  20877. this.clear();
  20878. while (++index < length) {
  20879. var entry = entries[index];
  20880. this.set(entry[0], entry[1]);
  20881. }
  20882. }
  20883. /**
  20884. * Removes all key-value entries from the hash.
  20885. *
  20886. * @private
  20887. * @name clear
  20888. * @memberOf Hash
  20889. */
  20890. function hashClear() {
  20891. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20892. this.size = 0;
  20893. }
  20894. /**
  20895. * Removes `key` and its value from the hash.
  20896. *
  20897. * @private
  20898. * @name delete
  20899. * @memberOf Hash
  20900. * @param {Object} hash The hash to modify.
  20901. * @param {string} key The key of the value to remove.
  20902. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20903. */
  20904. function hashDelete(key) {
  20905. var result = this.has(key) && delete this.__data__[key];
  20906. this.size -= result ? 1 : 0;
  20907. return result;
  20908. }
  20909. /**
  20910. * Gets the hash value for `key`.
  20911. *
  20912. * @private
  20913. * @name get
  20914. * @memberOf Hash
  20915. * @param {string} key The key of the value to get.
  20916. * @returns {*} Returns the entry value.
  20917. */
  20918. function hashGet(key) {
  20919. var data = this.__data__;
  20920. if (nativeCreate) {
  20921. var result = data[key];
  20922. return result === HASH_UNDEFINED ? undefined : result;
  20923. }
  20924. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20925. }
  20926. /**
  20927. * Checks if a hash value for `key` exists.
  20928. *
  20929. * @private
  20930. * @name has
  20931. * @memberOf Hash
  20932. * @param {string} key The key of the entry to check.
  20933. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20934. */
  20935. function hashHas(key) {
  20936. var data = this.__data__;
  20937. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20938. }
  20939. /**
  20940. * Sets the hash `key` to `value`.
  20941. *
  20942. * @private
  20943. * @name set
  20944. * @memberOf Hash
  20945. * @param {string} key The key of the value to set.
  20946. * @param {*} value The value to set.
  20947. * @returns {Object} Returns the hash instance.
  20948. */
  20949. function hashSet(key, value) {
  20950. var data = this.__data__;
  20951. this.size += this.has(key) ? 0 : 1;
  20952. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20953. return this;
  20954. }
  20955. // Add methods to `Hash`.
  20956. Hash.prototype.clear = hashClear;
  20957. Hash.prototype['delete'] = hashDelete;
  20958. Hash.prototype.get = hashGet;
  20959. Hash.prototype.has = hashHas;
  20960. Hash.prototype.set = hashSet;
  20961. /*------------------------------------------------------------------------*/
  20962. /**
  20963. * Creates an list cache object.
  20964. *
  20965. * @private
  20966. * @constructor
  20967. * @param {Array} [entries] The key-value pairs to cache.
  20968. */
  20969. function ListCache(entries) {
  20970. var index = -1,
  20971. length = entries == null ? 0 : entries.length;
  20972. this.clear();
  20973. while (++index < length) {
  20974. var entry = entries[index];
  20975. this.set(entry[0], entry[1]);
  20976. }
  20977. }
  20978. /**
  20979. * Removes all key-value entries from the list cache.
  20980. *
  20981. * @private
  20982. * @name clear
  20983. * @memberOf ListCache
  20984. */
  20985. function listCacheClear() {
  20986. this.__data__ = [];
  20987. this.size = 0;
  20988. }
  20989. /**
  20990. * Removes `key` and its value from the list cache.
  20991. *
  20992. * @private
  20993. * @name delete
  20994. * @memberOf ListCache
  20995. * @param {string} key The key of the value to remove.
  20996. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20997. */
  20998. function listCacheDelete(key) {
  20999. var data = this.__data__,
  21000. index = assocIndexOf(data, key);
  21001. if (index < 0) {
  21002. return false;
  21003. }
  21004. var lastIndex = data.length - 1;
  21005. if (index == lastIndex) {
  21006. data.pop();
  21007. } else {
  21008. splice.call(data, index, 1);
  21009. }
  21010. --this.size;
  21011. return true;
  21012. }
  21013. /**
  21014. * Gets the list cache value for `key`.
  21015. *
  21016. * @private
  21017. * @name get
  21018. * @memberOf ListCache
  21019. * @param {string} key The key of the value to get.
  21020. * @returns {*} Returns the entry value.
  21021. */
  21022. function listCacheGet(key) {
  21023. var data = this.__data__,
  21024. index = assocIndexOf(data, key);
  21025. return index < 0 ? undefined : data[index][1];
  21026. }
  21027. /**
  21028. * Checks if a list cache value for `key` exists.
  21029. *
  21030. * @private
  21031. * @name has
  21032. * @memberOf ListCache
  21033. * @param {string} key The key of the entry to check.
  21034. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21035. */
  21036. function listCacheHas(key) {
  21037. return assocIndexOf(this.__data__, key) > -1;
  21038. }
  21039. /**
  21040. * Sets the list cache `key` to `value`.
  21041. *
  21042. * @private
  21043. * @name set
  21044. * @memberOf ListCache
  21045. * @param {string} key The key of the value to set.
  21046. * @param {*} value The value to set.
  21047. * @returns {Object} Returns the list cache instance.
  21048. */
  21049. function listCacheSet(key, value) {
  21050. var data = this.__data__,
  21051. index = assocIndexOf(data, key);
  21052. if (index < 0) {
  21053. ++this.size;
  21054. data.push([key, value]);
  21055. } else {
  21056. data[index][1] = value;
  21057. }
  21058. return this;
  21059. }
  21060. // Add methods to `ListCache`.
  21061. ListCache.prototype.clear = listCacheClear;
  21062. ListCache.prototype['delete'] = listCacheDelete;
  21063. ListCache.prototype.get = listCacheGet;
  21064. ListCache.prototype.has = listCacheHas;
  21065. ListCache.prototype.set = listCacheSet;
  21066. /*------------------------------------------------------------------------*/
  21067. /**
  21068. * Creates a map cache object to store key-value pairs.
  21069. *
  21070. * @private
  21071. * @constructor
  21072. * @param {Array} [entries] The key-value pairs to cache.
  21073. */
  21074. function MapCache(entries) {
  21075. var index = -1,
  21076. length = entries == null ? 0 : entries.length;
  21077. this.clear();
  21078. while (++index < length) {
  21079. var entry = entries[index];
  21080. this.set(entry[0], entry[1]);
  21081. }
  21082. }
  21083. /**
  21084. * Removes all key-value entries from the map.
  21085. *
  21086. * @private
  21087. * @name clear
  21088. * @memberOf MapCache
  21089. */
  21090. function mapCacheClear() {
  21091. this.size = 0;
  21092. this.__data__ = {
  21093. 'hash': new Hash,
  21094. 'map': new (Map || ListCache),
  21095. 'string': new Hash
  21096. };
  21097. }
  21098. /**
  21099. * Removes `key` and its value from the map.
  21100. *
  21101. * @private
  21102. * @name delete
  21103. * @memberOf MapCache
  21104. * @param {string} key The key of the value to remove.
  21105. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21106. */
  21107. function mapCacheDelete(key) {
  21108. var result = getMapData(this, key)['delete'](key);
  21109. this.size -= result ? 1 : 0;
  21110. return result;
  21111. }
  21112. /**
  21113. * Gets the map value for `key`.
  21114. *
  21115. * @private
  21116. * @name get
  21117. * @memberOf MapCache
  21118. * @param {string} key The key of the value to get.
  21119. * @returns {*} Returns the entry value.
  21120. */
  21121. function mapCacheGet(key) {
  21122. return getMapData(this, key).get(key);
  21123. }
  21124. /**
  21125. * Checks if a map value for `key` exists.
  21126. *
  21127. * @private
  21128. * @name has
  21129. * @memberOf MapCache
  21130. * @param {string} key The key of the entry to check.
  21131. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21132. */
  21133. function mapCacheHas(key) {
  21134. return getMapData(this, key).has(key);
  21135. }
  21136. /**
  21137. * Sets the map `key` to `value`.
  21138. *
  21139. * @private
  21140. * @name set
  21141. * @memberOf MapCache
  21142. * @param {string} key The key of the value to set.
  21143. * @param {*} value The value to set.
  21144. * @returns {Object} Returns the map cache instance.
  21145. */
  21146. function mapCacheSet(key, value) {
  21147. var data = getMapData(this, key),
  21148. size = data.size;
  21149. data.set(key, value);
  21150. this.size += data.size == size ? 0 : 1;
  21151. return this;
  21152. }
  21153. // Add methods to `MapCache`.
  21154. MapCache.prototype.clear = mapCacheClear;
  21155. MapCache.prototype['delete'] = mapCacheDelete;
  21156. MapCache.prototype.get = mapCacheGet;
  21157. MapCache.prototype.has = mapCacheHas;
  21158. MapCache.prototype.set = mapCacheSet;
  21159. /*------------------------------------------------------------------------*/
  21160. /**
  21161. *
  21162. * Creates an array cache object to store unique values.
  21163. *
  21164. * @private
  21165. * @constructor
  21166. * @param {Array} [values] The values to cache.
  21167. */
  21168. function SetCache(values) {
  21169. var index = -1,
  21170. length = values == null ? 0 : values.length;
  21171. this.__data__ = new MapCache;
  21172. while (++index < length) {
  21173. this.add(values[index]);
  21174. }
  21175. }
  21176. /**
  21177. * Adds `value` to the array cache.
  21178. *
  21179. * @private
  21180. * @name add
  21181. * @memberOf SetCache
  21182. * @alias push
  21183. * @param {*} value The value to cache.
  21184. * @returns {Object} Returns the cache instance.
  21185. */
  21186. function setCacheAdd(value) {
  21187. this.__data__.set(value, HASH_UNDEFINED);
  21188. return this;
  21189. }
  21190. /**
  21191. * Checks if `value` is in the array cache.
  21192. *
  21193. * @private
  21194. * @name has
  21195. * @memberOf SetCache
  21196. * @param {*} value The value to search for.
  21197. * @returns {number} Returns `true` if `value` is found, else `false`.
  21198. */
  21199. function setCacheHas(value) {
  21200. return this.__data__.has(value);
  21201. }
  21202. // Add methods to `SetCache`.
  21203. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21204. SetCache.prototype.has = setCacheHas;
  21205. /*------------------------------------------------------------------------*/
  21206. /**
  21207. * Creates a stack cache object to store key-value pairs.
  21208. *
  21209. * @private
  21210. * @constructor
  21211. * @param {Array} [entries] The key-value pairs to cache.
  21212. */
  21213. function Stack(entries) {
  21214. var data = this.__data__ = new ListCache(entries);
  21215. this.size = data.size;
  21216. }
  21217. /**
  21218. * Removes all key-value entries from the stack.
  21219. *
  21220. * @private
  21221. * @name clear
  21222. * @memberOf Stack
  21223. */
  21224. function stackClear() {
  21225. this.__data__ = new ListCache;
  21226. this.size = 0;
  21227. }
  21228. /**
  21229. * Removes `key` and its value from the stack.
  21230. *
  21231. * @private
  21232. * @name delete
  21233. * @memberOf Stack
  21234. * @param {string} key The key of the value to remove.
  21235. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21236. */
  21237. function stackDelete(key) {
  21238. var data = this.__data__,
  21239. result = data['delete'](key);
  21240. this.size = data.size;
  21241. return result;
  21242. }
  21243. /**
  21244. * Gets the stack value for `key`.
  21245. *
  21246. * @private
  21247. * @name get
  21248. * @memberOf Stack
  21249. * @param {string} key The key of the value to get.
  21250. * @returns {*} Returns the entry value.
  21251. */
  21252. function stackGet(key) {
  21253. return this.__data__.get(key);
  21254. }
  21255. /**
  21256. * Checks if a stack value for `key` exists.
  21257. *
  21258. * @private
  21259. * @name has
  21260. * @memberOf Stack
  21261. * @param {string} key The key of the entry to check.
  21262. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21263. */
  21264. function stackHas(key) {
  21265. return this.__data__.has(key);
  21266. }
  21267. /**
  21268. * Sets the stack `key` to `value`.
  21269. *
  21270. * @private
  21271. * @name set
  21272. * @memberOf Stack
  21273. * @param {string} key The key of the value to set.
  21274. * @param {*} value The value to set.
  21275. * @returns {Object} Returns the stack cache instance.
  21276. */
  21277. function stackSet(key, value) {
  21278. var data = this.__data__;
  21279. if (data instanceof ListCache) {
  21280. var pairs = data.__data__;
  21281. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21282. pairs.push([key, value]);
  21283. this.size = ++data.size;
  21284. return this;
  21285. }
  21286. data = this.__data__ = new MapCache(pairs);
  21287. }
  21288. data.set(key, value);
  21289. this.size = data.size;
  21290. return this;
  21291. }
  21292. // Add methods to `Stack`.
  21293. Stack.prototype.clear = stackClear;
  21294. Stack.prototype['delete'] = stackDelete;
  21295. Stack.prototype.get = stackGet;
  21296. Stack.prototype.has = stackHas;
  21297. Stack.prototype.set = stackSet;
  21298. /*------------------------------------------------------------------------*/
  21299. /**
  21300. * Creates an array of the enumerable property names of the array-like `value`.
  21301. *
  21302. * @private
  21303. * @param {*} value The value to query.
  21304. * @param {boolean} inherited Specify returning inherited property names.
  21305. * @returns {Array} Returns the array of property names.
  21306. */
  21307. function arrayLikeKeys(value, inherited) {
  21308. var isArr = isArray(value),
  21309. isArg = !isArr && isArguments(value),
  21310. isBuff = !isArr && !isArg && isBuffer(value),
  21311. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21312. skipIndexes = isArr || isArg || isBuff || isType,
  21313. result = skipIndexes ? baseTimes(value.length, String) : [],
  21314. length = result.length;
  21315. for (var key in value) {
  21316. if ((inherited || hasOwnProperty.call(value, key)) &&
  21317. !(skipIndexes && (
  21318. // Safari 9 has enumerable `arguments.length` in strict mode.
  21319. key == 'length' ||
  21320. // Node.js 0.10 has enumerable non-index properties on buffers.
  21321. (isBuff && (key == 'offset' || key == 'parent')) ||
  21322. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21323. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21324. // Skip index properties.
  21325. isIndex(key, length)
  21326. ))) {
  21327. result.push(key);
  21328. }
  21329. }
  21330. return result;
  21331. }
  21332. /**
  21333. * A specialized version of `_.sample` for arrays.
  21334. *
  21335. * @private
  21336. * @param {Array} array The array to sample.
  21337. * @returns {*} Returns the random element.
  21338. */
  21339. function arraySample(array) {
  21340. var length = array.length;
  21341. return length ? array[baseRandom(0, length - 1)] : undefined;
  21342. }
  21343. /**
  21344. * A specialized version of `_.sampleSize` for arrays.
  21345. *
  21346. * @private
  21347. * @param {Array} array The array to sample.
  21348. * @param {number} n The number of elements to sample.
  21349. * @returns {Array} Returns the random elements.
  21350. */
  21351. function arraySampleSize(array, n) {
  21352. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21353. }
  21354. /**
  21355. * A specialized version of `_.shuffle` for arrays.
  21356. *
  21357. * @private
  21358. * @param {Array} array The array to shuffle.
  21359. * @returns {Array} Returns the new shuffled array.
  21360. */
  21361. function arrayShuffle(array) {
  21362. return shuffleSelf(copyArray(array));
  21363. }
  21364. /**
  21365. * This function is like `assignValue` except that it doesn't assign
  21366. * `undefined` values.
  21367. *
  21368. * @private
  21369. * @param {Object} object The object to modify.
  21370. * @param {string} key The key of the property to assign.
  21371. * @param {*} value The value to assign.
  21372. */
  21373. function assignMergeValue(object, key, value) {
  21374. if ((value !== undefined && !eq(object[key], value)) ||
  21375. (value === undefined && !(key in object))) {
  21376. baseAssignValue(object, key, value);
  21377. }
  21378. }
  21379. /**
  21380. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21381. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21382. * for equality comparisons.
  21383. *
  21384. * @private
  21385. * @param {Object} object The object to modify.
  21386. * @param {string} key The key of the property to assign.
  21387. * @param {*} value The value to assign.
  21388. */
  21389. function assignValue(object, key, value) {
  21390. var objValue = object[key];
  21391. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21392. (value === undefined && !(key in object))) {
  21393. baseAssignValue(object, key, value);
  21394. }
  21395. }
  21396. /**
  21397. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21398. *
  21399. * @private
  21400. * @param {Array} array The array to inspect.
  21401. * @param {*} key The key to search for.
  21402. * @returns {number} Returns the index of the matched value, else `-1`.
  21403. */
  21404. function assocIndexOf(array, key) {
  21405. var length = array.length;
  21406. while (length--) {
  21407. if (eq(array[length][0], key)) {
  21408. return length;
  21409. }
  21410. }
  21411. return -1;
  21412. }
  21413. /**
  21414. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21415. * by `iteratee` and values set by `setter`.
  21416. *
  21417. * @private
  21418. * @param {Array|Object} collection The collection to iterate over.
  21419. * @param {Function} setter The function to set `accumulator` values.
  21420. * @param {Function} iteratee The iteratee to transform keys.
  21421. * @param {Object} accumulator The initial aggregated object.
  21422. * @returns {Function} Returns `accumulator`.
  21423. */
  21424. function baseAggregator(collection, setter, iteratee, accumulator) {
  21425. baseEach(collection, function(value, key, collection) {
  21426. setter(accumulator, value, iteratee(value), collection);
  21427. });
  21428. return accumulator;
  21429. }
  21430. /**
  21431. * The base implementation of `_.assign` without support for multiple sources
  21432. * or `customizer` functions.
  21433. *
  21434. * @private
  21435. * @param {Object} object The destination object.
  21436. * @param {Object} source The source object.
  21437. * @returns {Object} Returns `object`.
  21438. */
  21439. function baseAssign(object, source) {
  21440. return object && copyObject(source, keys(source), object);
  21441. }
  21442. /**
  21443. * The base implementation of `_.assignIn` without support for multiple sources
  21444. * or `customizer` functions.
  21445. *
  21446. * @private
  21447. * @param {Object} object The destination object.
  21448. * @param {Object} source The source object.
  21449. * @returns {Object} Returns `object`.
  21450. */
  21451. function baseAssignIn(object, source) {
  21452. return object && copyObject(source, keysIn(source), object);
  21453. }
  21454. /**
  21455. * The base implementation of `assignValue` and `assignMergeValue` without
  21456. * value checks.
  21457. *
  21458. * @private
  21459. * @param {Object} object The object to modify.
  21460. * @param {string} key The key of the property to assign.
  21461. * @param {*} value The value to assign.
  21462. */
  21463. function baseAssignValue(object, key, value) {
  21464. if (key == '__proto__' && defineProperty) {
  21465. defineProperty(object, key, {
  21466. 'configurable': true,
  21467. 'enumerable': true,
  21468. 'value': value,
  21469. 'writable': true
  21470. });
  21471. } else {
  21472. object[key] = value;
  21473. }
  21474. }
  21475. /**
  21476. * The base implementation of `_.at` without support for individual paths.
  21477. *
  21478. * @private
  21479. * @param {Object} object The object to iterate over.
  21480. * @param {string[]} paths The property paths to pick.
  21481. * @returns {Array} Returns the picked elements.
  21482. */
  21483. function baseAt(object, paths) {
  21484. var index = -1,
  21485. length = paths.length,
  21486. result = Array(length),
  21487. skip = object == null;
  21488. while (++index < length) {
  21489. result[index] = skip ? undefined : get(object, paths[index]);
  21490. }
  21491. return result;
  21492. }
  21493. /**
  21494. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21495. *
  21496. * @private
  21497. * @param {number} number The number to clamp.
  21498. * @param {number} [lower] The lower bound.
  21499. * @param {number} upper The upper bound.
  21500. * @returns {number} Returns the clamped number.
  21501. */
  21502. function baseClamp(number, lower, upper) {
  21503. if (number === number) {
  21504. if (upper !== undefined) {
  21505. number = number <= upper ? number : upper;
  21506. }
  21507. if (lower !== undefined) {
  21508. number = number >= lower ? number : lower;
  21509. }
  21510. }
  21511. return number;
  21512. }
  21513. /**
  21514. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21515. * traversed objects.
  21516. *
  21517. * @private
  21518. * @param {*} value The value to clone.
  21519. * @param {boolean} bitmask The bitmask flags.
  21520. * 1 - Deep clone
  21521. * 2 - Flatten inherited properties
  21522. * 4 - Clone symbols
  21523. * @param {Function} [customizer] The function to customize cloning.
  21524. * @param {string} [key] The key of `value`.
  21525. * @param {Object} [object] The parent object of `value`.
  21526. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21527. * @returns {*} Returns the cloned value.
  21528. */
  21529. function baseClone(value, bitmask, customizer, key, object, stack) {
  21530. var result,
  21531. isDeep = bitmask & CLONE_DEEP_FLAG,
  21532. isFlat = bitmask & CLONE_FLAT_FLAG,
  21533. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21534. if (customizer) {
  21535. result = object ? customizer(value, key, object, stack) : customizer(value);
  21536. }
  21537. if (result !== undefined) {
  21538. return result;
  21539. }
  21540. if (!isObject(value)) {
  21541. return value;
  21542. }
  21543. var isArr = isArray(value);
  21544. if (isArr) {
  21545. result = initCloneArray(value);
  21546. if (!isDeep) {
  21547. return copyArray(value, result);
  21548. }
  21549. } else {
  21550. var tag = getTag(value),
  21551. isFunc = tag == funcTag || tag == genTag;
  21552. if (isBuffer(value)) {
  21553. return cloneBuffer(value, isDeep);
  21554. }
  21555. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21556. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21557. if (!isDeep) {
  21558. return isFlat
  21559. ? copySymbolsIn(value, baseAssignIn(result, value))
  21560. : copySymbols(value, baseAssign(result, value));
  21561. }
  21562. } else {
  21563. if (!cloneableTags[tag]) {
  21564. return object ? value : {};
  21565. }
  21566. result = initCloneByTag(value, tag, isDeep);
  21567. }
  21568. }
  21569. // Check for circular references and return its corresponding clone.
  21570. stack || (stack = new Stack);
  21571. var stacked = stack.get(value);
  21572. if (stacked) {
  21573. return stacked;
  21574. }
  21575. stack.set(value, result);
  21576. if (isSet(value)) {
  21577. value.forEach(function(subValue) {
  21578. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21579. });
  21580. } else if (isMap(value)) {
  21581. value.forEach(function(subValue, key) {
  21582. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21583. });
  21584. }
  21585. var keysFunc = isFull
  21586. ? (isFlat ? getAllKeysIn : getAllKeys)
  21587. : (isFlat ? keysIn : keys);
  21588. var props = isArr ? undefined : keysFunc(value);
  21589. arrayEach(props || value, function(subValue, key) {
  21590. if (props) {
  21591. key = subValue;
  21592. subValue = value[key];
  21593. }
  21594. // Recursively populate clone (susceptible to call stack limits).
  21595. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21596. });
  21597. return result;
  21598. }
  21599. /**
  21600. * The base implementation of `_.conforms` which doesn't clone `source`.
  21601. *
  21602. * @private
  21603. * @param {Object} source The object of property predicates to conform to.
  21604. * @returns {Function} Returns the new spec function.
  21605. */
  21606. function baseConforms(source) {
  21607. var props = keys(source);
  21608. return function(object) {
  21609. return baseConformsTo(object, source, props);
  21610. };
  21611. }
  21612. /**
  21613. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21614. *
  21615. * @private
  21616. * @param {Object} object The object to inspect.
  21617. * @param {Object} source The object of property predicates to conform to.
  21618. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21619. */
  21620. function baseConformsTo(object, source, props) {
  21621. var length = props.length;
  21622. if (object == null) {
  21623. return !length;
  21624. }
  21625. object = Object(object);
  21626. while (length--) {
  21627. var key = props[length],
  21628. predicate = source[key],
  21629. value = object[key];
  21630. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21631. return false;
  21632. }
  21633. }
  21634. return true;
  21635. }
  21636. /**
  21637. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21638. * to provide to `func`.
  21639. *
  21640. * @private
  21641. * @param {Function} func The function to delay.
  21642. * @param {number} wait The number of milliseconds to delay invocation.
  21643. * @param {Array} args The arguments to provide to `func`.
  21644. * @returns {number|Object} Returns the timer id or timeout object.
  21645. */
  21646. function baseDelay(func, wait, args) {
  21647. if (typeof func != 'function') {
  21648. throw new TypeError(FUNC_ERROR_TEXT);
  21649. }
  21650. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21651. }
  21652. /**
  21653. * The base implementation of methods like `_.difference` without support
  21654. * for excluding multiple arrays or iteratee shorthands.
  21655. *
  21656. * @private
  21657. * @param {Array} array The array to inspect.
  21658. * @param {Array} values The values to exclude.
  21659. * @param {Function} [iteratee] The iteratee invoked per element.
  21660. * @param {Function} [comparator] The comparator invoked per element.
  21661. * @returns {Array} Returns the new array of filtered values.
  21662. */
  21663. function baseDifference(array, values, iteratee, comparator) {
  21664. var index = -1,
  21665. includes = arrayIncludes,
  21666. isCommon = true,
  21667. length = array.length,
  21668. result = [],
  21669. valuesLength = values.length;
  21670. if (!length) {
  21671. return result;
  21672. }
  21673. if (iteratee) {
  21674. values = arrayMap(values, baseUnary(iteratee));
  21675. }
  21676. if (comparator) {
  21677. includes = arrayIncludesWith;
  21678. isCommon = false;
  21679. }
  21680. else if (values.length >= LARGE_ARRAY_SIZE) {
  21681. includes = cacheHas;
  21682. isCommon = false;
  21683. values = new SetCache(values);
  21684. }
  21685. outer:
  21686. while (++index < length) {
  21687. var value = array[index],
  21688. computed = iteratee == null ? value : iteratee(value);
  21689. value = (comparator || value !== 0) ? value : 0;
  21690. if (isCommon && computed === computed) {
  21691. var valuesIndex = valuesLength;
  21692. while (valuesIndex--) {
  21693. if (values[valuesIndex] === computed) {
  21694. continue outer;
  21695. }
  21696. }
  21697. result.push(value);
  21698. }
  21699. else if (!includes(values, computed, comparator)) {
  21700. result.push(value);
  21701. }
  21702. }
  21703. return result;
  21704. }
  21705. /**
  21706. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21707. *
  21708. * @private
  21709. * @param {Array|Object} collection The collection to iterate over.
  21710. * @param {Function} iteratee The function invoked per iteration.
  21711. * @returns {Array|Object} Returns `collection`.
  21712. */
  21713. var baseEach = createBaseEach(baseForOwn);
  21714. /**
  21715. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21716. *
  21717. * @private
  21718. * @param {Array|Object} collection The collection to iterate over.
  21719. * @param {Function} iteratee The function invoked per iteration.
  21720. * @returns {Array|Object} Returns `collection`.
  21721. */
  21722. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21723. /**
  21724. * The base implementation of `_.every` without support for iteratee shorthands.
  21725. *
  21726. * @private
  21727. * @param {Array|Object} collection The collection to iterate over.
  21728. * @param {Function} predicate The function invoked per iteration.
  21729. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21730. * else `false`
  21731. */
  21732. function baseEvery(collection, predicate) {
  21733. var result = true;
  21734. baseEach(collection, function(value, index, collection) {
  21735. result = !!predicate(value, index, collection);
  21736. return result;
  21737. });
  21738. return result;
  21739. }
  21740. /**
  21741. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21742. * `comparator` to determine the extremum value.
  21743. *
  21744. * @private
  21745. * @param {Array} array The array to iterate over.
  21746. * @param {Function} iteratee The iteratee invoked per iteration.
  21747. * @param {Function} comparator The comparator used to compare values.
  21748. * @returns {*} Returns the extremum value.
  21749. */
  21750. function baseExtremum(array, iteratee, comparator) {
  21751. var index = -1,
  21752. length = array.length;
  21753. while (++index < length) {
  21754. var value = array[index],
  21755. current = iteratee(value);
  21756. if (current != null && (computed === undefined
  21757. ? (current === current && !isSymbol(current))
  21758. : comparator(current, computed)
  21759. )) {
  21760. var computed = current,
  21761. result = value;
  21762. }
  21763. }
  21764. return result;
  21765. }
  21766. /**
  21767. * The base implementation of `_.fill` without an iteratee call guard.
  21768. *
  21769. * @private
  21770. * @param {Array} array The array to fill.
  21771. * @param {*} value The value to fill `array` with.
  21772. * @param {number} [start=0] The start position.
  21773. * @param {number} [end=array.length] The end position.
  21774. * @returns {Array} Returns `array`.
  21775. */
  21776. function baseFill(array, value, start, end) {
  21777. var length = array.length;
  21778. start = toInteger(start);
  21779. if (start < 0) {
  21780. start = -start > length ? 0 : (length + start);
  21781. }
  21782. end = (end === undefined || end > length) ? length : toInteger(end);
  21783. if (end < 0) {
  21784. end += length;
  21785. }
  21786. end = start > end ? 0 : toLength(end);
  21787. while (start < end) {
  21788. array[start++] = value;
  21789. }
  21790. return array;
  21791. }
  21792. /**
  21793. * The base implementation of `_.filter` without support for iteratee shorthands.
  21794. *
  21795. * @private
  21796. * @param {Array|Object} collection The collection to iterate over.
  21797. * @param {Function} predicate The function invoked per iteration.
  21798. * @returns {Array} Returns the new filtered array.
  21799. */
  21800. function baseFilter(collection, predicate) {
  21801. var result = [];
  21802. baseEach(collection, function(value, index, collection) {
  21803. if (predicate(value, index, collection)) {
  21804. result.push(value);
  21805. }
  21806. });
  21807. return result;
  21808. }
  21809. /**
  21810. * The base implementation of `_.flatten` with support for restricting flattening.
  21811. *
  21812. * @private
  21813. * @param {Array} array The array to flatten.
  21814. * @param {number} depth The maximum recursion depth.
  21815. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21816. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21817. * @param {Array} [result=[]] The initial result value.
  21818. * @returns {Array} Returns the new flattened array.
  21819. */
  21820. function baseFlatten(array, depth, predicate, isStrict, result) {
  21821. var index = -1,
  21822. length = array.length;
  21823. predicate || (predicate = isFlattenable);
  21824. result || (result = []);
  21825. while (++index < length) {
  21826. var value = array[index];
  21827. if (depth > 0 && predicate(value)) {
  21828. if (depth > 1) {
  21829. // Recursively flatten arrays (susceptible to call stack limits).
  21830. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21831. } else {
  21832. arrayPush(result, value);
  21833. }
  21834. } else if (!isStrict) {
  21835. result[result.length] = value;
  21836. }
  21837. }
  21838. return result;
  21839. }
  21840. /**
  21841. * The base implementation of `baseForOwn` which iterates over `object`
  21842. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21843. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21844. *
  21845. * @private
  21846. * @param {Object} object The object to iterate over.
  21847. * @param {Function} iteratee The function invoked per iteration.
  21848. * @param {Function} keysFunc The function to get the keys of `object`.
  21849. * @returns {Object} Returns `object`.
  21850. */
  21851. var baseFor = createBaseFor();
  21852. /**
  21853. * This function is like `baseFor` except that it iterates over properties
  21854. * in the opposite order.
  21855. *
  21856. * @private
  21857. * @param {Object} object The object to iterate over.
  21858. * @param {Function} iteratee The function invoked per iteration.
  21859. * @param {Function} keysFunc The function to get the keys of `object`.
  21860. * @returns {Object} Returns `object`.
  21861. */
  21862. var baseForRight = createBaseFor(true);
  21863. /**
  21864. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21865. *
  21866. * @private
  21867. * @param {Object} object The object to iterate over.
  21868. * @param {Function} iteratee The function invoked per iteration.
  21869. * @returns {Object} Returns `object`.
  21870. */
  21871. function baseForOwn(object, iteratee) {
  21872. return object && baseFor(object, iteratee, keys);
  21873. }
  21874. /**
  21875. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21876. *
  21877. * @private
  21878. * @param {Object} object The object to iterate over.
  21879. * @param {Function} iteratee The function invoked per iteration.
  21880. * @returns {Object} Returns `object`.
  21881. */
  21882. function baseForOwnRight(object, iteratee) {
  21883. return object && baseForRight(object, iteratee, keys);
  21884. }
  21885. /**
  21886. * The base implementation of `_.functions` which creates an array of
  21887. * `object` function property names filtered from `props`.
  21888. *
  21889. * @private
  21890. * @param {Object} object The object to inspect.
  21891. * @param {Array} props The property names to filter.
  21892. * @returns {Array} Returns the function names.
  21893. */
  21894. function baseFunctions(object, props) {
  21895. return arrayFilter(props, function(key) {
  21896. return isFunction(object[key]);
  21897. });
  21898. }
  21899. /**
  21900. * The base implementation of `_.get` without support for default values.
  21901. *
  21902. * @private
  21903. * @param {Object} object The object to query.
  21904. * @param {Array|string} path The path of the property to get.
  21905. * @returns {*} Returns the resolved value.
  21906. */
  21907. function baseGet(object, path) {
  21908. path = castPath(path, object);
  21909. var index = 0,
  21910. length = path.length;
  21911. while (object != null && index < length) {
  21912. object = object[toKey(path[index++])];
  21913. }
  21914. return (index && index == length) ? object : undefined;
  21915. }
  21916. /**
  21917. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21918. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21919. * symbols of `object`.
  21920. *
  21921. * @private
  21922. * @param {Object} object The object to query.
  21923. * @param {Function} keysFunc The function to get the keys of `object`.
  21924. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21925. * @returns {Array} Returns the array of property names and symbols.
  21926. */
  21927. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21928. var result = keysFunc(object);
  21929. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21930. }
  21931. /**
  21932. * The base implementation of `getTag` without fallbacks for buggy environments.
  21933. *
  21934. * @private
  21935. * @param {*} value The value to query.
  21936. * @returns {string} Returns the `toStringTag`.
  21937. */
  21938. function baseGetTag(value) {
  21939. if (value == null) {
  21940. return value === undefined ? undefinedTag : nullTag;
  21941. }
  21942. return (symToStringTag && symToStringTag in Object(value))
  21943. ? getRawTag(value)
  21944. : objectToString(value);
  21945. }
  21946. /**
  21947. * The base implementation of `_.gt` which doesn't coerce arguments.
  21948. *
  21949. * @private
  21950. * @param {*} value The value to compare.
  21951. * @param {*} other The other value to compare.
  21952. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21953. * else `false`.
  21954. */
  21955. function baseGt(value, other) {
  21956. return value > other;
  21957. }
  21958. /**
  21959. * The base implementation of `_.has` without support for deep paths.
  21960. *
  21961. * @private
  21962. * @param {Object} [object] The object to query.
  21963. * @param {Array|string} key The key to check.
  21964. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21965. */
  21966. function baseHas(object, key) {
  21967. return object != null && hasOwnProperty.call(object, key);
  21968. }
  21969. /**
  21970. * The base implementation of `_.hasIn` without support for deep paths.
  21971. *
  21972. * @private
  21973. * @param {Object} [object] The object to query.
  21974. * @param {Array|string} key The key to check.
  21975. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21976. */
  21977. function baseHasIn(object, key) {
  21978. return object != null && key in Object(object);
  21979. }
  21980. /**
  21981. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21982. *
  21983. * @private
  21984. * @param {number} number The number to check.
  21985. * @param {number} start The start of the range.
  21986. * @param {number} end The end of the range.
  21987. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21988. */
  21989. function baseInRange(number, start, end) {
  21990. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21991. }
  21992. /**
  21993. * The base implementation of methods like `_.intersection`, without support
  21994. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21995. *
  21996. * @private
  21997. * @param {Array} arrays The arrays to inspect.
  21998. * @param {Function} [iteratee] The iteratee invoked per element.
  21999. * @param {Function} [comparator] The comparator invoked per element.
  22000. * @returns {Array} Returns the new array of shared values.
  22001. */
  22002. function baseIntersection(arrays, iteratee, comparator) {
  22003. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  22004. length = arrays[0].length,
  22005. othLength = arrays.length,
  22006. othIndex = othLength,
  22007. caches = Array(othLength),
  22008. maxLength = Infinity,
  22009. result = [];
  22010. while (othIndex--) {
  22011. var array = arrays[othIndex];
  22012. if (othIndex && iteratee) {
  22013. array = arrayMap(array, baseUnary(iteratee));
  22014. }
  22015. maxLength = nativeMin(array.length, maxLength);
  22016. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22017. ? new SetCache(othIndex && array)
  22018. : undefined;
  22019. }
  22020. array = arrays[0];
  22021. var index = -1,
  22022. seen = caches[0];
  22023. outer:
  22024. while (++index < length && result.length < maxLength) {
  22025. var value = array[index],
  22026. computed = iteratee ? iteratee(value) : value;
  22027. value = (comparator || value !== 0) ? value : 0;
  22028. if (!(seen
  22029. ? cacheHas(seen, computed)
  22030. : includes(result, computed, comparator)
  22031. )) {
  22032. othIndex = othLength;
  22033. while (--othIndex) {
  22034. var cache = caches[othIndex];
  22035. if (!(cache
  22036. ? cacheHas(cache, computed)
  22037. : includes(arrays[othIndex], computed, comparator))
  22038. ) {
  22039. continue outer;
  22040. }
  22041. }
  22042. if (seen) {
  22043. seen.push(computed);
  22044. }
  22045. result.push(value);
  22046. }
  22047. }
  22048. return result;
  22049. }
  22050. /**
  22051. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22052. * `object` with values transformed by `iteratee` and set by `setter`.
  22053. *
  22054. * @private
  22055. * @param {Object} object The object to iterate over.
  22056. * @param {Function} setter The function to set `accumulator` values.
  22057. * @param {Function} iteratee The iteratee to transform values.
  22058. * @param {Object} accumulator The initial inverted object.
  22059. * @returns {Function} Returns `accumulator`.
  22060. */
  22061. function baseInverter(object, setter, iteratee, accumulator) {
  22062. baseForOwn(object, function(value, key, object) {
  22063. setter(accumulator, iteratee(value), key, object);
  22064. });
  22065. return accumulator;
  22066. }
  22067. /**
  22068. * The base implementation of `_.invoke` without support for individual
  22069. * method arguments.
  22070. *
  22071. * @private
  22072. * @param {Object} object The object to query.
  22073. * @param {Array|string} path The path of the method to invoke.
  22074. * @param {Array} args The arguments to invoke the method with.
  22075. * @returns {*} Returns the result of the invoked method.
  22076. */
  22077. function baseInvoke(object, path, args) {
  22078. path = castPath(path, object);
  22079. object = parent(object, path);
  22080. var func = object == null ? object : object[toKey(last(path))];
  22081. return func == null ? undefined : apply(func, object, args);
  22082. }
  22083. /**
  22084. * The base implementation of `_.isArguments`.
  22085. *
  22086. * @private
  22087. * @param {*} value The value to check.
  22088. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22089. */
  22090. function baseIsArguments(value) {
  22091. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22092. }
  22093. /**
  22094. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22095. *
  22096. * @private
  22097. * @param {*} value The value to check.
  22098. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22099. */
  22100. function baseIsArrayBuffer(value) {
  22101. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22102. }
  22103. /**
  22104. * The base implementation of `_.isDate` without Node.js optimizations.
  22105. *
  22106. * @private
  22107. * @param {*} value The value to check.
  22108. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22109. */
  22110. function baseIsDate(value) {
  22111. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22112. }
  22113. /**
  22114. * The base implementation of `_.isEqual` which supports partial comparisons
  22115. * and tracks traversed objects.
  22116. *
  22117. * @private
  22118. * @param {*} value The value to compare.
  22119. * @param {*} other The other value to compare.
  22120. * @param {boolean} bitmask The bitmask flags.
  22121. * 1 - Unordered comparison
  22122. * 2 - Partial comparison
  22123. * @param {Function} [customizer] The function to customize comparisons.
  22124. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22125. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22126. */
  22127. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22128. if (value === other) {
  22129. return true;
  22130. }
  22131. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22132. return value !== value && other !== other;
  22133. }
  22134. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22135. }
  22136. /**
  22137. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22138. * deep comparisons and tracks traversed objects enabling objects with circular
  22139. * references to be compared.
  22140. *
  22141. * @private
  22142. * @param {Object} object The object to compare.
  22143. * @param {Object} other The other object to compare.
  22144. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22145. * @param {Function} customizer The function to customize comparisons.
  22146. * @param {Function} equalFunc The function to determine equivalents of values.
  22147. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22148. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22149. */
  22150. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22151. var objIsArr = isArray(object),
  22152. othIsArr = isArray(other),
  22153. objTag = objIsArr ? arrayTag : getTag(object),
  22154. othTag = othIsArr ? arrayTag : getTag(other);
  22155. objTag = objTag == argsTag ? objectTag : objTag;
  22156. othTag = othTag == argsTag ? objectTag : othTag;
  22157. var objIsObj = objTag == objectTag,
  22158. othIsObj = othTag == objectTag,
  22159. isSameTag = objTag == othTag;
  22160. if (isSameTag && isBuffer(object)) {
  22161. if (!isBuffer(other)) {
  22162. return false;
  22163. }
  22164. objIsArr = true;
  22165. objIsObj = false;
  22166. }
  22167. if (isSameTag && !objIsObj) {
  22168. stack || (stack = new Stack);
  22169. return (objIsArr || isTypedArray(object))
  22170. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22171. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22172. }
  22173. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22174. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22175. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22176. if (objIsWrapped || othIsWrapped) {
  22177. var objUnwrapped = objIsWrapped ? object.value() : object,
  22178. othUnwrapped = othIsWrapped ? other.value() : other;
  22179. stack || (stack = new Stack);
  22180. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22181. }
  22182. }
  22183. if (!isSameTag) {
  22184. return false;
  22185. }
  22186. stack || (stack = new Stack);
  22187. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22188. }
  22189. /**
  22190. * The base implementation of `_.isMap` without Node.js optimizations.
  22191. *
  22192. * @private
  22193. * @param {*} value The value to check.
  22194. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22195. */
  22196. function baseIsMap(value) {
  22197. return isObjectLike(value) && getTag(value) == mapTag;
  22198. }
  22199. /**
  22200. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22201. *
  22202. * @private
  22203. * @param {Object} object The object to inspect.
  22204. * @param {Object} source The object of property values to match.
  22205. * @param {Array} matchData The property names, values, and compare flags to match.
  22206. * @param {Function} [customizer] The function to customize comparisons.
  22207. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22208. */
  22209. function baseIsMatch(object, source, matchData, customizer) {
  22210. var index = matchData.length,
  22211. length = index,
  22212. noCustomizer = !customizer;
  22213. if (object == null) {
  22214. return !length;
  22215. }
  22216. object = Object(object);
  22217. while (index--) {
  22218. var data = matchData[index];
  22219. if ((noCustomizer && data[2])
  22220. ? data[1] !== object[data[0]]
  22221. : !(data[0] in object)
  22222. ) {
  22223. return false;
  22224. }
  22225. }
  22226. while (++index < length) {
  22227. data = matchData[index];
  22228. var key = data[0],
  22229. objValue = object[key],
  22230. srcValue = data[1];
  22231. if (noCustomizer && data[2]) {
  22232. if (objValue === undefined && !(key in object)) {
  22233. return false;
  22234. }
  22235. } else {
  22236. var stack = new Stack;
  22237. if (customizer) {
  22238. var result = customizer(objValue, srcValue, key, object, source, stack);
  22239. }
  22240. if (!(result === undefined
  22241. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22242. : result
  22243. )) {
  22244. return false;
  22245. }
  22246. }
  22247. }
  22248. return true;
  22249. }
  22250. /**
  22251. * The base implementation of `_.isNative` without bad shim checks.
  22252. *
  22253. * @private
  22254. * @param {*} value The value to check.
  22255. * @returns {boolean} Returns `true` if `value` is a native function,
  22256. * else `false`.
  22257. */
  22258. function baseIsNative(value) {
  22259. if (!isObject(value) || isMasked(value)) {
  22260. return false;
  22261. }
  22262. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22263. return pattern.test(toSource(value));
  22264. }
  22265. /**
  22266. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22267. *
  22268. * @private
  22269. * @param {*} value The value to check.
  22270. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22271. */
  22272. function baseIsRegExp(value) {
  22273. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22274. }
  22275. /**
  22276. * The base implementation of `_.isSet` without Node.js optimizations.
  22277. *
  22278. * @private
  22279. * @param {*} value The value to check.
  22280. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22281. */
  22282. function baseIsSet(value) {
  22283. return isObjectLike(value) && getTag(value) == setTag;
  22284. }
  22285. /**
  22286. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22287. *
  22288. * @private
  22289. * @param {*} value The value to check.
  22290. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22291. */
  22292. function baseIsTypedArray(value) {
  22293. return isObjectLike(value) &&
  22294. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22295. }
  22296. /**
  22297. * The base implementation of `_.iteratee`.
  22298. *
  22299. * @private
  22300. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22301. * @returns {Function} Returns the iteratee.
  22302. */
  22303. function baseIteratee(value) {
  22304. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22305. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22306. if (typeof value == 'function') {
  22307. return value;
  22308. }
  22309. if (value == null) {
  22310. return identity;
  22311. }
  22312. if (typeof value == 'object') {
  22313. return isArray(value)
  22314. ? baseMatchesProperty(value[0], value[1])
  22315. : baseMatches(value);
  22316. }
  22317. return property(value);
  22318. }
  22319. /**
  22320. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22321. *
  22322. * @private
  22323. * @param {Object} object The object to query.
  22324. * @returns {Array} Returns the array of property names.
  22325. */
  22326. function baseKeys(object) {
  22327. if (!isPrototype(object)) {
  22328. return nativeKeys(object);
  22329. }
  22330. var result = [];
  22331. for (var key in Object(object)) {
  22332. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22333. result.push(key);
  22334. }
  22335. }
  22336. return result;
  22337. }
  22338. /**
  22339. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22340. *
  22341. * @private
  22342. * @param {Object} object The object to query.
  22343. * @returns {Array} Returns the array of property names.
  22344. */
  22345. function baseKeysIn(object) {
  22346. if (!isObject(object)) {
  22347. return nativeKeysIn(object);
  22348. }
  22349. var isProto = isPrototype(object),
  22350. result = [];
  22351. for (var key in object) {
  22352. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22353. result.push(key);
  22354. }
  22355. }
  22356. return result;
  22357. }
  22358. /**
  22359. * The base implementation of `_.lt` which doesn't coerce arguments.
  22360. *
  22361. * @private
  22362. * @param {*} value The value to compare.
  22363. * @param {*} other The other value to compare.
  22364. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22365. * else `false`.
  22366. */
  22367. function baseLt(value, other) {
  22368. return value < other;
  22369. }
  22370. /**
  22371. * The base implementation of `_.map` without support for iteratee shorthands.
  22372. *
  22373. * @private
  22374. * @param {Array|Object} collection The collection to iterate over.
  22375. * @param {Function} iteratee The function invoked per iteration.
  22376. * @returns {Array} Returns the new mapped array.
  22377. */
  22378. function baseMap(collection, iteratee) {
  22379. var index = -1,
  22380. result = isArrayLike(collection) ? Array(collection.length) : [];
  22381. baseEach(collection, function(value, key, collection) {
  22382. result[++index] = iteratee(value, key, collection);
  22383. });
  22384. return result;
  22385. }
  22386. /**
  22387. * The base implementation of `_.matches` which doesn't clone `source`.
  22388. *
  22389. * @private
  22390. * @param {Object} source The object of property values to match.
  22391. * @returns {Function} Returns the new spec function.
  22392. */
  22393. function baseMatches(source) {
  22394. var matchData = getMatchData(source);
  22395. if (matchData.length == 1 && matchData[0][2]) {
  22396. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22397. }
  22398. return function(object) {
  22399. return object === source || baseIsMatch(object, source, matchData);
  22400. };
  22401. }
  22402. /**
  22403. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22404. *
  22405. * @private
  22406. * @param {string} path The path of the property to get.
  22407. * @param {*} srcValue The value to match.
  22408. * @returns {Function} Returns the new spec function.
  22409. */
  22410. function baseMatchesProperty(path, srcValue) {
  22411. if (isKey(path) && isStrictComparable(srcValue)) {
  22412. return matchesStrictComparable(toKey(path), srcValue);
  22413. }
  22414. return function(object) {
  22415. var objValue = get(object, path);
  22416. return (objValue === undefined && objValue === srcValue)
  22417. ? hasIn(object, path)
  22418. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22419. };
  22420. }
  22421. /**
  22422. * The base implementation of `_.merge` without support for multiple sources.
  22423. *
  22424. * @private
  22425. * @param {Object} object The destination object.
  22426. * @param {Object} source The source object.
  22427. * @param {number} srcIndex The index of `source`.
  22428. * @param {Function} [customizer] The function to customize merged values.
  22429. * @param {Object} [stack] Tracks traversed source values and their merged
  22430. * counterparts.
  22431. */
  22432. function baseMerge(object, source, srcIndex, customizer, stack) {
  22433. if (object === source) {
  22434. return;
  22435. }
  22436. baseFor(source, function(srcValue, key) {
  22437. stack || (stack = new Stack);
  22438. if (isObject(srcValue)) {
  22439. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22440. }
  22441. else {
  22442. var newValue = customizer
  22443. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22444. : undefined;
  22445. if (newValue === undefined) {
  22446. newValue = srcValue;
  22447. }
  22448. assignMergeValue(object, key, newValue);
  22449. }
  22450. }, keysIn);
  22451. }
  22452. /**
  22453. * A specialized version of `baseMerge` for arrays and objects which performs
  22454. * deep merges and tracks traversed objects enabling objects with circular
  22455. * references to be merged.
  22456. *
  22457. * @private
  22458. * @param {Object} object The destination object.
  22459. * @param {Object} source The source object.
  22460. * @param {string} key The key of the value to merge.
  22461. * @param {number} srcIndex The index of `source`.
  22462. * @param {Function} mergeFunc The function to merge values.
  22463. * @param {Function} [customizer] The function to customize assigned values.
  22464. * @param {Object} [stack] Tracks traversed source values and their merged
  22465. * counterparts.
  22466. */
  22467. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22468. var objValue = safeGet(object, key),
  22469. srcValue = safeGet(source, key),
  22470. stacked = stack.get(srcValue);
  22471. if (stacked) {
  22472. assignMergeValue(object, key, stacked);
  22473. return;
  22474. }
  22475. var newValue = customizer
  22476. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22477. : undefined;
  22478. var isCommon = newValue === undefined;
  22479. if (isCommon) {
  22480. var isArr = isArray(srcValue),
  22481. isBuff = !isArr && isBuffer(srcValue),
  22482. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22483. newValue = srcValue;
  22484. if (isArr || isBuff || isTyped) {
  22485. if (isArray(objValue)) {
  22486. newValue = objValue;
  22487. }
  22488. else if (isArrayLikeObject(objValue)) {
  22489. newValue = copyArray(objValue);
  22490. }
  22491. else if (isBuff) {
  22492. isCommon = false;
  22493. newValue = cloneBuffer(srcValue, true);
  22494. }
  22495. else if (isTyped) {
  22496. isCommon = false;
  22497. newValue = cloneTypedArray(srcValue, true);
  22498. }
  22499. else {
  22500. newValue = [];
  22501. }
  22502. }
  22503. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22504. newValue = objValue;
  22505. if (isArguments(objValue)) {
  22506. newValue = toPlainObject(objValue);
  22507. }
  22508. else if (!isObject(objValue) || isFunction(objValue)) {
  22509. newValue = initCloneObject(srcValue);
  22510. }
  22511. }
  22512. else {
  22513. isCommon = false;
  22514. }
  22515. }
  22516. if (isCommon) {
  22517. // Recursively merge objects and arrays (susceptible to call stack limits).
  22518. stack.set(srcValue, newValue);
  22519. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22520. stack['delete'](srcValue);
  22521. }
  22522. assignMergeValue(object, key, newValue);
  22523. }
  22524. /**
  22525. * The base implementation of `_.nth` which doesn't coerce arguments.
  22526. *
  22527. * @private
  22528. * @param {Array} array The array to query.
  22529. * @param {number} n The index of the element to return.
  22530. * @returns {*} Returns the nth element of `array`.
  22531. */
  22532. function baseNth(array, n) {
  22533. var length = array.length;
  22534. if (!length) {
  22535. return;
  22536. }
  22537. n += n < 0 ? length : 0;
  22538. return isIndex(n, length) ? array[n] : undefined;
  22539. }
  22540. /**
  22541. * The base implementation of `_.orderBy` without param guards.
  22542. *
  22543. * @private
  22544. * @param {Array|Object} collection The collection to iterate over.
  22545. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22546. * @param {string[]} orders The sort orders of `iteratees`.
  22547. * @returns {Array} Returns the new sorted array.
  22548. */
  22549. function baseOrderBy(collection, iteratees, orders) {
  22550. var index = -1;
  22551. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22552. var result = baseMap(collection, function(value, key, collection) {
  22553. var criteria = arrayMap(iteratees, function(iteratee) {
  22554. return iteratee(value);
  22555. });
  22556. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22557. });
  22558. return baseSortBy(result, function(object, other) {
  22559. return compareMultiple(object, other, orders);
  22560. });
  22561. }
  22562. /**
  22563. * The base implementation of `_.pick` without support for individual
  22564. * property identifiers.
  22565. *
  22566. * @private
  22567. * @param {Object} object The source object.
  22568. * @param {string[]} paths The property paths to pick.
  22569. * @returns {Object} Returns the new object.
  22570. */
  22571. function basePick(object, paths) {
  22572. return basePickBy(object, paths, function(value, path) {
  22573. return hasIn(object, path);
  22574. });
  22575. }
  22576. /**
  22577. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22578. *
  22579. * @private
  22580. * @param {Object} object The source object.
  22581. * @param {string[]} paths The property paths to pick.
  22582. * @param {Function} predicate The function invoked per property.
  22583. * @returns {Object} Returns the new object.
  22584. */
  22585. function basePickBy(object, paths, predicate) {
  22586. var index = -1,
  22587. length = paths.length,
  22588. result = {};
  22589. while (++index < length) {
  22590. var path = paths[index],
  22591. value = baseGet(object, path);
  22592. if (predicate(value, path)) {
  22593. baseSet(result, castPath(path, object), value);
  22594. }
  22595. }
  22596. return result;
  22597. }
  22598. /**
  22599. * A specialized version of `baseProperty` which supports deep paths.
  22600. *
  22601. * @private
  22602. * @param {Array|string} path The path of the property to get.
  22603. * @returns {Function} Returns the new accessor function.
  22604. */
  22605. function basePropertyDeep(path) {
  22606. return function(object) {
  22607. return baseGet(object, path);
  22608. };
  22609. }
  22610. /**
  22611. * The base implementation of `_.pullAllBy` without support for iteratee
  22612. * shorthands.
  22613. *
  22614. * @private
  22615. * @param {Array} array The array to modify.
  22616. * @param {Array} values The values to remove.
  22617. * @param {Function} [iteratee] The iteratee invoked per element.
  22618. * @param {Function} [comparator] The comparator invoked per element.
  22619. * @returns {Array} Returns `array`.
  22620. */
  22621. function basePullAll(array, values, iteratee, comparator) {
  22622. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22623. index = -1,
  22624. length = values.length,
  22625. seen = array;
  22626. if (array === values) {
  22627. values = copyArray(values);
  22628. }
  22629. if (iteratee) {
  22630. seen = arrayMap(array, baseUnary(iteratee));
  22631. }
  22632. while (++index < length) {
  22633. var fromIndex = 0,
  22634. value = values[index],
  22635. computed = iteratee ? iteratee(value) : value;
  22636. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22637. if (seen !== array) {
  22638. splice.call(seen, fromIndex, 1);
  22639. }
  22640. splice.call(array, fromIndex, 1);
  22641. }
  22642. }
  22643. return array;
  22644. }
  22645. /**
  22646. * The base implementation of `_.pullAt` without support for individual
  22647. * indexes or capturing the removed elements.
  22648. *
  22649. * @private
  22650. * @param {Array} array The array to modify.
  22651. * @param {number[]} indexes The indexes of elements to remove.
  22652. * @returns {Array} Returns `array`.
  22653. */
  22654. function basePullAt(array, indexes) {
  22655. var length = array ? indexes.length : 0,
  22656. lastIndex = length - 1;
  22657. while (length--) {
  22658. var index = indexes[length];
  22659. if (length == lastIndex || index !== previous) {
  22660. var previous = index;
  22661. if (isIndex(index)) {
  22662. splice.call(array, index, 1);
  22663. } else {
  22664. baseUnset(array, index);
  22665. }
  22666. }
  22667. }
  22668. return array;
  22669. }
  22670. /**
  22671. * The base implementation of `_.random` without support for returning
  22672. * floating-point numbers.
  22673. *
  22674. * @private
  22675. * @param {number} lower The lower bound.
  22676. * @param {number} upper The upper bound.
  22677. * @returns {number} Returns the random number.
  22678. */
  22679. function baseRandom(lower, upper) {
  22680. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22681. }
  22682. /**
  22683. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22684. * coerce arguments.
  22685. *
  22686. * @private
  22687. * @param {number} start The start of the range.
  22688. * @param {number} end The end of the range.
  22689. * @param {number} step The value to increment or decrement by.
  22690. * @param {boolean} [fromRight] Specify iterating from right to left.
  22691. * @returns {Array} Returns the range of numbers.
  22692. */
  22693. function baseRange(start, end, step, fromRight) {
  22694. var index = -1,
  22695. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22696. result = Array(length);
  22697. while (length--) {
  22698. result[fromRight ? length : ++index] = start;
  22699. start += step;
  22700. }
  22701. return result;
  22702. }
  22703. /**
  22704. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22705. *
  22706. * @private
  22707. * @param {string} string The string to repeat.
  22708. * @param {number} n The number of times to repeat the string.
  22709. * @returns {string} Returns the repeated string.
  22710. */
  22711. function baseRepeat(string, n) {
  22712. var result = '';
  22713. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22714. return result;
  22715. }
  22716. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22717. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22718. do {
  22719. if (n % 2) {
  22720. result += string;
  22721. }
  22722. n = nativeFloor(n / 2);
  22723. if (n) {
  22724. string += string;
  22725. }
  22726. } while (n);
  22727. return result;
  22728. }
  22729. /**
  22730. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22731. *
  22732. * @private
  22733. * @param {Function} func The function to apply a rest parameter to.
  22734. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22735. * @returns {Function} Returns the new function.
  22736. */
  22737. function baseRest(func, start) {
  22738. return setToString(overRest(func, start, identity), func + '');
  22739. }
  22740. /**
  22741. * The base implementation of `_.sample`.
  22742. *
  22743. * @private
  22744. * @param {Array|Object} collection The collection to sample.
  22745. * @returns {*} Returns the random element.
  22746. */
  22747. function baseSample(collection) {
  22748. return arraySample(values(collection));
  22749. }
  22750. /**
  22751. * The base implementation of `_.sampleSize` without param guards.
  22752. *
  22753. * @private
  22754. * @param {Array|Object} collection The collection to sample.
  22755. * @param {number} n The number of elements to sample.
  22756. * @returns {Array} Returns the random elements.
  22757. */
  22758. function baseSampleSize(collection, n) {
  22759. var array = values(collection);
  22760. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22761. }
  22762. /**
  22763. * The base implementation of `_.set`.
  22764. *
  22765. * @private
  22766. * @param {Object} object The object to modify.
  22767. * @param {Array|string} path The path of the property to set.
  22768. * @param {*} value The value to set.
  22769. * @param {Function} [customizer] The function to customize path creation.
  22770. * @returns {Object} Returns `object`.
  22771. */
  22772. function baseSet(object, path, value, customizer) {
  22773. if (!isObject(object)) {
  22774. return object;
  22775. }
  22776. path = castPath(path, object);
  22777. var index = -1,
  22778. length = path.length,
  22779. lastIndex = length - 1,
  22780. nested = object;
  22781. while (nested != null && ++index < length) {
  22782. var key = toKey(path[index]),
  22783. newValue = value;
  22784. if (index != lastIndex) {
  22785. var objValue = nested[key];
  22786. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22787. if (newValue === undefined) {
  22788. newValue = isObject(objValue)
  22789. ? objValue
  22790. : (isIndex(path[index + 1]) ? [] : {});
  22791. }
  22792. }
  22793. assignValue(nested, key, newValue);
  22794. nested = nested[key];
  22795. }
  22796. return object;
  22797. }
  22798. /**
  22799. * The base implementation of `setData` without support for hot loop shorting.
  22800. *
  22801. * @private
  22802. * @param {Function} func The function to associate metadata with.
  22803. * @param {*} data The metadata.
  22804. * @returns {Function} Returns `func`.
  22805. */
  22806. var baseSetData = !metaMap ? identity : function(func, data) {
  22807. metaMap.set(func, data);
  22808. return func;
  22809. };
  22810. /**
  22811. * The base implementation of `setToString` without support for hot loop shorting.
  22812. *
  22813. * @private
  22814. * @param {Function} func The function to modify.
  22815. * @param {Function} string The `toString` result.
  22816. * @returns {Function} Returns `func`.
  22817. */
  22818. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22819. return defineProperty(func, 'toString', {
  22820. 'configurable': true,
  22821. 'enumerable': false,
  22822. 'value': constant(string),
  22823. 'writable': true
  22824. });
  22825. };
  22826. /**
  22827. * The base implementation of `_.shuffle`.
  22828. *
  22829. * @private
  22830. * @param {Array|Object} collection The collection to shuffle.
  22831. * @returns {Array} Returns the new shuffled array.
  22832. */
  22833. function baseShuffle(collection) {
  22834. return shuffleSelf(values(collection));
  22835. }
  22836. /**
  22837. * The base implementation of `_.slice` without an iteratee call guard.
  22838. *
  22839. * @private
  22840. * @param {Array} array The array to slice.
  22841. * @param {number} [start=0] The start position.
  22842. * @param {number} [end=array.length] The end position.
  22843. * @returns {Array} Returns the slice of `array`.
  22844. */
  22845. function baseSlice(array, start, end) {
  22846. var index = -1,
  22847. length = array.length;
  22848. if (start < 0) {
  22849. start = -start > length ? 0 : (length + start);
  22850. }
  22851. end = end > length ? length : end;
  22852. if (end < 0) {
  22853. end += length;
  22854. }
  22855. length = start > end ? 0 : ((end - start) >>> 0);
  22856. start >>>= 0;
  22857. var result = Array(length);
  22858. while (++index < length) {
  22859. result[index] = array[index + start];
  22860. }
  22861. return result;
  22862. }
  22863. /**
  22864. * The base implementation of `_.some` without support for iteratee shorthands.
  22865. *
  22866. * @private
  22867. * @param {Array|Object} collection The collection to iterate over.
  22868. * @param {Function} predicate The function invoked per iteration.
  22869. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22870. * else `false`.
  22871. */
  22872. function baseSome(collection, predicate) {
  22873. var result;
  22874. baseEach(collection, function(value, index, collection) {
  22875. result = predicate(value, index, collection);
  22876. return !result;
  22877. });
  22878. return !!result;
  22879. }
  22880. /**
  22881. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22882. * performs a binary search of `array` to determine the index at which `value`
  22883. * should be inserted into `array` in order to maintain its sort order.
  22884. *
  22885. * @private
  22886. * @param {Array} array The sorted array to inspect.
  22887. * @param {*} value The value to evaluate.
  22888. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22889. * @returns {number} Returns the index at which `value` should be inserted
  22890. * into `array`.
  22891. */
  22892. function baseSortedIndex(array, value, retHighest) {
  22893. var low = 0,
  22894. high = array == null ? low : array.length;
  22895. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22896. while (low < high) {
  22897. var mid = (low + high) >>> 1,
  22898. computed = array[mid];
  22899. if (computed !== null && !isSymbol(computed) &&
  22900. (retHighest ? (computed <= value) : (computed < value))) {
  22901. low = mid + 1;
  22902. } else {
  22903. high = mid;
  22904. }
  22905. }
  22906. return high;
  22907. }
  22908. return baseSortedIndexBy(array, value, identity, retHighest);
  22909. }
  22910. /**
  22911. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22912. * which invokes `iteratee` for `value` and each element of `array` to compute
  22913. * their sort ranking. The iteratee is invoked with one argument; (value).
  22914. *
  22915. * @private
  22916. * @param {Array} array The sorted array to inspect.
  22917. * @param {*} value The value to evaluate.
  22918. * @param {Function} iteratee The iteratee invoked per element.
  22919. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22920. * @returns {number} Returns the index at which `value` should be inserted
  22921. * into `array`.
  22922. */
  22923. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22924. value = iteratee(value);
  22925. var low = 0,
  22926. high = array == null ? 0 : array.length,
  22927. valIsNaN = value !== value,
  22928. valIsNull = value === null,
  22929. valIsSymbol = isSymbol(value),
  22930. valIsUndefined = value === undefined;
  22931. while (low < high) {
  22932. var mid = nativeFloor((low + high) / 2),
  22933. computed = iteratee(array[mid]),
  22934. othIsDefined = computed !== undefined,
  22935. othIsNull = computed === null,
  22936. othIsReflexive = computed === computed,
  22937. othIsSymbol = isSymbol(computed);
  22938. if (valIsNaN) {
  22939. var setLow = retHighest || othIsReflexive;
  22940. } else if (valIsUndefined) {
  22941. setLow = othIsReflexive && (retHighest || othIsDefined);
  22942. } else if (valIsNull) {
  22943. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22944. } else if (valIsSymbol) {
  22945. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22946. } else if (othIsNull || othIsSymbol) {
  22947. setLow = false;
  22948. } else {
  22949. setLow = retHighest ? (computed <= value) : (computed < value);
  22950. }
  22951. if (setLow) {
  22952. low = mid + 1;
  22953. } else {
  22954. high = mid;
  22955. }
  22956. }
  22957. return nativeMin(high, MAX_ARRAY_INDEX);
  22958. }
  22959. /**
  22960. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22961. * support for iteratee shorthands.
  22962. *
  22963. * @private
  22964. * @param {Array} array The array to inspect.
  22965. * @param {Function} [iteratee] The iteratee invoked per element.
  22966. * @returns {Array} Returns the new duplicate free array.
  22967. */
  22968. function baseSortedUniq(array, iteratee) {
  22969. var index = -1,
  22970. length = array.length,
  22971. resIndex = 0,
  22972. result = [];
  22973. while (++index < length) {
  22974. var value = array[index],
  22975. computed = iteratee ? iteratee(value) : value;
  22976. if (!index || !eq(computed, seen)) {
  22977. var seen = computed;
  22978. result[resIndex++] = value === 0 ? 0 : value;
  22979. }
  22980. }
  22981. return result;
  22982. }
  22983. /**
  22984. * The base implementation of `_.toNumber` which doesn't ensure correct
  22985. * conversions of binary, hexadecimal, or octal string values.
  22986. *
  22987. * @private
  22988. * @param {*} value The value to process.
  22989. * @returns {number} Returns the number.
  22990. */
  22991. function baseToNumber(value) {
  22992. if (typeof value == 'number') {
  22993. return value;
  22994. }
  22995. if (isSymbol(value)) {
  22996. return NAN;
  22997. }
  22998. return +value;
  22999. }
  23000. /**
  23001. * The base implementation of `_.toString` which doesn't convert nullish
  23002. * values to empty strings.
  23003. *
  23004. * @private
  23005. * @param {*} value The value to process.
  23006. * @returns {string} Returns the string.
  23007. */
  23008. function baseToString(value) {
  23009. // Exit early for strings to avoid a performance hit in some environments.
  23010. if (typeof value == 'string') {
  23011. return value;
  23012. }
  23013. if (isArray(value)) {
  23014. // Recursively convert values (susceptible to call stack limits).
  23015. return arrayMap(value, baseToString) + '';
  23016. }
  23017. if (isSymbol(value)) {
  23018. return symbolToString ? symbolToString.call(value) : '';
  23019. }
  23020. var result = (value + '');
  23021. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23022. }
  23023. /**
  23024. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23025. *
  23026. * @private
  23027. * @param {Array} array The array to inspect.
  23028. * @param {Function} [iteratee] The iteratee invoked per element.
  23029. * @param {Function} [comparator] The comparator invoked per element.
  23030. * @returns {Array} Returns the new duplicate free array.
  23031. */
  23032. function baseUniq(array, iteratee, comparator) {
  23033. var index = -1,
  23034. includes = arrayIncludes,
  23035. length = array.length,
  23036. isCommon = true,
  23037. result = [],
  23038. seen = result;
  23039. if (comparator) {
  23040. isCommon = false;
  23041. includes = arrayIncludesWith;
  23042. }
  23043. else if (length >= LARGE_ARRAY_SIZE) {
  23044. var set = iteratee ? null : createSet(array);
  23045. if (set) {
  23046. return setToArray(set);
  23047. }
  23048. isCommon = false;
  23049. includes = cacheHas;
  23050. seen = new SetCache;
  23051. }
  23052. else {
  23053. seen = iteratee ? [] : result;
  23054. }
  23055. outer:
  23056. while (++index < length) {
  23057. var value = array[index],
  23058. computed = iteratee ? iteratee(value) : value;
  23059. value = (comparator || value !== 0) ? value : 0;
  23060. if (isCommon && computed === computed) {
  23061. var seenIndex = seen.length;
  23062. while (seenIndex--) {
  23063. if (seen[seenIndex] === computed) {
  23064. continue outer;
  23065. }
  23066. }
  23067. if (iteratee) {
  23068. seen.push(computed);
  23069. }
  23070. result.push(value);
  23071. }
  23072. else if (!includes(seen, computed, comparator)) {
  23073. if (seen !== result) {
  23074. seen.push(computed);
  23075. }
  23076. result.push(value);
  23077. }
  23078. }
  23079. return result;
  23080. }
  23081. /**
  23082. * The base implementation of `_.unset`.
  23083. *
  23084. * @private
  23085. * @param {Object} object The object to modify.
  23086. * @param {Array|string} path The property path to unset.
  23087. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23088. */
  23089. function baseUnset(object, path) {
  23090. path = castPath(path, object);
  23091. object = parent(object, path);
  23092. return object == null || delete object[toKey(last(path))];
  23093. }
  23094. /**
  23095. * The base implementation of `_.update`.
  23096. *
  23097. * @private
  23098. * @param {Object} object The object to modify.
  23099. * @param {Array|string} path The path of the property to update.
  23100. * @param {Function} updater The function to produce the updated value.
  23101. * @param {Function} [customizer] The function to customize path creation.
  23102. * @returns {Object} Returns `object`.
  23103. */
  23104. function baseUpdate(object, path, updater, customizer) {
  23105. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23106. }
  23107. /**
  23108. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23109. * without support for iteratee shorthands.
  23110. *
  23111. * @private
  23112. * @param {Array} array The array to query.
  23113. * @param {Function} predicate The function invoked per iteration.
  23114. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23115. * @param {boolean} [fromRight] Specify iterating from right to left.
  23116. * @returns {Array} Returns the slice of `array`.
  23117. */
  23118. function baseWhile(array, predicate, isDrop, fromRight) {
  23119. var length = array.length,
  23120. index = fromRight ? length : -1;
  23121. while ((fromRight ? index-- : ++index < length) &&
  23122. predicate(array[index], index, array)) {}
  23123. return isDrop
  23124. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23125. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23126. }
  23127. /**
  23128. * The base implementation of `wrapperValue` which returns the result of
  23129. * performing a sequence of actions on the unwrapped `value`, where each
  23130. * successive action is supplied the return value of the previous.
  23131. *
  23132. * @private
  23133. * @param {*} value The unwrapped value.
  23134. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23135. * @returns {*} Returns the resolved value.
  23136. */
  23137. function baseWrapperValue(value, actions) {
  23138. var result = value;
  23139. if (result instanceof LazyWrapper) {
  23140. result = result.value();
  23141. }
  23142. return arrayReduce(actions, function(result, action) {
  23143. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23144. }, result);
  23145. }
  23146. /**
  23147. * The base implementation of methods like `_.xor`, without support for
  23148. * iteratee shorthands, that accepts an array of arrays to inspect.
  23149. *
  23150. * @private
  23151. * @param {Array} arrays The arrays to inspect.
  23152. * @param {Function} [iteratee] The iteratee invoked per element.
  23153. * @param {Function} [comparator] The comparator invoked per element.
  23154. * @returns {Array} Returns the new array of values.
  23155. */
  23156. function baseXor(arrays, iteratee, comparator) {
  23157. var length = arrays.length;
  23158. if (length < 2) {
  23159. return length ? baseUniq(arrays[0]) : [];
  23160. }
  23161. var index = -1,
  23162. result = Array(length);
  23163. while (++index < length) {
  23164. var array = arrays[index],
  23165. othIndex = -1;
  23166. while (++othIndex < length) {
  23167. if (othIndex != index) {
  23168. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23169. }
  23170. }
  23171. }
  23172. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23173. }
  23174. /**
  23175. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23176. *
  23177. * @private
  23178. * @param {Array} props The property identifiers.
  23179. * @param {Array} values The property values.
  23180. * @param {Function} assignFunc The function to assign values.
  23181. * @returns {Object} Returns the new object.
  23182. */
  23183. function baseZipObject(props, values, assignFunc) {
  23184. var index = -1,
  23185. length = props.length,
  23186. valsLength = values.length,
  23187. result = {};
  23188. while (++index < length) {
  23189. var value = index < valsLength ? values[index] : undefined;
  23190. assignFunc(result, props[index], value);
  23191. }
  23192. return result;
  23193. }
  23194. /**
  23195. * Casts `value` to an empty array if it's not an array like object.
  23196. *
  23197. * @private
  23198. * @param {*} value The value to inspect.
  23199. * @returns {Array|Object} Returns the cast array-like object.
  23200. */
  23201. function castArrayLikeObject(value) {
  23202. return isArrayLikeObject(value) ? value : [];
  23203. }
  23204. /**
  23205. * Casts `value` to `identity` if it's not a function.
  23206. *
  23207. * @private
  23208. * @param {*} value The value to inspect.
  23209. * @returns {Function} Returns cast function.
  23210. */
  23211. function castFunction(value) {
  23212. return typeof value == 'function' ? value : identity;
  23213. }
  23214. /**
  23215. * Casts `value` to a path array if it's not one.
  23216. *
  23217. * @private
  23218. * @param {*} value The value to inspect.
  23219. * @param {Object} [object] The object to query keys on.
  23220. * @returns {Array} Returns the cast property path array.
  23221. */
  23222. function castPath(value, object) {
  23223. if (isArray(value)) {
  23224. return value;
  23225. }
  23226. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23227. }
  23228. /**
  23229. * A `baseRest` alias which can be replaced with `identity` by module
  23230. * replacement plugins.
  23231. *
  23232. * @private
  23233. * @type {Function}
  23234. * @param {Function} func The function to apply a rest parameter to.
  23235. * @returns {Function} Returns the new function.
  23236. */
  23237. var castRest = baseRest;
  23238. /**
  23239. * Casts `array` to a slice if it's needed.
  23240. *
  23241. * @private
  23242. * @param {Array} array The array to inspect.
  23243. * @param {number} start The start position.
  23244. * @param {number} [end=array.length] The end position.
  23245. * @returns {Array} Returns the cast slice.
  23246. */
  23247. function castSlice(array, start, end) {
  23248. var length = array.length;
  23249. end = end === undefined ? length : end;
  23250. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23251. }
  23252. /**
  23253. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23254. *
  23255. * @private
  23256. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23257. */
  23258. var clearTimeout = ctxClearTimeout || function(id) {
  23259. return root.clearTimeout(id);
  23260. };
  23261. /**
  23262. * Creates a clone of `buffer`.
  23263. *
  23264. * @private
  23265. * @param {Buffer} buffer The buffer to clone.
  23266. * @param {boolean} [isDeep] Specify a deep clone.
  23267. * @returns {Buffer} Returns the cloned buffer.
  23268. */
  23269. function cloneBuffer(buffer, isDeep) {
  23270. if (isDeep) {
  23271. return buffer.slice();
  23272. }
  23273. var length = buffer.length,
  23274. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23275. buffer.copy(result);
  23276. return result;
  23277. }
  23278. /**
  23279. * Creates a clone of `arrayBuffer`.
  23280. *
  23281. * @private
  23282. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23283. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23284. */
  23285. function cloneArrayBuffer(arrayBuffer) {
  23286. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23287. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23288. return result;
  23289. }
  23290. /**
  23291. * Creates a clone of `dataView`.
  23292. *
  23293. * @private
  23294. * @param {Object} dataView The data view to clone.
  23295. * @param {boolean} [isDeep] Specify a deep clone.
  23296. * @returns {Object} Returns the cloned data view.
  23297. */
  23298. function cloneDataView(dataView, isDeep) {
  23299. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23300. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23301. }
  23302. /**
  23303. * Creates a clone of `regexp`.
  23304. *
  23305. * @private
  23306. * @param {Object} regexp The regexp to clone.
  23307. * @returns {Object} Returns the cloned regexp.
  23308. */
  23309. function cloneRegExp(regexp) {
  23310. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23311. result.lastIndex = regexp.lastIndex;
  23312. return result;
  23313. }
  23314. /**
  23315. * Creates a clone of the `symbol` object.
  23316. *
  23317. * @private
  23318. * @param {Object} symbol The symbol object to clone.
  23319. * @returns {Object} Returns the cloned symbol object.
  23320. */
  23321. function cloneSymbol(symbol) {
  23322. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23323. }
  23324. /**
  23325. * Creates a clone of `typedArray`.
  23326. *
  23327. * @private
  23328. * @param {Object} typedArray The typed array to clone.
  23329. * @param {boolean} [isDeep] Specify a deep clone.
  23330. * @returns {Object} Returns the cloned typed array.
  23331. */
  23332. function cloneTypedArray(typedArray, isDeep) {
  23333. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23334. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23335. }
  23336. /**
  23337. * Compares values to sort them in ascending order.
  23338. *
  23339. * @private
  23340. * @param {*} value The value to compare.
  23341. * @param {*} other The other value to compare.
  23342. * @returns {number} Returns the sort order indicator for `value`.
  23343. */
  23344. function compareAscending(value, other) {
  23345. if (value !== other) {
  23346. var valIsDefined = value !== undefined,
  23347. valIsNull = value === null,
  23348. valIsReflexive = value === value,
  23349. valIsSymbol = isSymbol(value);
  23350. var othIsDefined = other !== undefined,
  23351. othIsNull = other === null,
  23352. othIsReflexive = other === other,
  23353. othIsSymbol = isSymbol(other);
  23354. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23355. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23356. (valIsNull && othIsDefined && othIsReflexive) ||
  23357. (!valIsDefined && othIsReflexive) ||
  23358. !valIsReflexive) {
  23359. return 1;
  23360. }
  23361. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23362. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23363. (othIsNull && valIsDefined && valIsReflexive) ||
  23364. (!othIsDefined && valIsReflexive) ||
  23365. !othIsReflexive) {
  23366. return -1;
  23367. }
  23368. }
  23369. return 0;
  23370. }
  23371. /**
  23372. * Used by `_.orderBy` to compare multiple properties of a value to another
  23373. * and stable sort them.
  23374. *
  23375. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23376. * specify an order of "desc" for descending or "asc" for ascending sort order
  23377. * of corresponding values.
  23378. *
  23379. * @private
  23380. * @param {Object} object The object to compare.
  23381. * @param {Object} other The other object to compare.
  23382. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23383. * @returns {number} Returns the sort order indicator for `object`.
  23384. */
  23385. function compareMultiple(object, other, orders) {
  23386. var index = -1,
  23387. objCriteria = object.criteria,
  23388. othCriteria = other.criteria,
  23389. length = objCriteria.length,
  23390. ordersLength = orders.length;
  23391. while (++index < length) {
  23392. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23393. if (result) {
  23394. if (index >= ordersLength) {
  23395. return result;
  23396. }
  23397. var order = orders[index];
  23398. return result * (order == 'desc' ? -1 : 1);
  23399. }
  23400. }
  23401. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23402. // that causes it, under certain circumstances, to provide the same value for
  23403. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23404. // for more details.
  23405. //
  23406. // This also ensures a stable sort in V8 and other engines.
  23407. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23408. return object.index - other.index;
  23409. }
  23410. /**
  23411. * Creates an array that is the composition of partially applied arguments,
  23412. * placeholders, and provided arguments into a single array of arguments.
  23413. *
  23414. * @private
  23415. * @param {Array} args The provided arguments.
  23416. * @param {Array} partials The arguments to prepend to those provided.
  23417. * @param {Array} holders The `partials` placeholder indexes.
  23418. * @params {boolean} [isCurried] Specify composing for a curried function.
  23419. * @returns {Array} Returns the new array of composed arguments.
  23420. */
  23421. function composeArgs(args, partials, holders, isCurried) {
  23422. var argsIndex = -1,
  23423. argsLength = args.length,
  23424. holdersLength = holders.length,
  23425. leftIndex = -1,
  23426. leftLength = partials.length,
  23427. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23428. result = Array(leftLength + rangeLength),
  23429. isUncurried = !isCurried;
  23430. while (++leftIndex < leftLength) {
  23431. result[leftIndex] = partials[leftIndex];
  23432. }
  23433. while (++argsIndex < holdersLength) {
  23434. if (isUncurried || argsIndex < argsLength) {
  23435. result[holders[argsIndex]] = args[argsIndex];
  23436. }
  23437. }
  23438. while (rangeLength--) {
  23439. result[leftIndex++] = args[argsIndex++];
  23440. }
  23441. return result;
  23442. }
  23443. /**
  23444. * This function is like `composeArgs` except that the arguments composition
  23445. * is tailored for `_.partialRight`.
  23446. *
  23447. * @private
  23448. * @param {Array} args The provided arguments.
  23449. * @param {Array} partials The arguments to append to those provided.
  23450. * @param {Array} holders The `partials` placeholder indexes.
  23451. * @params {boolean} [isCurried] Specify composing for a curried function.
  23452. * @returns {Array} Returns the new array of composed arguments.
  23453. */
  23454. function composeArgsRight(args, partials, holders, isCurried) {
  23455. var argsIndex = -1,
  23456. argsLength = args.length,
  23457. holdersIndex = -1,
  23458. holdersLength = holders.length,
  23459. rightIndex = -1,
  23460. rightLength = partials.length,
  23461. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23462. result = Array(rangeLength + rightLength),
  23463. isUncurried = !isCurried;
  23464. while (++argsIndex < rangeLength) {
  23465. result[argsIndex] = args[argsIndex];
  23466. }
  23467. var offset = argsIndex;
  23468. while (++rightIndex < rightLength) {
  23469. result[offset + rightIndex] = partials[rightIndex];
  23470. }
  23471. while (++holdersIndex < holdersLength) {
  23472. if (isUncurried || argsIndex < argsLength) {
  23473. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23474. }
  23475. }
  23476. return result;
  23477. }
  23478. /**
  23479. * Copies the values of `source` to `array`.
  23480. *
  23481. * @private
  23482. * @param {Array} source The array to copy values from.
  23483. * @param {Array} [array=[]] The array to copy values to.
  23484. * @returns {Array} Returns `array`.
  23485. */
  23486. function copyArray(source, array) {
  23487. var index = -1,
  23488. length = source.length;
  23489. array || (array = Array(length));
  23490. while (++index < length) {
  23491. array[index] = source[index];
  23492. }
  23493. return array;
  23494. }
  23495. /**
  23496. * Copies properties of `source` to `object`.
  23497. *
  23498. * @private
  23499. * @param {Object} source The object to copy properties from.
  23500. * @param {Array} props The property identifiers to copy.
  23501. * @param {Object} [object={}] The object to copy properties to.
  23502. * @param {Function} [customizer] The function to customize copied values.
  23503. * @returns {Object} Returns `object`.
  23504. */
  23505. function copyObject(source, props, object, customizer) {
  23506. var isNew = !object;
  23507. object || (object = {});
  23508. var index = -1,
  23509. length = props.length;
  23510. while (++index < length) {
  23511. var key = props[index];
  23512. var newValue = customizer
  23513. ? customizer(object[key], source[key], key, object, source)
  23514. : undefined;
  23515. if (newValue === undefined) {
  23516. newValue = source[key];
  23517. }
  23518. if (isNew) {
  23519. baseAssignValue(object, key, newValue);
  23520. } else {
  23521. assignValue(object, key, newValue);
  23522. }
  23523. }
  23524. return object;
  23525. }
  23526. /**
  23527. * Copies own symbols of `source` to `object`.
  23528. *
  23529. * @private
  23530. * @param {Object} source The object to copy symbols from.
  23531. * @param {Object} [object={}] The object to copy symbols to.
  23532. * @returns {Object} Returns `object`.
  23533. */
  23534. function copySymbols(source, object) {
  23535. return copyObject(source, getSymbols(source), object);
  23536. }
  23537. /**
  23538. * Copies own and inherited symbols of `source` to `object`.
  23539. *
  23540. * @private
  23541. * @param {Object} source The object to copy symbols from.
  23542. * @param {Object} [object={}] The object to copy symbols to.
  23543. * @returns {Object} Returns `object`.
  23544. */
  23545. function copySymbolsIn(source, object) {
  23546. return copyObject(source, getSymbolsIn(source), object);
  23547. }
  23548. /**
  23549. * Creates a function like `_.groupBy`.
  23550. *
  23551. * @private
  23552. * @param {Function} setter The function to set accumulator values.
  23553. * @param {Function} [initializer] The accumulator object initializer.
  23554. * @returns {Function} Returns the new aggregator function.
  23555. */
  23556. function createAggregator(setter, initializer) {
  23557. return function(collection, iteratee) {
  23558. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23559. accumulator = initializer ? initializer() : {};
  23560. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23561. };
  23562. }
  23563. /**
  23564. * Creates a function like `_.assign`.
  23565. *
  23566. * @private
  23567. * @param {Function} assigner The function to assign values.
  23568. * @returns {Function} Returns the new assigner function.
  23569. */
  23570. function createAssigner(assigner) {
  23571. return baseRest(function(object, sources) {
  23572. var index = -1,
  23573. length = sources.length,
  23574. customizer = length > 1 ? sources[length - 1] : undefined,
  23575. guard = length > 2 ? sources[2] : undefined;
  23576. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23577. ? (length--, customizer)
  23578. : undefined;
  23579. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23580. customizer = length < 3 ? undefined : customizer;
  23581. length = 1;
  23582. }
  23583. object = Object(object);
  23584. while (++index < length) {
  23585. var source = sources[index];
  23586. if (source) {
  23587. assigner(object, source, index, customizer);
  23588. }
  23589. }
  23590. return object;
  23591. });
  23592. }
  23593. /**
  23594. * Creates a `baseEach` or `baseEachRight` function.
  23595. *
  23596. * @private
  23597. * @param {Function} eachFunc The function to iterate over a collection.
  23598. * @param {boolean} [fromRight] Specify iterating from right to left.
  23599. * @returns {Function} Returns the new base function.
  23600. */
  23601. function createBaseEach(eachFunc, fromRight) {
  23602. return function(collection, iteratee) {
  23603. if (collection == null) {
  23604. return collection;
  23605. }
  23606. if (!isArrayLike(collection)) {
  23607. return eachFunc(collection, iteratee);
  23608. }
  23609. var length = collection.length,
  23610. index = fromRight ? length : -1,
  23611. iterable = Object(collection);
  23612. while ((fromRight ? index-- : ++index < length)) {
  23613. if (iteratee(iterable[index], index, iterable) === false) {
  23614. break;
  23615. }
  23616. }
  23617. return collection;
  23618. };
  23619. }
  23620. /**
  23621. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23622. *
  23623. * @private
  23624. * @param {boolean} [fromRight] Specify iterating from right to left.
  23625. * @returns {Function} Returns the new base function.
  23626. */
  23627. function createBaseFor(fromRight) {
  23628. return function(object, iteratee, keysFunc) {
  23629. var index = -1,
  23630. iterable = Object(object),
  23631. props = keysFunc(object),
  23632. length = props.length;
  23633. while (length--) {
  23634. var key = props[fromRight ? length : ++index];
  23635. if (iteratee(iterable[key], key, iterable) === false) {
  23636. break;
  23637. }
  23638. }
  23639. return object;
  23640. };
  23641. }
  23642. /**
  23643. * Creates a function that wraps `func` to invoke it with the optional `this`
  23644. * binding of `thisArg`.
  23645. *
  23646. * @private
  23647. * @param {Function} func The function to wrap.
  23648. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23649. * @param {*} [thisArg] The `this` binding of `func`.
  23650. * @returns {Function} Returns the new wrapped function.
  23651. */
  23652. function createBind(func, bitmask, thisArg) {
  23653. var isBind = bitmask & WRAP_BIND_FLAG,
  23654. Ctor = createCtor(func);
  23655. function wrapper() {
  23656. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23657. return fn.apply(isBind ? thisArg : this, arguments);
  23658. }
  23659. return wrapper;
  23660. }
  23661. /**
  23662. * Creates a function like `_.lowerFirst`.
  23663. *
  23664. * @private
  23665. * @param {string} methodName The name of the `String` case method to use.
  23666. * @returns {Function} Returns the new case function.
  23667. */
  23668. function createCaseFirst(methodName) {
  23669. return function(string) {
  23670. string = toString(string);
  23671. var strSymbols = hasUnicode(string)
  23672. ? stringToArray(string)
  23673. : undefined;
  23674. var chr = strSymbols
  23675. ? strSymbols[0]
  23676. : string.charAt(0);
  23677. var trailing = strSymbols
  23678. ? castSlice(strSymbols, 1).join('')
  23679. : string.slice(1);
  23680. return chr[methodName]() + trailing;
  23681. };
  23682. }
  23683. /**
  23684. * Creates a function like `_.camelCase`.
  23685. *
  23686. * @private
  23687. * @param {Function} callback The function to combine each word.
  23688. * @returns {Function} Returns the new compounder function.
  23689. */
  23690. function createCompounder(callback) {
  23691. return function(string) {
  23692. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23693. };
  23694. }
  23695. /**
  23696. * Creates a function that produces an instance of `Ctor` regardless of
  23697. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23698. *
  23699. * @private
  23700. * @param {Function} Ctor The constructor to wrap.
  23701. * @returns {Function} Returns the new wrapped function.
  23702. */
  23703. function createCtor(Ctor) {
  23704. return function() {
  23705. // Use a `switch` statement to work with class constructors. See
  23706. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23707. // for more details.
  23708. var args = arguments;
  23709. switch (args.length) {
  23710. case 0: return new Ctor;
  23711. case 1: return new Ctor(args[0]);
  23712. case 2: return new Ctor(args[0], args[1]);
  23713. case 3: return new Ctor(args[0], args[1], args[2]);
  23714. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23715. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23716. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23717. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23718. }
  23719. var thisBinding = baseCreate(Ctor.prototype),
  23720. result = Ctor.apply(thisBinding, args);
  23721. // Mimic the constructor's `return` behavior.
  23722. // See https://es5.github.io/#x13.2.2 for more details.
  23723. return isObject(result) ? result : thisBinding;
  23724. };
  23725. }
  23726. /**
  23727. * Creates a function that wraps `func` to enable currying.
  23728. *
  23729. * @private
  23730. * @param {Function} func The function to wrap.
  23731. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23732. * @param {number} arity The arity of `func`.
  23733. * @returns {Function} Returns the new wrapped function.
  23734. */
  23735. function createCurry(func, bitmask, arity) {
  23736. var Ctor = createCtor(func);
  23737. function wrapper() {
  23738. var length = arguments.length,
  23739. args = Array(length),
  23740. index = length,
  23741. placeholder = getHolder(wrapper);
  23742. while (index--) {
  23743. args[index] = arguments[index];
  23744. }
  23745. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23746. ? []
  23747. : replaceHolders(args, placeholder);
  23748. length -= holders.length;
  23749. if (length < arity) {
  23750. return createRecurry(
  23751. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23752. args, holders, undefined, undefined, arity - length);
  23753. }
  23754. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23755. return apply(fn, this, args);
  23756. }
  23757. return wrapper;
  23758. }
  23759. /**
  23760. * Creates a `_.find` or `_.findLast` function.
  23761. *
  23762. * @private
  23763. * @param {Function} findIndexFunc The function to find the collection index.
  23764. * @returns {Function} Returns the new find function.
  23765. */
  23766. function createFind(findIndexFunc) {
  23767. return function(collection, predicate, fromIndex) {
  23768. var iterable = Object(collection);
  23769. if (!isArrayLike(collection)) {
  23770. var iteratee = getIteratee(predicate, 3);
  23771. collection = keys(collection);
  23772. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23773. }
  23774. var index = findIndexFunc(collection, predicate, fromIndex);
  23775. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23776. };
  23777. }
  23778. /**
  23779. * Creates a `_.flow` or `_.flowRight` function.
  23780. *
  23781. * @private
  23782. * @param {boolean} [fromRight] Specify iterating from right to left.
  23783. * @returns {Function} Returns the new flow function.
  23784. */
  23785. function createFlow(fromRight) {
  23786. return flatRest(function(funcs) {
  23787. var length = funcs.length,
  23788. index = length,
  23789. prereq = LodashWrapper.prototype.thru;
  23790. if (fromRight) {
  23791. funcs.reverse();
  23792. }
  23793. while (index--) {
  23794. var func = funcs[index];
  23795. if (typeof func != 'function') {
  23796. throw new TypeError(FUNC_ERROR_TEXT);
  23797. }
  23798. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23799. var wrapper = new LodashWrapper([], true);
  23800. }
  23801. }
  23802. index = wrapper ? index : length;
  23803. while (++index < length) {
  23804. func = funcs[index];
  23805. var funcName = getFuncName(func),
  23806. data = funcName == 'wrapper' ? getData(func) : undefined;
  23807. if (data && isLaziable(data[0]) &&
  23808. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23809. !data[4].length && data[9] == 1
  23810. ) {
  23811. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23812. } else {
  23813. wrapper = (func.length == 1 && isLaziable(func))
  23814. ? wrapper[funcName]()
  23815. : wrapper.thru(func);
  23816. }
  23817. }
  23818. return function() {
  23819. var args = arguments,
  23820. value = args[0];
  23821. if (wrapper && args.length == 1 && isArray(value)) {
  23822. return wrapper.plant(value).value();
  23823. }
  23824. var index = 0,
  23825. result = length ? funcs[index].apply(this, args) : value;
  23826. while (++index < length) {
  23827. result = funcs[index].call(this, result);
  23828. }
  23829. return result;
  23830. };
  23831. });
  23832. }
  23833. /**
  23834. * Creates a function that wraps `func` to invoke it with optional `this`
  23835. * binding of `thisArg`, partial application, and currying.
  23836. *
  23837. * @private
  23838. * @param {Function|string} func The function or method name to wrap.
  23839. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23840. * @param {*} [thisArg] The `this` binding of `func`.
  23841. * @param {Array} [partials] The arguments to prepend to those provided to
  23842. * the new function.
  23843. * @param {Array} [holders] The `partials` placeholder indexes.
  23844. * @param {Array} [partialsRight] The arguments to append to those provided
  23845. * to the new function.
  23846. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23847. * @param {Array} [argPos] The argument positions of the new function.
  23848. * @param {number} [ary] The arity cap of `func`.
  23849. * @param {number} [arity] The arity of `func`.
  23850. * @returns {Function} Returns the new wrapped function.
  23851. */
  23852. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23853. var isAry = bitmask & WRAP_ARY_FLAG,
  23854. isBind = bitmask & WRAP_BIND_FLAG,
  23855. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23856. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23857. isFlip = bitmask & WRAP_FLIP_FLAG,
  23858. Ctor = isBindKey ? undefined : createCtor(func);
  23859. function wrapper() {
  23860. var length = arguments.length,
  23861. args = Array(length),
  23862. index = length;
  23863. while (index--) {
  23864. args[index] = arguments[index];
  23865. }
  23866. if (isCurried) {
  23867. var placeholder = getHolder(wrapper),
  23868. holdersCount = countHolders(args, placeholder);
  23869. }
  23870. if (partials) {
  23871. args = composeArgs(args, partials, holders, isCurried);
  23872. }
  23873. if (partialsRight) {
  23874. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23875. }
  23876. length -= holdersCount;
  23877. if (isCurried && length < arity) {
  23878. var newHolders = replaceHolders(args, placeholder);
  23879. return createRecurry(
  23880. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23881. args, newHolders, argPos, ary, arity - length
  23882. );
  23883. }
  23884. var thisBinding = isBind ? thisArg : this,
  23885. fn = isBindKey ? thisBinding[func] : func;
  23886. length = args.length;
  23887. if (argPos) {
  23888. args = reorder(args, argPos);
  23889. } else if (isFlip && length > 1) {
  23890. args.reverse();
  23891. }
  23892. if (isAry && ary < length) {
  23893. args.length = ary;
  23894. }
  23895. if (this && this !== root && this instanceof wrapper) {
  23896. fn = Ctor || createCtor(fn);
  23897. }
  23898. return fn.apply(thisBinding, args);
  23899. }
  23900. return wrapper;
  23901. }
  23902. /**
  23903. * Creates a function like `_.invertBy`.
  23904. *
  23905. * @private
  23906. * @param {Function} setter The function to set accumulator values.
  23907. * @param {Function} toIteratee The function to resolve iteratees.
  23908. * @returns {Function} Returns the new inverter function.
  23909. */
  23910. function createInverter(setter, toIteratee) {
  23911. return function(object, iteratee) {
  23912. return baseInverter(object, setter, toIteratee(iteratee), {});
  23913. };
  23914. }
  23915. /**
  23916. * Creates a function that performs a mathematical operation on two values.
  23917. *
  23918. * @private
  23919. * @param {Function} operator The function to perform the operation.
  23920. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23921. * @returns {Function} Returns the new mathematical operation function.
  23922. */
  23923. function createMathOperation(operator, defaultValue) {
  23924. return function(value, other) {
  23925. var result;
  23926. if (value === undefined && other === undefined) {
  23927. return defaultValue;
  23928. }
  23929. if (value !== undefined) {
  23930. result = value;
  23931. }
  23932. if (other !== undefined) {
  23933. if (result === undefined) {
  23934. return other;
  23935. }
  23936. if (typeof value == 'string' || typeof other == 'string') {
  23937. value = baseToString(value);
  23938. other = baseToString(other);
  23939. } else {
  23940. value = baseToNumber(value);
  23941. other = baseToNumber(other);
  23942. }
  23943. result = operator(value, other);
  23944. }
  23945. return result;
  23946. };
  23947. }
  23948. /**
  23949. * Creates a function like `_.over`.
  23950. *
  23951. * @private
  23952. * @param {Function} arrayFunc The function to iterate over iteratees.
  23953. * @returns {Function} Returns the new over function.
  23954. */
  23955. function createOver(arrayFunc) {
  23956. return flatRest(function(iteratees) {
  23957. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23958. return baseRest(function(args) {
  23959. var thisArg = this;
  23960. return arrayFunc(iteratees, function(iteratee) {
  23961. return apply(iteratee, thisArg, args);
  23962. });
  23963. });
  23964. });
  23965. }
  23966. /**
  23967. * Creates the padding for `string` based on `length`. The `chars` string
  23968. * is truncated if the number of characters exceeds `length`.
  23969. *
  23970. * @private
  23971. * @param {number} length The padding length.
  23972. * @param {string} [chars=' '] The string used as padding.
  23973. * @returns {string} Returns the padding for `string`.
  23974. */
  23975. function createPadding(length, chars) {
  23976. chars = chars === undefined ? ' ' : baseToString(chars);
  23977. var charsLength = chars.length;
  23978. if (charsLength < 2) {
  23979. return charsLength ? baseRepeat(chars, length) : chars;
  23980. }
  23981. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23982. return hasUnicode(chars)
  23983. ? castSlice(stringToArray(result), 0, length).join('')
  23984. : result.slice(0, length);
  23985. }
  23986. /**
  23987. * Creates a function that wraps `func` to invoke it with the `this` binding
  23988. * of `thisArg` and `partials` prepended to the arguments it receives.
  23989. *
  23990. * @private
  23991. * @param {Function} func The function to wrap.
  23992. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23993. * @param {*} thisArg The `this` binding of `func`.
  23994. * @param {Array} partials The arguments to prepend to those provided to
  23995. * the new function.
  23996. * @returns {Function} Returns the new wrapped function.
  23997. */
  23998. function createPartial(func, bitmask, thisArg, partials) {
  23999. var isBind = bitmask & WRAP_BIND_FLAG,
  24000. Ctor = createCtor(func);
  24001. function wrapper() {
  24002. var argsIndex = -1,
  24003. argsLength = arguments.length,
  24004. leftIndex = -1,
  24005. leftLength = partials.length,
  24006. args = Array(leftLength + argsLength),
  24007. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  24008. while (++leftIndex < leftLength) {
  24009. args[leftIndex] = partials[leftIndex];
  24010. }
  24011. while (argsLength--) {
  24012. args[leftIndex++] = arguments[++argsIndex];
  24013. }
  24014. return apply(fn, isBind ? thisArg : this, args);
  24015. }
  24016. return wrapper;
  24017. }
  24018. /**
  24019. * Creates a `_.range` or `_.rangeRight` function.
  24020. *
  24021. * @private
  24022. * @param {boolean} [fromRight] Specify iterating from right to left.
  24023. * @returns {Function} Returns the new range function.
  24024. */
  24025. function createRange(fromRight) {
  24026. return function(start, end, step) {
  24027. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24028. end = step = undefined;
  24029. }
  24030. // Ensure the sign of `-0` is preserved.
  24031. start = toFinite(start);
  24032. if (end === undefined) {
  24033. end = start;
  24034. start = 0;
  24035. } else {
  24036. end = toFinite(end);
  24037. }
  24038. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24039. return baseRange(start, end, step, fromRight);
  24040. };
  24041. }
  24042. /**
  24043. * Creates a function that performs a relational operation on two values.
  24044. *
  24045. * @private
  24046. * @param {Function} operator The function to perform the operation.
  24047. * @returns {Function} Returns the new relational operation function.
  24048. */
  24049. function createRelationalOperation(operator) {
  24050. return function(value, other) {
  24051. if (!(typeof value == 'string' && typeof other == 'string')) {
  24052. value = toNumber(value);
  24053. other = toNumber(other);
  24054. }
  24055. return operator(value, other);
  24056. };
  24057. }
  24058. /**
  24059. * Creates a function that wraps `func` to continue currying.
  24060. *
  24061. * @private
  24062. * @param {Function} func The function to wrap.
  24063. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24064. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24065. * @param {*} placeholder The placeholder value.
  24066. * @param {*} [thisArg] The `this` binding of `func`.
  24067. * @param {Array} [partials] The arguments to prepend to those provided to
  24068. * the new function.
  24069. * @param {Array} [holders] The `partials` placeholder indexes.
  24070. * @param {Array} [argPos] The argument positions of the new function.
  24071. * @param {number} [ary] The arity cap of `func`.
  24072. * @param {number} [arity] The arity of `func`.
  24073. * @returns {Function} Returns the new wrapped function.
  24074. */
  24075. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24076. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24077. newHolders = isCurry ? holders : undefined,
  24078. newHoldersRight = isCurry ? undefined : holders,
  24079. newPartials = isCurry ? partials : undefined,
  24080. newPartialsRight = isCurry ? undefined : partials;
  24081. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24082. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24083. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24084. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24085. }
  24086. var newData = [
  24087. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24088. newHoldersRight, argPos, ary, arity
  24089. ];
  24090. var result = wrapFunc.apply(undefined, newData);
  24091. if (isLaziable(func)) {
  24092. setData(result, newData);
  24093. }
  24094. result.placeholder = placeholder;
  24095. return setWrapToString(result, func, bitmask);
  24096. }
  24097. /**
  24098. * Creates a function like `_.round`.
  24099. *
  24100. * @private
  24101. * @param {string} methodName The name of the `Math` method to use when rounding.
  24102. * @returns {Function} Returns the new round function.
  24103. */
  24104. function createRound(methodName) {
  24105. var func = Math[methodName];
  24106. return function(number, precision) {
  24107. number = toNumber(number);
  24108. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24109. if (precision && nativeIsFinite(number)) {
  24110. // Shift with exponential notation to avoid floating-point issues.
  24111. // See [MDN](https://mdn.io/round#Examples) for more details.
  24112. var pair = (toString(number) + 'e').split('e'),
  24113. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24114. pair = (toString(value) + 'e').split('e');
  24115. return +(pair[0] + 'e' + (+pair[1] - precision));
  24116. }
  24117. return func(number);
  24118. };
  24119. }
  24120. /**
  24121. * Creates a set object of `values`.
  24122. *
  24123. * @private
  24124. * @param {Array} values The values to add to the set.
  24125. * @returns {Object} Returns the new set.
  24126. */
  24127. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24128. return new Set(values);
  24129. };
  24130. /**
  24131. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24132. *
  24133. * @private
  24134. * @param {Function} keysFunc The function to get the keys of a given object.
  24135. * @returns {Function} Returns the new pairs function.
  24136. */
  24137. function createToPairs(keysFunc) {
  24138. return function(object) {
  24139. var tag = getTag(object);
  24140. if (tag == mapTag) {
  24141. return mapToArray(object);
  24142. }
  24143. if (tag == setTag) {
  24144. return setToPairs(object);
  24145. }
  24146. return baseToPairs(object, keysFunc(object));
  24147. };
  24148. }
  24149. /**
  24150. * Creates a function that either curries or invokes `func` with optional
  24151. * `this` binding and partially applied arguments.
  24152. *
  24153. * @private
  24154. * @param {Function|string} func The function or method name to wrap.
  24155. * @param {number} bitmask The bitmask flags.
  24156. * 1 - `_.bind`
  24157. * 2 - `_.bindKey`
  24158. * 4 - `_.curry` or `_.curryRight` of a bound function
  24159. * 8 - `_.curry`
  24160. * 16 - `_.curryRight`
  24161. * 32 - `_.partial`
  24162. * 64 - `_.partialRight`
  24163. * 128 - `_.rearg`
  24164. * 256 - `_.ary`
  24165. * 512 - `_.flip`
  24166. * @param {*} [thisArg] The `this` binding of `func`.
  24167. * @param {Array} [partials] The arguments to be partially applied.
  24168. * @param {Array} [holders] The `partials` placeholder indexes.
  24169. * @param {Array} [argPos] The argument positions of the new function.
  24170. * @param {number} [ary] The arity cap of `func`.
  24171. * @param {number} [arity] The arity of `func`.
  24172. * @returns {Function} Returns the new wrapped function.
  24173. */
  24174. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24175. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24176. if (!isBindKey && typeof func != 'function') {
  24177. throw new TypeError(FUNC_ERROR_TEXT);
  24178. }
  24179. var length = partials ? partials.length : 0;
  24180. if (!length) {
  24181. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24182. partials = holders = undefined;
  24183. }
  24184. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24185. arity = arity === undefined ? arity : toInteger(arity);
  24186. length -= holders ? holders.length : 0;
  24187. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24188. var partialsRight = partials,
  24189. holdersRight = holders;
  24190. partials = holders = undefined;
  24191. }
  24192. var data = isBindKey ? undefined : getData(func);
  24193. var newData = [
  24194. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24195. argPos, ary, arity
  24196. ];
  24197. if (data) {
  24198. mergeData(newData, data);
  24199. }
  24200. func = newData[0];
  24201. bitmask = newData[1];
  24202. thisArg = newData[2];
  24203. partials = newData[3];
  24204. holders = newData[4];
  24205. arity = newData[9] = newData[9] === undefined
  24206. ? (isBindKey ? 0 : func.length)
  24207. : nativeMax(newData[9] - length, 0);
  24208. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24209. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24210. }
  24211. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24212. var result = createBind(func, bitmask, thisArg);
  24213. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24214. result = createCurry(func, bitmask, arity);
  24215. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24216. result = createPartial(func, bitmask, thisArg, partials);
  24217. } else {
  24218. result = createHybrid.apply(undefined, newData);
  24219. }
  24220. var setter = data ? baseSetData : setData;
  24221. return setWrapToString(setter(result, newData), func, bitmask);
  24222. }
  24223. /**
  24224. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24225. * of source objects to the destination object for all destination properties
  24226. * that resolve to `undefined`.
  24227. *
  24228. * @private
  24229. * @param {*} objValue The destination value.
  24230. * @param {*} srcValue The source value.
  24231. * @param {string} key The key of the property to assign.
  24232. * @param {Object} object The parent object of `objValue`.
  24233. * @returns {*} Returns the value to assign.
  24234. */
  24235. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24236. if (objValue === undefined ||
  24237. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24238. return srcValue;
  24239. }
  24240. return objValue;
  24241. }
  24242. /**
  24243. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24244. * objects into destination objects that are passed thru.
  24245. *
  24246. * @private
  24247. * @param {*} objValue The destination value.
  24248. * @param {*} srcValue The source value.
  24249. * @param {string} key The key of the property to merge.
  24250. * @param {Object} object The parent object of `objValue`.
  24251. * @param {Object} source The parent object of `srcValue`.
  24252. * @param {Object} [stack] Tracks traversed source values and their merged
  24253. * counterparts.
  24254. * @returns {*} Returns the value to assign.
  24255. */
  24256. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24257. if (isObject(objValue) && isObject(srcValue)) {
  24258. // Recursively merge objects and arrays (susceptible to call stack limits).
  24259. stack.set(srcValue, objValue);
  24260. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24261. stack['delete'](srcValue);
  24262. }
  24263. return objValue;
  24264. }
  24265. /**
  24266. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24267. * objects.
  24268. *
  24269. * @private
  24270. * @param {*} value The value to inspect.
  24271. * @param {string} key The key of the property to inspect.
  24272. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24273. */
  24274. function customOmitClone(value) {
  24275. return isPlainObject(value) ? undefined : value;
  24276. }
  24277. /**
  24278. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24279. * partial deep comparisons.
  24280. *
  24281. * @private
  24282. * @param {Array} array The array to compare.
  24283. * @param {Array} other The other array to compare.
  24284. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24285. * @param {Function} customizer The function to customize comparisons.
  24286. * @param {Function} equalFunc The function to determine equivalents of values.
  24287. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24288. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24289. */
  24290. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24291. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24292. arrLength = array.length,
  24293. othLength = other.length;
  24294. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24295. return false;
  24296. }
  24297. // Assume cyclic values are equal.
  24298. var stacked = stack.get(array);
  24299. if (stacked && stack.get(other)) {
  24300. return stacked == other;
  24301. }
  24302. var index = -1,
  24303. result = true,
  24304. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24305. stack.set(array, other);
  24306. stack.set(other, array);
  24307. // Ignore non-index properties.
  24308. while (++index < arrLength) {
  24309. var arrValue = array[index],
  24310. othValue = other[index];
  24311. if (customizer) {
  24312. var compared = isPartial
  24313. ? customizer(othValue, arrValue, index, other, array, stack)
  24314. : customizer(arrValue, othValue, index, array, other, stack);
  24315. }
  24316. if (compared !== undefined) {
  24317. if (compared) {
  24318. continue;
  24319. }
  24320. result = false;
  24321. break;
  24322. }
  24323. // Recursively compare arrays (susceptible to call stack limits).
  24324. if (seen) {
  24325. if (!arraySome(other, function(othValue, othIndex) {
  24326. if (!cacheHas(seen, othIndex) &&
  24327. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24328. return seen.push(othIndex);
  24329. }
  24330. })) {
  24331. result = false;
  24332. break;
  24333. }
  24334. } else if (!(
  24335. arrValue === othValue ||
  24336. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24337. )) {
  24338. result = false;
  24339. break;
  24340. }
  24341. }
  24342. stack['delete'](array);
  24343. stack['delete'](other);
  24344. return result;
  24345. }
  24346. /**
  24347. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24348. * the same `toStringTag`.
  24349. *
  24350. * **Note:** This function only supports comparing values with tags of
  24351. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24352. *
  24353. * @private
  24354. * @param {Object} object The object to compare.
  24355. * @param {Object} other The other object to compare.
  24356. * @param {string} tag The `toStringTag` of the objects to compare.
  24357. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24358. * @param {Function} customizer The function to customize comparisons.
  24359. * @param {Function} equalFunc The function to determine equivalents of values.
  24360. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24361. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24362. */
  24363. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24364. switch (tag) {
  24365. case dataViewTag:
  24366. if ((object.byteLength != other.byteLength) ||
  24367. (object.byteOffset != other.byteOffset)) {
  24368. return false;
  24369. }
  24370. object = object.buffer;
  24371. other = other.buffer;
  24372. case arrayBufferTag:
  24373. if ((object.byteLength != other.byteLength) ||
  24374. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24375. return false;
  24376. }
  24377. return true;
  24378. case boolTag:
  24379. case dateTag:
  24380. case numberTag:
  24381. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24382. // Invalid dates are coerced to `NaN`.
  24383. return eq(+object, +other);
  24384. case errorTag:
  24385. return object.name == other.name && object.message == other.message;
  24386. case regexpTag:
  24387. case stringTag:
  24388. // Coerce regexes to strings and treat strings, primitives and objects,
  24389. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24390. // for more details.
  24391. return object == (other + '');
  24392. case mapTag:
  24393. var convert = mapToArray;
  24394. case setTag:
  24395. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24396. convert || (convert = setToArray);
  24397. if (object.size != other.size && !isPartial) {
  24398. return false;
  24399. }
  24400. // Assume cyclic values are equal.
  24401. var stacked = stack.get(object);
  24402. if (stacked) {
  24403. return stacked == other;
  24404. }
  24405. bitmask |= COMPARE_UNORDERED_FLAG;
  24406. // Recursively compare objects (susceptible to call stack limits).
  24407. stack.set(object, other);
  24408. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24409. stack['delete'](object);
  24410. return result;
  24411. case symbolTag:
  24412. if (symbolValueOf) {
  24413. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24414. }
  24415. }
  24416. return false;
  24417. }
  24418. /**
  24419. * A specialized version of `baseIsEqualDeep` for objects with support for
  24420. * partial deep comparisons.
  24421. *
  24422. * @private
  24423. * @param {Object} object The object to compare.
  24424. * @param {Object} other The other object to compare.
  24425. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24426. * @param {Function} customizer The function to customize comparisons.
  24427. * @param {Function} equalFunc The function to determine equivalents of values.
  24428. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24429. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24430. */
  24431. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24432. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24433. objProps = getAllKeys(object),
  24434. objLength = objProps.length,
  24435. othProps = getAllKeys(other),
  24436. othLength = othProps.length;
  24437. if (objLength != othLength && !isPartial) {
  24438. return false;
  24439. }
  24440. var index = objLength;
  24441. while (index--) {
  24442. var key = objProps[index];
  24443. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24444. return false;
  24445. }
  24446. }
  24447. // Assume cyclic values are equal.
  24448. var stacked = stack.get(object);
  24449. if (stacked && stack.get(other)) {
  24450. return stacked == other;
  24451. }
  24452. var result = true;
  24453. stack.set(object, other);
  24454. stack.set(other, object);
  24455. var skipCtor = isPartial;
  24456. while (++index < objLength) {
  24457. key = objProps[index];
  24458. var objValue = object[key],
  24459. othValue = other[key];
  24460. if (customizer) {
  24461. var compared = isPartial
  24462. ? customizer(othValue, objValue, key, other, object, stack)
  24463. : customizer(objValue, othValue, key, object, other, stack);
  24464. }
  24465. // Recursively compare objects (susceptible to call stack limits).
  24466. if (!(compared === undefined
  24467. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24468. : compared
  24469. )) {
  24470. result = false;
  24471. break;
  24472. }
  24473. skipCtor || (skipCtor = key == 'constructor');
  24474. }
  24475. if (result && !skipCtor) {
  24476. var objCtor = object.constructor,
  24477. othCtor = other.constructor;
  24478. // Non `Object` object instances with different constructors are not equal.
  24479. if (objCtor != othCtor &&
  24480. ('constructor' in object && 'constructor' in other) &&
  24481. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24482. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24483. result = false;
  24484. }
  24485. }
  24486. stack['delete'](object);
  24487. stack['delete'](other);
  24488. return result;
  24489. }
  24490. /**
  24491. * A specialized version of `baseRest` which flattens the rest array.
  24492. *
  24493. * @private
  24494. * @param {Function} func The function to apply a rest parameter to.
  24495. * @returns {Function} Returns the new function.
  24496. */
  24497. function flatRest(func) {
  24498. return setToString(overRest(func, undefined, flatten), func + '');
  24499. }
  24500. /**
  24501. * Creates an array of own enumerable property names and symbols of `object`.
  24502. *
  24503. * @private
  24504. * @param {Object} object The object to query.
  24505. * @returns {Array} Returns the array of property names and symbols.
  24506. */
  24507. function getAllKeys(object) {
  24508. return baseGetAllKeys(object, keys, getSymbols);
  24509. }
  24510. /**
  24511. * Creates an array of own and inherited enumerable property names and
  24512. * symbols of `object`.
  24513. *
  24514. * @private
  24515. * @param {Object} object The object to query.
  24516. * @returns {Array} Returns the array of property names and symbols.
  24517. */
  24518. function getAllKeysIn(object) {
  24519. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24520. }
  24521. /**
  24522. * Gets metadata for `func`.
  24523. *
  24524. * @private
  24525. * @param {Function} func The function to query.
  24526. * @returns {*} Returns the metadata for `func`.
  24527. */
  24528. var getData = !metaMap ? noop : function(func) {
  24529. return metaMap.get(func);
  24530. };
  24531. /**
  24532. * Gets the name of `func`.
  24533. *
  24534. * @private
  24535. * @param {Function} func The function to query.
  24536. * @returns {string} Returns the function name.
  24537. */
  24538. function getFuncName(func) {
  24539. var result = (func.name + ''),
  24540. array = realNames[result],
  24541. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24542. while (length--) {
  24543. var data = array[length],
  24544. otherFunc = data.func;
  24545. if (otherFunc == null || otherFunc == func) {
  24546. return data.name;
  24547. }
  24548. }
  24549. return result;
  24550. }
  24551. /**
  24552. * Gets the argument placeholder value for `func`.
  24553. *
  24554. * @private
  24555. * @param {Function} func The function to inspect.
  24556. * @returns {*} Returns the placeholder value.
  24557. */
  24558. function getHolder(func) {
  24559. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24560. return object.placeholder;
  24561. }
  24562. /**
  24563. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24564. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24565. * If arguments are provided, the chosen function is invoked with them and
  24566. * its result is returned.
  24567. *
  24568. * @private
  24569. * @param {*} [value] The value to convert to an iteratee.
  24570. * @param {number} [arity] The arity of the created iteratee.
  24571. * @returns {Function} Returns the chosen function or its result.
  24572. */
  24573. function getIteratee() {
  24574. var result = lodash.iteratee || iteratee;
  24575. result = result === iteratee ? baseIteratee : result;
  24576. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24577. }
  24578. /**
  24579. * Gets the data for `map`.
  24580. *
  24581. * @private
  24582. * @param {Object} map The map to query.
  24583. * @param {string} key The reference key.
  24584. * @returns {*} Returns the map data.
  24585. */
  24586. function getMapData(map, key) {
  24587. var data = map.__data__;
  24588. return isKeyable(key)
  24589. ? data[typeof key == 'string' ? 'string' : 'hash']
  24590. : data.map;
  24591. }
  24592. /**
  24593. * Gets the property names, values, and compare flags of `object`.
  24594. *
  24595. * @private
  24596. * @param {Object} object The object to query.
  24597. * @returns {Array} Returns the match data of `object`.
  24598. */
  24599. function getMatchData(object) {
  24600. var result = keys(object),
  24601. length = result.length;
  24602. while (length--) {
  24603. var key = result[length],
  24604. value = object[key];
  24605. result[length] = [key, value, isStrictComparable(value)];
  24606. }
  24607. return result;
  24608. }
  24609. /**
  24610. * Gets the native function at `key` of `object`.
  24611. *
  24612. * @private
  24613. * @param {Object} object The object to query.
  24614. * @param {string} key The key of the method to get.
  24615. * @returns {*} Returns the function if it's native, else `undefined`.
  24616. */
  24617. function getNative(object, key) {
  24618. var value = getValue(object, key);
  24619. return baseIsNative(value) ? value : undefined;
  24620. }
  24621. /**
  24622. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24623. *
  24624. * @private
  24625. * @param {*} value The value to query.
  24626. * @returns {string} Returns the raw `toStringTag`.
  24627. */
  24628. function getRawTag(value) {
  24629. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24630. tag = value[symToStringTag];
  24631. try {
  24632. value[symToStringTag] = undefined;
  24633. var unmasked = true;
  24634. } catch (e) {}
  24635. var result = nativeObjectToString.call(value);
  24636. if (unmasked) {
  24637. if (isOwn) {
  24638. value[symToStringTag] = tag;
  24639. } else {
  24640. delete value[symToStringTag];
  24641. }
  24642. }
  24643. return result;
  24644. }
  24645. /**
  24646. * Creates an array of the own enumerable symbols of `object`.
  24647. *
  24648. * @private
  24649. * @param {Object} object The object to query.
  24650. * @returns {Array} Returns the array of symbols.
  24651. */
  24652. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24653. if (object == null) {
  24654. return [];
  24655. }
  24656. object = Object(object);
  24657. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24658. return propertyIsEnumerable.call(object, symbol);
  24659. });
  24660. };
  24661. /**
  24662. * Creates an array of the own and inherited enumerable symbols of `object`.
  24663. *
  24664. * @private
  24665. * @param {Object} object The object to query.
  24666. * @returns {Array} Returns the array of symbols.
  24667. */
  24668. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24669. var result = [];
  24670. while (object) {
  24671. arrayPush(result, getSymbols(object));
  24672. object = getPrototype(object);
  24673. }
  24674. return result;
  24675. };
  24676. /**
  24677. * Gets the `toStringTag` of `value`.
  24678. *
  24679. * @private
  24680. * @param {*} value The value to query.
  24681. * @returns {string} Returns the `toStringTag`.
  24682. */
  24683. var getTag = baseGetTag;
  24684. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24685. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24686. (Map && getTag(new Map) != mapTag) ||
  24687. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24688. (Set && getTag(new Set) != setTag) ||
  24689. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24690. getTag = function(value) {
  24691. var result = baseGetTag(value),
  24692. Ctor = result == objectTag ? value.constructor : undefined,
  24693. ctorString = Ctor ? toSource(Ctor) : '';
  24694. if (ctorString) {
  24695. switch (ctorString) {
  24696. case dataViewCtorString: return dataViewTag;
  24697. case mapCtorString: return mapTag;
  24698. case promiseCtorString: return promiseTag;
  24699. case setCtorString: return setTag;
  24700. case weakMapCtorString: return weakMapTag;
  24701. }
  24702. }
  24703. return result;
  24704. };
  24705. }
  24706. /**
  24707. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24708. *
  24709. * @private
  24710. * @param {number} start The start of the view.
  24711. * @param {number} end The end of the view.
  24712. * @param {Array} transforms The transformations to apply to the view.
  24713. * @returns {Object} Returns an object containing the `start` and `end`
  24714. * positions of the view.
  24715. */
  24716. function getView(start, end, transforms) {
  24717. var index = -1,
  24718. length = transforms.length;
  24719. while (++index < length) {
  24720. var data = transforms[index],
  24721. size = data.size;
  24722. switch (data.type) {
  24723. case 'drop': start += size; break;
  24724. case 'dropRight': end -= size; break;
  24725. case 'take': end = nativeMin(end, start + size); break;
  24726. case 'takeRight': start = nativeMax(start, end - size); break;
  24727. }
  24728. }
  24729. return { 'start': start, 'end': end };
  24730. }
  24731. /**
  24732. * Extracts wrapper details from the `source` body comment.
  24733. *
  24734. * @private
  24735. * @param {string} source The source to inspect.
  24736. * @returns {Array} Returns the wrapper details.
  24737. */
  24738. function getWrapDetails(source) {
  24739. var match = source.match(reWrapDetails);
  24740. return match ? match[1].split(reSplitDetails) : [];
  24741. }
  24742. /**
  24743. * Checks if `path` exists on `object`.
  24744. *
  24745. * @private
  24746. * @param {Object} object The object to query.
  24747. * @param {Array|string} path The path to check.
  24748. * @param {Function} hasFunc The function to check properties.
  24749. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24750. */
  24751. function hasPath(object, path, hasFunc) {
  24752. path = castPath(path, object);
  24753. var index = -1,
  24754. length = path.length,
  24755. result = false;
  24756. while (++index < length) {
  24757. var key = toKey(path[index]);
  24758. if (!(result = object != null && hasFunc(object, key))) {
  24759. break;
  24760. }
  24761. object = object[key];
  24762. }
  24763. if (result || ++index != length) {
  24764. return result;
  24765. }
  24766. length = object == null ? 0 : object.length;
  24767. return !!length && isLength(length) && isIndex(key, length) &&
  24768. (isArray(object) || isArguments(object));
  24769. }
  24770. /**
  24771. * Initializes an array clone.
  24772. *
  24773. * @private
  24774. * @param {Array} array The array to clone.
  24775. * @returns {Array} Returns the initialized clone.
  24776. */
  24777. function initCloneArray(array) {
  24778. var length = array.length,
  24779. result = new array.constructor(length);
  24780. // Add properties assigned by `RegExp#exec`.
  24781. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24782. result.index = array.index;
  24783. result.input = array.input;
  24784. }
  24785. return result;
  24786. }
  24787. /**
  24788. * Initializes an object clone.
  24789. *
  24790. * @private
  24791. * @param {Object} object The object to clone.
  24792. * @returns {Object} Returns the initialized clone.
  24793. */
  24794. function initCloneObject(object) {
  24795. return (typeof object.constructor == 'function' && !isPrototype(object))
  24796. ? baseCreate(getPrototype(object))
  24797. : {};
  24798. }
  24799. /**
  24800. * Initializes an object clone based on its `toStringTag`.
  24801. *
  24802. * **Note:** This function only supports cloning values with tags of
  24803. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24804. *
  24805. * @private
  24806. * @param {Object} object The object to clone.
  24807. * @param {string} tag The `toStringTag` of the object to clone.
  24808. * @param {boolean} [isDeep] Specify a deep clone.
  24809. * @returns {Object} Returns the initialized clone.
  24810. */
  24811. function initCloneByTag(object, tag, isDeep) {
  24812. var Ctor = object.constructor;
  24813. switch (tag) {
  24814. case arrayBufferTag:
  24815. return cloneArrayBuffer(object);
  24816. case boolTag:
  24817. case dateTag:
  24818. return new Ctor(+object);
  24819. case dataViewTag:
  24820. return cloneDataView(object, isDeep);
  24821. case float32Tag: case float64Tag:
  24822. case int8Tag: case int16Tag: case int32Tag:
  24823. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24824. return cloneTypedArray(object, isDeep);
  24825. case mapTag:
  24826. return new Ctor;
  24827. case numberTag:
  24828. case stringTag:
  24829. return new Ctor(object);
  24830. case regexpTag:
  24831. return cloneRegExp(object);
  24832. case setTag:
  24833. return new Ctor;
  24834. case symbolTag:
  24835. return cloneSymbol(object);
  24836. }
  24837. }
  24838. /**
  24839. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24840. *
  24841. * @private
  24842. * @param {string} source The source to modify.
  24843. * @returns {Array} details The details to insert.
  24844. * @returns {string} Returns the modified source.
  24845. */
  24846. function insertWrapDetails(source, details) {
  24847. var length = details.length;
  24848. if (!length) {
  24849. return source;
  24850. }
  24851. var lastIndex = length - 1;
  24852. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24853. details = details.join(length > 2 ? ', ' : ' ');
  24854. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24855. }
  24856. /**
  24857. * Checks if `value` is a flattenable `arguments` object or array.
  24858. *
  24859. * @private
  24860. * @param {*} value The value to check.
  24861. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24862. */
  24863. function isFlattenable(value) {
  24864. return isArray(value) || isArguments(value) ||
  24865. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24866. }
  24867. /**
  24868. * Checks if `value` is a valid array-like index.
  24869. *
  24870. * @private
  24871. * @param {*} value The value to check.
  24872. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24873. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24874. */
  24875. function isIndex(value, length) {
  24876. var type = typeof value;
  24877. length = length == null ? MAX_SAFE_INTEGER : length;
  24878. return !!length &&
  24879. (type == 'number' ||
  24880. (type != 'symbol' && reIsUint.test(value))) &&
  24881. (value > -1 && value % 1 == 0 && value < length);
  24882. }
  24883. /**
  24884. * Checks if the given arguments are from an iteratee call.
  24885. *
  24886. * @private
  24887. * @param {*} value The potential iteratee value argument.
  24888. * @param {*} index The potential iteratee index or key argument.
  24889. * @param {*} object The potential iteratee object argument.
  24890. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24891. * else `false`.
  24892. */
  24893. function isIterateeCall(value, index, object) {
  24894. if (!isObject(object)) {
  24895. return false;
  24896. }
  24897. var type = typeof index;
  24898. if (type == 'number'
  24899. ? (isArrayLike(object) && isIndex(index, object.length))
  24900. : (type == 'string' && index in object)
  24901. ) {
  24902. return eq(object[index], value);
  24903. }
  24904. return false;
  24905. }
  24906. /**
  24907. * Checks if `value` is a property name and not a property path.
  24908. *
  24909. * @private
  24910. * @param {*} value The value to check.
  24911. * @param {Object} [object] The object to query keys on.
  24912. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24913. */
  24914. function isKey(value, object) {
  24915. if (isArray(value)) {
  24916. return false;
  24917. }
  24918. var type = typeof value;
  24919. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24920. value == null || isSymbol(value)) {
  24921. return true;
  24922. }
  24923. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24924. (object != null && value in Object(object));
  24925. }
  24926. /**
  24927. * Checks if `value` is suitable for use as unique object key.
  24928. *
  24929. * @private
  24930. * @param {*} value The value to check.
  24931. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24932. */
  24933. function isKeyable(value) {
  24934. var type = typeof value;
  24935. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24936. ? (value !== '__proto__')
  24937. : (value === null);
  24938. }
  24939. /**
  24940. * Checks if `func` has a lazy counterpart.
  24941. *
  24942. * @private
  24943. * @param {Function} func The function to check.
  24944. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24945. * else `false`.
  24946. */
  24947. function isLaziable(func) {
  24948. var funcName = getFuncName(func),
  24949. other = lodash[funcName];
  24950. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24951. return false;
  24952. }
  24953. if (func === other) {
  24954. return true;
  24955. }
  24956. var data = getData(other);
  24957. return !!data && func === data[0];
  24958. }
  24959. /**
  24960. * Checks if `func` has its source masked.
  24961. *
  24962. * @private
  24963. * @param {Function} func The function to check.
  24964. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24965. */
  24966. function isMasked(func) {
  24967. return !!maskSrcKey && (maskSrcKey in func);
  24968. }
  24969. /**
  24970. * Checks if `func` is capable of being masked.
  24971. *
  24972. * @private
  24973. * @param {*} value The value to check.
  24974. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24975. */
  24976. var isMaskable = coreJsData ? isFunction : stubFalse;
  24977. /**
  24978. * Checks if `value` is likely a prototype object.
  24979. *
  24980. * @private
  24981. * @param {*} value The value to check.
  24982. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24983. */
  24984. function isPrototype(value) {
  24985. var Ctor = value && value.constructor,
  24986. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24987. return value === proto;
  24988. }
  24989. /**
  24990. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24991. *
  24992. * @private
  24993. * @param {*} value The value to check.
  24994. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24995. * equality comparisons, else `false`.
  24996. */
  24997. function isStrictComparable(value) {
  24998. return value === value && !isObject(value);
  24999. }
  25000. /**
  25001. * A specialized version of `matchesProperty` for source values suitable
  25002. * for strict equality comparisons, i.e. `===`.
  25003. *
  25004. * @private
  25005. * @param {string} key The key of the property to get.
  25006. * @param {*} srcValue The value to match.
  25007. * @returns {Function} Returns the new spec function.
  25008. */
  25009. function matchesStrictComparable(key, srcValue) {
  25010. return function(object) {
  25011. if (object == null) {
  25012. return false;
  25013. }
  25014. return object[key] === srcValue &&
  25015. (srcValue !== undefined || (key in Object(object)));
  25016. };
  25017. }
  25018. /**
  25019. * A specialized version of `_.memoize` which clears the memoized function's
  25020. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25021. *
  25022. * @private
  25023. * @param {Function} func The function to have its output memoized.
  25024. * @returns {Function} Returns the new memoized function.
  25025. */
  25026. function memoizeCapped(func) {
  25027. var result = memoize(func, function(key) {
  25028. if (cache.size === MAX_MEMOIZE_SIZE) {
  25029. cache.clear();
  25030. }
  25031. return key;
  25032. });
  25033. var cache = result.cache;
  25034. return result;
  25035. }
  25036. /**
  25037. * Merges the function metadata of `source` into `data`.
  25038. *
  25039. * Merging metadata reduces the number of wrappers used to invoke a function.
  25040. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25041. * may be applied regardless of execution order. Methods like `_.ary` and
  25042. * `_.rearg` modify function arguments, making the order in which they are
  25043. * executed important, preventing the merging of metadata. However, we make
  25044. * an exception for a safe combined case where curried functions have `_.ary`
  25045. * and or `_.rearg` applied.
  25046. *
  25047. * @private
  25048. * @param {Array} data The destination metadata.
  25049. * @param {Array} source The source metadata.
  25050. * @returns {Array} Returns `data`.
  25051. */
  25052. function mergeData(data, source) {
  25053. var bitmask = data[1],
  25054. srcBitmask = source[1],
  25055. newBitmask = bitmask | srcBitmask,
  25056. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25057. var isCombo =
  25058. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25059. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25060. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25061. // Exit early if metadata can't be merged.
  25062. if (!(isCommon || isCombo)) {
  25063. return data;
  25064. }
  25065. // Use source `thisArg` if available.
  25066. if (srcBitmask & WRAP_BIND_FLAG) {
  25067. data[2] = source[2];
  25068. // Set when currying a bound function.
  25069. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25070. }
  25071. // Compose partial arguments.
  25072. var value = source[3];
  25073. if (value) {
  25074. var partials = data[3];
  25075. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25076. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25077. }
  25078. // Compose partial right arguments.
  25079. value = source[5];
  25080. if (value) {
  25081. partials = data[5];
  25082. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25083. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25084. }
  25085. // Use source `argPos` if available.
  25086. value = source[7];
  25087. if (value) {
  25088. data[7] = value;
  25089. }
  25090. // Use source `ary` if it's smaller.
  25091. if (srcBitmask & WRAP_ARY_FLAG) {
  25092. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25093. }
  25094. // Use source `arity` if one is not provided.
  25095. if (data[9] == null) {
  25096. data[9] = source[9];
  25097. }
  25098. // Use source `func` and merge bitmasks.
  25099. data[0] = source[0];
  25100. data[1] = newBitmask;
  25101. return data;
  25102. }
  25103. /**
  25104. * This function is like
  25105. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25106. * except that it includes inherited enumerable properties.
  25107. *
  25108. * @private
  25109. * @param {Object} object The object to query.
  25110. * @returns {Array} Returns the array of property names.
  25111. */
  25112. function nativeKeysIn(object) {
  25113. var result = [];
  25114. if (object != null) {
  25115. for (var key in Object(object)) {
  25116. result.push(key);
  25117. }
  25118. }
  25119. return result;
  25120. }
  25121. /**
  25122. * Converts `value` to a string using `Object.prototype.toString`.
  25123. *
  25124. * @private
  25125. * @param {*} value The value to convert.
  25126. * @returns {string} Returns the converted string.
  25127. */
  25128. function objectToString(value) {
  25129. return nativeObjectToString.call(value);
  25130. }
  25131. /**
  25132. * A specialized version of `baseRest` which transforms the rest array.
  25133. *
  25134. * @private
  25135. * @param {Function} func The function to apply a rest parameter to.
  25136. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25137. * @param {Function} transform The rest array transform.
  25138. * @returns {Function} Returns the new function.
  25139. */
  25140. function overRest(func, start, transform) {
  25141. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25142. return function() {
  25143. var args = arguments,
  25144. index = -1,
  25145. length = nativeMax(args.length - start, 0),
  25146. array = Array(length);
  25147. while (++index < length) {
  25148. array[index] = args[start + index];
  25149. }
  25150. index = -1;
  25151. var otherArgs = Array(start + 1);
  25152. while (++index < start) {
  25153. otherArgs[index] = args[index];
  25154. }
  25155. otherArgs[start] = transform(array);
  25156. return apply(func, this, otherArgs);
  25157. };
  25158. }
  25159. /**
  25160. * Gets the parent value at `path` of `object`.
  25161. *
  25162. * @private
  25163. * @param {Object} object The object to query.
  25164. * @param {Array} path The path to get the parent value of.
  25165. * @returns {*} Returns the parent value.
  25166. */
  25167. function parent(object, path) {
  25168. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25169. }
  25170. /**
  25171. * Reorder `array` according to the specified indexes where the element at
  25172. * the first index is assigned as the first element, the element at
  25173. * the second index is assigned as the second element, and so on.
  25174. *
  25175. * @private
  25176. * @param {Array} array The array to reorder.
  25177. * @param {Array} indexes The arranged array indexes.
  25178. * @returns {Array} Returns `array`.
  25179. */
  25180. function reorder(array, indexes) {
  25181. var arrLength = array.length,
  25182. length = nativeMin(indexes.length, arrLength),
  25183. oldArray = copyArray(array);
  25184. while (length--) {
  25185. var index = indexes[length];
  25186. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25187. }
  25188. return array;
  25189. }
  25190. /**
  25191. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25192. *
  25193. * @private
  25194. * @param {Object} object The object to query.
  25195. * @param {string} key The key of the property to get.
  25196. * @returns {*} Returns the property value.
  25197. */
  25198. function safeGet(object, key) {
  25199. if (key === 'constructor' && typeof object[key] === 'function') {
  25200. return;
  25201. }
  25202. if (key == '__proto__') {
  25203. return;
  25204. }
  25205. return object[key];
  25206. }
  25207. /**
  25208. * Sets metadata for `func`.
  25209. *
  25210. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25211. * period of time, it will trip its breaker and transition to an identity
  25212. * function to avoid garbage collection pauses in V8. See
  25213. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25214. * for more details.
  25215. *
  25216. * @private
  25217. * @param {Function} func The function to associate metadata with.
  25218. * @param {*} data The metadata.
  25219. * @returns {Function} Returns `func`.
  25220. */
  25221. var setData = shortOut(baseSetData);
  25222. /**
  25223. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25224. *
  25225. * @private
  25226. * @param {Function} func The function to delay.
  25227. * @param {number} wait The number of milliseconds to delay invocation.
  25228. * @returns {number|Object} Returns the timer id or timeout object.
  25229. */
  25230. var setTimeout = ctxSetTimeout || function(func, wait) {
  25231. return root.setTimeout(func, wait);
  25232. };
  25233. /**
  25234. * Sets the `toString` method of `func` to return `string`.
  25235. *
  25236. * @private
  25237. * @param {Function} func The function to modify.
  25238. * @param {Function} string The `toString` result.
  25239. * @returns {Function} Returns `func`.
  25240. */
  25241. var setToString = shortOut(baseSetToString);
  25242. /**
  25243. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25244. * with wrapper details in a comment at the top of the source body.
  25245. *
  25246. * @private
  25247. * @param {Function} wrapper The function to modify.
  25248. * @param {Function} reference The reference function.
  25249. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25250. * @returns {Function} Returns `wrapper`.
  25251. */
  25252. function setWrapToString(wrapper, reference, bitmask) {
  25253. var source = (reference + '');
  25254. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25255. }
  25256. /**
  25257. * Creates a function that'll short out and invoke `identity` instead
  25258. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25259. * milliseconds.
  25260. *
  25261. * @private
  25262. * @param {Function} func The function to restrict.
  25263. * @returns {Function} Returns the new shortable function.
  25264. */
  25265. function shortOut(func) {
  25266. var count = 0,
  25267. lastCalled = 0;
  25268. return function() {
  25269. var stamp = nativeNow(),
  25270. remaining = HOT_SPAN - (stamp - lastCalled);
  25271. lastCalled = stamp;
  25272. if (remaining > 0) {
  25273. if (++count >= HOT_COUNT) {
  25274. return arguments[0];
  25275. }
  25276. } else {
  25277. count = 0;
  25278. }
  25279. return func.apply(undefined, arguments);
  25280. };
  25281. }
  25282. /**
  25283. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25284. *
  25285. * @private
  25286. * @param {Array} array The array to shuffle.
  25287. * @param {number} [size=array.length] The size of `array`.
  25288. * @returns {Array} Returns `array`.
  25289. */
  25290. function shuffleSelf(array, size) {
  25291. var index = -1,
  25292. length = array.length,
  25293. lastIndex = length - 1;
  25294. size = size === undefined ? length : size;
  25295. while (++index < size) {
  25296. var rand = baseRandom(index, lastIndex),
  25297. value = array[rand];
  25298. array[rand] = array[index];
  25299. array[index] = value;
  25300. }
  25301. array.length = size;
  25302. return array;
  25303. }
  25304. /**
  25305. * Converts `string` to a property path array.
  25306. *
  25307. * @private
  25308. * @param {string} string The string to convert.
  25309. * @returns {Array} Returns the property path array.
  25310. */
  25311. var stringToPath = memoizeCapped(function(string) {
  25312. var result = [];
  25313. if (string.charCodeAt(0) === 46 /* . */) {
  25314. result.push('');
  25315. }
  25316. string.replace(rePropName, function(match, number, quote, subString) {
  25317. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25318. });
  25319. return result;
  25320. });
  25321. /**
  25322. * Converts `value` to a string key if it's not a string or symbol.
  25323. *
  25324. * @private
  25325. * @param {*} value The value to inspect.
  25326. * @returns {string|symbol} Returns the key.
  25327. */
  25328. function toKey(value) {
  25329. if (typeof value == 'string' || isSymbol(value)) {
  25330. return value;
  25331. }
  25332. var result = (value + '');
  25333. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25334. }
  25335. /**
  25336. * Converts `func` to its source code.
  25337. *
  25338. * @private
  25339. * @param {Function} func The function to convert.
  25340. * @returns {string} Returns the source code.
  25341. */
  25342. function toSource(func) {
  25343. if (func != null) {
  25344. try {
  25345. return funcToString.call(func);
  25346. } catch (e) {}
  25347. try {
  25348. return (func + '');
  25349. } catch (e) {}
  25350. }
  25351. return '';
  25352. }
  25353. /**
  25354. * Updates wrapper `details` based on `bitmask` flags.
  25355. *
  25356. * @private
  25357. * @returns {Array} details The details to modify.
  25358. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25359. * @returns {Array} Returns `details`.
  25360. */
  25361. function updateWrapDetails(details, bitmask) {
  25362. arrayEach(wrapFlags, function(pair) {
  25363. var value = '_.' + pair[0];
  25364. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25365. details.push(value);
  25366. }
  25367. });
  25368. return details.sort();
  25369. }
  25370. /**
  25371. * Creates a clone of `wrapper`.
  25372. *
  25373. * @private
  25374. * @param {Object} wrapper The wrapper to clone.
  25375. * @returns {Object} Returns the cloned wrapper.
  25376. */
  25377. function wrapperClone(wrapper) {
  25378. if (wrapper instanceof LazyWrapper) {
  25379. return wrapper.clone();
  25380. }
  25381. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25382. result.__actions__ = copyArray(wrapper.__actions__);
  25383. result.__index__ = wrapper.__index__;
  25384. result.__values__ = wrapper.__values__;
  25385. return result;
  25386. }
  25387. /*------------------------------------------------------------------------*/
  25388. /**
  25389. * Creates an array of elements split into groups the length of `size`.
  25390. * If `array` can't be split evenly, the final chunk will be the remaining
  25391. * elements.
  25392. *
  25393. * @static
  25394. * @memberOf _
  25395. * @since 3.0.0
  25396. * @category Array
  25397. * @param {Array} array The array to process.
  25398. * @param {number} [size=1] The length of each chunk
  25399. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25400. * @returns {Array} Returns the new array of chunks.
  25401. * @example
  25402. *
  25403. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25404. * // => [['a', 'b'], ['c', 'd']]
  25405. *
  25406. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25407. * // => [['a', 'b', 'c'], ['d']]
  25408. */
  25409. function chunk(array, size, guard) {
  25410. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25411. size = 1;
  25412. } else {
  25413. size = nativeMax(toInteger(size), 0);
  25414. }
  25415. var length = array == null ? 0 : array.length;
  25416. if (!length || size < 1) {
  25417. return [];
  25418. }
  25419. var index = 0,
  25420. resIndex = 0,
  25421. result = Array(nativeCeil(length / size));
  25422. while (index < length) {
  25423. result[resIndex++] = baseSlice(array, index, (index += size));
  25424. }
  25425. return result;
  25426. }
  25427. /**
  25428. * Creates an array with all falsey values removed. The values `false`, `null`,
  25429. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25430. *
  25431. * @static
  25432. * @memberOf _
  25433. * @since 0.1.0
  25434. * @category Array
  25435. * @param {Array} array The array to compact.
  25436. * @returns {Array} Returns the new array of filtered values.
  25437. * @example
  25438. *
  25439. * _.compact([0, 1, false, 2, '', 3]);
  25440. * // => [1, 2, 3]
  25441. */
  25442. function compact(array) {
  25443. var index = -1,
  25444. length = array == null ? 0 : array.length,
  25445. resIndex = 0,
  25446. result = [];
  25447. while (++index < length) {
  25448. var value = array[index];
  25449. if (value) {
  25450. result[resIndex++] = value;
  25451. }
  25452. }
  25453. return result;
  25454. }
  25455. /**
  25456. * Creates a new array concatenating `array` with any additional arrays
  25457. * and/or values.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 4.0.0
  25462. * @category Array
  25463. * @param {Array} array The array to concatenate.
  25464. * @param {...*} [values] The values to concatenate.
  25465. * @returns {Array} Returns the new concatenated array.
  25466. * @example
  25467. *
  25468. * var array = [1];
  25469. * var other = _.concat(array, 2, [3], [[4]]);
  25470. *
  25471. * console.log(other);
  25472. * // => [1, 2, 3, [4]]
  25473. *
  25474. * console.log(array);
  25475. * // => [1]
  25476. */
  25477. function concat() {
  25478. var length = arguments.length;
  25479. if (!length) {
  25480. return [];
  25481. }
  25482. var args = Array(length - 1),
  25483. array = arguments[0],
  25484. index = length;
  25485. while (index--) {
  25486. args[index - 1] = arguments[index];
  25487. }
  25488. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25489. }
  25490. /**
  25491. * Creates an array of `array` values not included in the other given arrays
  25492. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25493. * for equality comparisons. The order and references of result values are
  25494. * determined by the first array.
  25495. *
  25496. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25497. *
  25498. * @static
  25499. * @memberOf _
  25500. * @since 0.1.0
  25501. * @category Array
  25502. * @param {Array} array The array to inspect.
  25503. * @param {...Array} [values] The values to exclude.
  25504. * @returns {Array} Returns the new array of filtered values.
  25505. * @see _.without, _.xor
  25506. * @example
  25507. *
  25508. * _.difference([2, 1], [2, 3]);
  25509. * // => [1]
  25510. */
  25511. var difference = baseRest(function(array, values) {
  25512. return isArrayLikeObject(array)
  25513. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25514. : [];
  25515. });
  25516. /**
  25517. * This method is like `_.difference` except that it accepts `iteratee` which
  25518. * is invoked for each element of `array` and `values` to generate the criterion
  25519. * by which they're compared. The order and references of result values are
  25520. * determined by the first array. The iteratee is invoked with one argument:
  25521. * (value).
  25522. *
  25523. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25524. *
  25525. * @static
  25526. * @memberOf _
  25527. * @since 4.0.0
  25528. * @category Array
  25529. * @param {Array} array The array to inspect.
  25530. * @param {...Array} [values] The values to exclude.
  25531. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25532. * @returns {Array} Returns the new array of filtered values.
  25533. * @example
  25534. *
  25535. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25536. * // => [1.2]
  25537. *
  25538. * // The `_.property` iteratee shorthand.
  25539. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25540. * // => [{ 'x': 2 }]
  25541. */
  25542. var differenceBy = baseRest(function(array, values) {
  25543. var iteratee = last(values);
  25544. if (isArrayLikeObject(iteratee)) {
  25545. iteratee = undefined;
  25546. }
  25547. return isArrayLikeObject(array)
  25548. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25549. : [];
  25550. });
  25551. /**
  25552. * This method is like `_.difference` except that it accepts `comparator`
  25553. * which is invoked to compare elements of `array` to `values`. The order and
  25554. * references of result values are determined by the first array. The comparator
  25555. * is invoked with two arguments: (arrVal, othVal).
  25556. *
  25557. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25558. *
  25559. * @static
  25560. * @memberOf _
  25561. * @since 4.0.0
  25562. * @category Array
  25563. * @param {Array} array The array to inspect.
  25564. * @param {...Array} [values] The values to exclude.
  25565. * @param {Function} [comparator] The comparator invoked per element.
  25566. * @returns {Array} Returns the new array of filtered values.
  25567. * @example
  25568. *
  25569. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25570. *
  25571. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25572. * // => [{ 'x': 2, 'y': 1 }]
  25573. */
  25574. var differenceWith = baseRest(function(array, values) {
  25575. var comparator = last(values);
  25576. if (isArrayLikeObject(comparator)) {
  25577. comparator = undefined;
  25578. }
  25579. return isArrayLikeObject(array)
  25580. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25581. : [];
  25582. });
  25583. /**
  25584. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25585. *
  25586. * @static
  25587. * @memberOf _
  25588. * @since 0.5.0
  25589. * @category Array
  25590. * @param {Array} array The array to query.
  25591. * @param {number} [n=1] The number of elements to drop.
  25592. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25593. * @returns {Array} Returns the slice of `array`.
  25594. * @example
  25595. *
  25596. * _.drop([1, 2, 3]);
  25597. * // => [2, 3]
  25598. *
  25599. * _.drop([1, 2, 3], 2);
  25600. * // => [3]
  25601. *
  25602. * _.drop([1, 2, 3], 5);
  25603. * // => []
  25604. *
  25605. * _.drop([1, 2, 3], 0);
  25606. * // => [1, 2, 3]
  25607. */
  25608. function drop(array, n, guard) {
  25609. var length = array == null ? 0 : array.length;
  25610. if (!length) {
  25611. return [];
  25612. }
  25613. n = (guard || n === undefined) ? 1 : toInteger(n);
  25614. return baseSlice(array, n < 0 ? 0 : n, length);
  25615. }
  25616. /**
  25617. * Creates a slice of `array` with `n` elements dropped from the end.
  25618. *
  25619. * @static
  25620. * @memberOf _
  25621. * @since 3.0.0
  25622. * @category Array
  25623. * @param {Array} array The array to query.
  25624. * @param {number} [n=1] The number of elements to drop.
  25625. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25626. * @returns {Array} Returns the slice of `array`.
  25627. * @example
  25628. *
  25629. * _.dropRight([1, 2, 3]);
  25630. * // => [1, 2]
  25631. *
  25632. * _.dropRight([1, 2, 3], 2);
  25633. * // => [1]
  25634. *
  25635. * _.dropRight([1, 2, 3], 5);
  25636. * // => []
  25637. *
  25638. * _.dropRight([1, 2, 3], 0);
  25639. * // => [1, 2, 3]
  25640. */
  25641. function dropRight(array, n, guard) {
  25642. var length = array == null ? 0 : array.length;
  25643. if (!length) {
  25644. return [];
  25645. }
  25646. n = (guard || n === undefined) ? 1 : toInteger(n);
  25647. n = length - n;
  25648. return baseSlice(array, 0, n < 0 ? 0 : n);
  25649. }
  25650. /**
  25651. * Creates a slice of `array` excluding elements dropped from the end.
  25652. * Elements are dropped until `predicate` returns falsey. The predicate is
  25653. * invoked with three arguments: (value, index, array).
  25654. *
  25655. * @static
  25656. * @memberOf _
  25657. * @since 3.0.0
  25658. * @category Array
  25659. * @param {Array} array The array to query.
  25660. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25661. * @returns {Array} Returns the slice of `array`.
  25662. * @example
  25663. *
  25664. * var users = [
  25665. * { 'user': 'barney', 'active': true },
  25666. * { 'user': 'fred', 'active': false },
  25667. * { 'user': 'pebbles', 'active': false }
  25668. * ];
  25669. *
  25670. * _.dropRightWhile(users, function(o) { return !o.active; });
  25671. * // => objects for ['barney']
  25672. *
  25673. * // The `_.matches` iteratee shorthand.
  25674. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25675. * // => objects for ['barney', 'fred']
  25676. *
  25677. * // The `_.matchesProperty` iteratee shorthand.
  25678. * _.dropRightWhile(users, ['active', false]);
  25679. * // => objects for ['barney']
  25680. *
  25681. * // The `_.property` iteratee shorthand.
  25682. * _.dropRightWhile(users, 'active');
  25683. * // => objects for ['barney', 'fred', 'pebbles']
  25684. */
  25685. function dropRightWhile(array, predicate) {
  25686. return (array && array.length)
  25687. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25688. : [];
  25689. }
  25690. /**
  25691. * Creates a slice of `array` excluding elements dropped from the beginning.
  25692. * Elements are dropped until `predicate` returns falsey. The predicate is
  25693. * invoked with three arguments: (value, index, array).
  25694. *
  25695. * @static
  25696. * @memberOf _
  25697. * @since 3.0.0
  25698. * @category Array
  25699. * @param {Array} array The array to query.
  25700. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25701. * @returns {Array} Returns the slice of `array`.
  25702. * @example
  25703. *
  25704. * var users = [
  25705. * { 'user': 'barney', 'active': false },
  25706. * { 'user': 'fred', 'active': false },
  25707. * { 'user': 'pebbles', 'active': true }
  25708. * ];
  25709. *
  25710. * _.dropWhile(users, function(o) { return !o.active; });
  25711. * // => objects for ['pebbles']
  25712. *
  25713. * // The `_.matches` iteratee shorthand.
  25714. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25715. * // => objects for ['fred', 'pebbles']
  25716. *
  25717. * // The `_.matchesProperty` iteratee shorthand.
  25718. * _.dropWhile(users, ['active', false]);
  25719. * // => objects for ['pebbles']
  25720. *
  25721. * // The `_.property` iteratee shorthand.
  25722. * _.dropWhile(users, 'active');
  25723. * // => objects for ['barney', 'fred', 'pebbles']
  25724. */
  25725. function dropWhile(array, predicate) {
  25726. return (array && array.length)
  25727. ? baseWhile(array, getIteratee(predicate, 3), true)
  25728. : [];
  25729. }
  25730. /**
  25731. * Fills elements of `array` with `value` from `start` up to, but not
  25732. * including, `end`.
  25733. *
  25734. * **Note:** This method mutates `array`.
  25735. *
  25736. * @static
  25737. * @memberOf _
  25738. * @since 3.2.0
  25739. * @category Array
  25740. * @param {Array} array The array to fill.
  25741. * @param {*} value The value to fill `array` with.
  25742. * @param {number} [start=0] The start position.
  25743. * @param {number} [end=array.length] The end position.
  25744. * @returns {Array} Returns `array`.
  25745. * @example
  25746. *
  25747. * var array = [1, 2, 3];
  25748. *
  25749. * _.fill(array, 'a');
  25750. * console.log(array);
  25751. * // => ['a', 'a', 'a']
  25752. *
  25753. * _.fill(Array(3), 2);
  25754. * // => [2, 2, 2]
  25755. *
  25756. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25757. * // => [4, '*', '*', 10]
  25758. */
  25759. function fill(array, value, start, end) {
  25760. var length = array == null ? 0 : array.length;
  25761. if (!length) {
  25762. return [];
  25763. }
  25764. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25765. start = 0;
  25766. end = length;
  25767. }
  25768. return baseFill(array, value, start, end);
  25769. }
  25770. /**
  25771. * This method is like `_.find` except that it returns the index of the first
  25772. * element `predicate` returns truthy for instead of the element itself.
  25773. *
  25774. * @static
  25775. * @memberOf _
  25776. * @since 1.1.0
  25777. * @category Array
  25778. * @param {Array} array The array to inspect.
  25779. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25780. * @param {number} [fromIndex=0] The index to search from.
  25781. * @returns {number} Returns the index of the found element, else `-1`.
  25782. * @example
  25783. *
  25784. * var users = [
  25785. * { 'user': 'barney', 'active': false },
  25786. * { 'user': 'fred', 'active': false },
  25787. * { 'user': 'pebbles', 'active': true }
  25788. * ];
  25789. *
  25790. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25791. * // => 0
  25792. *
  25793. * // The `_.matches` iteratee shorthand.
  25794. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25795. * // => 1
  25796. *
  25797. * // The `_.matchesProperty` iteratee shorthand.
  25798. * _.findIndex(users, ['active', false]);
  25799. * // => 0
  25800. *
  25801. * // The `_.property` iteratee shorthand.
  25802. * _.findIndex(users, 'active');
  25803. * // => 2
  25804. */
  25805. function findIndex(array, predicate, fromIndex) {
  25806. var length = array == null ? 0 : array.length;
  25807. if (!length) {
  25808. return -1;
  25809. }
  25810. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25811. if (index < 0) {
  25812. index = nativeMax(length + index, 0);
  25813. }
  25814. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25815. }
  25816. /**
  25817. * This method is like `_.findIndex` except that it iterates over elements
  25818. * of `collection` from right to left.
  25819. *
  25820. * @static
  25821. * @memberOf _
  25822. * @since 2.0.0
  25823. * @category Array
  25824. * @param {Array} array The array to inspect.
  25825. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25826. * @param {number} [fromIndex=array.length-1] The index to search from.
  25827. * @returns {number} Returns the index of the found element, else `-1`.
  25828. * @example
  25829. *
  25830. * var users = [
  25831. * { 'user': 'barney', 'active': true },
  25832. * { 'user': 'fred', 'active': false },
  25833. * { 'user': 'pebbles', 'active': false }
  25834. * ];
  25835. *
  25836. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25837. * // => 2
  25838. *
  25839. * // The `_.matches` iteratee shorthand.
  25840. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25841. * // => 0
  25842. *
  25843. * // The `_.matchesProperty` iteratee shorthand.
  25844. * _.findLastIndex(users, ['active', false]);
  25845. * // => 2
  25846. *
  25847. * // The `_.property` iteratee shorthand.
  25848. * _.findLastIndex(users, 'active');
  25849. * // => 0
  25850. */
  25851. function findLastIndex(array, predicate, fromIndex) {
  25852. var length = array == null ? 0 : array.length;
  25853. if (!length) {
  25854. return -1;
  25855. }
  25856. var index = length - 1;
  25857. if (fromIndex !== undefined) {
  25858. index = toInteger(fromIndex);
  25859. index = fromIndex < 0
  25860. ? nativeMax(length + index, 0)
  25861. : nativeMin(index, length - 1);
  25862. }
  25863. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25864. }
  25865. /**
  25866. * Flattens `array` a single level deep.
  25867. *
  25868. * @static
  25869. * @memberOf _
  25870. * @since 0.1.0
  25871. * @category Array
  25872. * @param {Array} array The array to flatten.
  25873. * @returns {Array} Returns the new flattened array.
  25874. * @example
  25875. *
  25876. * _.flatten([1, [2, [3, [4]], 5]]);
  25877. * // => [1, 2, [3, [4]], 5]
  25878. */
  25879. function flatten(array) {
  25880. var length = array == null ? 0 : array.length;
  25881. return length ? baseFlatten(array, 1) : [];
  25882. }
  25883. /**
  25884. * Recursively flattens `array`.
  25885. *
  25886. * @static
  25887. * @memberOf _
  25888. * @since 3.0.0
  25889. * @category Array
  25890. * @param {Array} array The array to flatten.
  25891. * @returns {Array} Returns the new flattened array.
  25892. * @example
  25893. *
  25894. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25895. * // => [1, 2, 3, 4, 5]
  25896. */
  25897. function flattenDeep(array) {
  25898. var length = array == null ? 0 : array.length;
  25899. return length ? baseFlatten(array, INFINITY) : [];
  25900. }
  25901. /**
  25902. * Recursively flatten `array` up to `depth` times.
  25903. *
  25904. * @static
  25905. * @memberOf _
  25906. * @since 4.4.0
  25907. * @category Array
  25908. * @param {Array} array The array to flatten.
  25909. * @param {number} [depth=1] The maximum recursion depth.
  25910. * @returns {Array} Returns the new flattened array.
  25911. * @example
  25912. *
  25913. * var array = [1, [2, [3, [4]], 5]];
  25914. *
  25915. * _.flattenDepth(array, 1);
  25916. * // => [1, 2, [3, [4]], 5]
  25917. *
  25918. * _.flattenDepth(array, 2);
  25919. * // => [1, 2, 3, [4], 5]
  25920. */
  25921. function flattenDepth(array, depth) {
  25922. var length = array == null ? 0 : array.length;
  25923. if (!length) {
  25924. return [];
  25925. }
  25926. depth = depth === undefined ? 1 : toInteger(depth);
  25927. return baseFlatten(array, depth);
  25928. }
  25929. /**
  25930. * The inverse of `_.toPairs`; this method returns an object composed
  25931. * from key-value `pairs`.
  25932. *
  25933. * @static
  25934. * @memberOf _
  25935. * @since 4.0.0
  25936. * @category Array
  25937. * @param {Array} pairs The key-value pairs.
  25938. * @returns {Object} Returns the new object.
  25939. * @example
  25940. *
  25941. * _.fromPairs([['a', 1], ['b', 2]]);
  25942. * // => { 'a': 1, 'b': 2 }
  25943. */
  25944. function fromPairs(pairs) {
  25945. var index = -1,
  25946. length = pairs == null ? 0 : pairs.length,
  25947. result = {};
  25948. while (++index < length) {
  25949. var pair = pairs[index];
  25950. result[pair[0]] = pair[1];
  25951. }
  25952. return result;
  25953. }
  25954. /**
  25955. * Gets the first element of `array`.
  25956. *
  25957. * @static
  25958. * @memberOf _
  25959. * @since 0.1.0
  25960. * @alias first
  25961. * @category Array
  25962. * @param {Array} array The array to query.
  25963. * @returns {*} Returns the first element of `array`.
  25964. * @example
  25965. *
  25966. * _.head([1, 2, 3]);
  25967. * // => 1
  25968. *
  25969. * _.head([]);
  25970. * // => undefined
  25971. */
  25972. function head(array) {
  25973. return (array && array.length) ? array[0] : undefined;
  25974. }
  25975. /**
  25976. * Gets the index at which the first occurrence of `value` is found in `array`
  25977. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25978. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25979. * offset from the end of `array`.
  25980. *
  25981. * @static
  25982. * @memberOf _
  25983. * @since 0.1.0
  25984. * @category Array
  25985. * @param {Array} array The array to inspect.
  25986. * @param {*} value The value to search for.
  25987. * @param {number} [fromIndex=0] The index to search from.
  25988. * @returns {number} Returns the index of the matched value, else `-1`.
  25989. * @example
  25990. *
  25991. * _.indexOf([1, 2, 1, 2], 2);
  25992. * // => 1
  25993. *
  25994. * // Search from the `fromIndex`.
  25995. * _.indexOf([1, 2, 1, 2], 2, 2);
  25996. * // => 3
  25997. */
  25998. function indexOf(array, value, fromIndex) {
  25999. var length = array == null ? 0 : array.length;
  26000. if (!length) {
  26001. return -1;
  26002. }
  26003. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  26004. if (index < 0) {
  26005. index = nativeMax(length + index, 0);
  26006. }
  26007. return baseIndexOf(array, value, index);
  26008. }
  26009. /**
  26010. * Gets all but the last element of `array`.
  26011. *
  26012. * @static
  26013. * @memberOf _
  26014. * @since 0.1.0
  26015. * @category Array
  26016. * @param {Array} array The array to query.
  26017. * @returns {Array} Returns the slice of `array`.
  26018. * @example
  26019. *
  26020. * _.initial([1, 2, 3]);
  26021. * // => [1, 2]
  26022. */
  26023. function initial(array) {
  26024. var length = array == null ? 0 : array.length;
  26025. return length ? baseSlice(array, 0, -1) : [];
  26026. }
  26027. /**
  26028. * Creates an array of unique values that are included in all given arrays
  26029. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26030. * for equality comparisons. The order and references of result values are
  26031. * determined by the first array.
  26032. *
  26033. * @static
  26034. * @memberOf _
  26035. * @since 0.1.0
  26036. * @category Array
  26037. * @param {...Array} [arrays] The arrays to inspect.
  26038. * @returns {Array} Returns the new array of intersecting values.
  26039. * @example
  26040. *
  26041. * _.intersection([2, 1], [2, 3]);
  26042. * // => [2]
  26043. */
  26044. var intersection = baseRest(function(arrays) {
  26045. var mapped = arrayMap(arrays, castArrayLikeObject);
  26046. return (mapped.length && mapped[0] === arrays[0])
  26047. ? baseIntersection(mapped)
  26048. : [];
  26049. });
  26050. /**
  26051. * This method is like `_.intersection` except that it accepts `iteratee`
  26052. * which is invoked for each element of each `arrays` to generate the criterion
  26053. * by which they're compared. The order and references of result values are
  26054. * determined by the first array. The iteratee is invoked with one argument:
  26055. * (value).
  26056. *
  26057. * @static
  26058. * @memberOf _
  26059. * @since 4.0.0
  26060. * @category Array
  26061. * @param {...Array} [arrays] The arrays to inspect.
  26062. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26063. * @returns {Array} Returns the new array of intersecting values.
  26064. * @example
  26065. *
  26066. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26067. * // => [2.1]
  26068. *
  26069. * // The `_.property` iteratee shorthand.
  26070. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26071. * // => [{ 'x': 1 }]
  26072. */
  26073. var intersectionBy = baseRest(function(arrays) {
  26074. var iteratee = last(arrays),
  26075. mapped = arrayMap(arrays, castArrayLikeObject);
  26076. if (iteratee === last(mapped)) {
  26077. iteratee = undefined;
  26078. } else {
  26079. mapped.pop();
  26080. }
  26081. return (mapped.length && mapped[0] === arrays[0])
  26082. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26083. : [];
  26084. });
  26085. /**
  26086. * This method is like `_.intersection` except that it accepts `comparator`
  26087. * which is invoked to compare elements of `arrays`. The order and references
  26088. * of result values are determined by the first array. The comparator is
  26089. * invoked with two arguments: (arrVal, othVal).
  26090. *
  26091. * @static
  26092. * @memberOf _
  26093. * @since 4.0.0
  26094. * @category Array
  26095. * @param {...Array} [arrays] The arrays to inspect.
  26096. * @param {Function} [comparator] The comparator invoked per element.
  26097. * @returns {Array} Returns the new array of intersecting values.
  26098. * @example
  26099. *
  26100. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26101. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26102. *
  26103. * _.intersectionWith(objects, others, _.isEqual);
  26104. * // => [{ 'x': 1, 'y': 2 }]
  26105. */
  26106. var intersectionWith = baseRest(function(arrays) {
  26107. var comparator = last(arrays),
  26108. mapped = arrayMap(arrays, castArrayLikeObject);
  26109. comparator = typeof comparator == 'function' ? comparator : undefined;
  26110. if (comparator) {
  26111. mapped.pop();
  26112. }
  26113. return (mapped.length && mapped[0] === arrays[0])
  26114. ? baseIntersection(mapped, undefined, comparator)
  26115. : [];
  26116. });
  26117. /**
  26118. * Converts all elements in `array` into a string separated by `separator`.
  26119. *
  26120. * @static
  26121. * @memberOf _
  26122. * @since 4.0.0
  26123. * @category Array
  26124. * @param {Array} array The array to convert.
  26125. * @param {string} [separator=','] The element separator.
  26126. * @returns {string} Returns the joined string.
  26127. * @example
  26128. *
  26129. * _.join(['a', 'b', 'c'], '~');
  26130. * // => 'a~b~c'
  26131. */
  26132. function join(array, separator) {
  26133. return array == null ? '' : nativeJoin.call(array, separator);
  26134. }
  26135. /**
  26136. * Gets the last element of `array`.
  26137. *
  26138. * @static
  26139. * @memberOf _
  26140. * @since 0.1.0
  26141. * @category Array
  26142. * @param {Array} array The array to query.
  26143. * @returns {*} Returns the last element of `array`.
  26144. * @example
  26145. *
  26146. * _.last([1, 2, 3]);
  26147. * // => 3
  26148. */
  26149. function last(array) {
  26150. var length = array == null ? 0 : array.length;
  26151. return length ? array[length - 1] : undefined;
  26152. }
  26153. /**
  26154. * This method is like `_.indexOf` except that it iterates over elements of
  26155. * `array` from right to left.
  26156. *
  26157. * @static
  26158. * @memberOf _
  26159. * @since 0.1.0
  26160. * @category Array
  26161. * @param {Array} array The array to inspect.
  26162. * @param {*} value The value to search for.
  26163. * @param {number} [fromIndex=array.length-1] The index to search from.
  26164. * @returns {number} Returns the index of the matched value, else `-1`.
  26165. * @example
  26166. *
  26167. * _.lastIndexOf([1, 2, 1, 2], 2);
  26168. * // => 3
  26169. *
  26170. * // Search from the `fromIndex`.
  26171. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26172. * // => 1
  26173. */
  26174. function lastIndexOf(array, value, fromIndex) {
  26175. var length = array == null ? 0 : array.length;
  26176. if (!length) {
  26177. return -1;
  26178. }
  26179. var index = length;
  26180. if (fromIndex !== undefined) {
  26181. index = toInteger(fromIndex);
  26182. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26183. }
  26184. return value === value
  26185. ? strictLastIndexOf(array, value, index)
  26186. : baseFindIndex(array, baseIsNaN, index, true);
  26187. }
  26188. /**
  26189. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26190. * element from the end is returned.
  26191. *
  26192. * @static
  26193. * @memberOf _
  26194. * @since 4.11.0
  26195. * @category Array
  26196. * @param {Array} array The array to query.
  26197. * @param {number} [n=0] The index of the element to return.
  26198. * @returns {*} Returns the nth element of `array`.
  26199. * @example
  26200. *
  26201. * var array = ['a', 'b', 'c', 'd'];
  26202. *
  26203. * _.nth(array, 1);
  26204. * // => 'b'
  26205. *
  26206. * _.nth(array, -2);
  26207. * // => 'c';
  26208. */
  26209. function nth(array, n) {
  26210. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26211. }
  26212. /**
  26213. * Removes all given values from `array` using
  26214. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26215. * for equality comparisons.
  26216. *
  26217. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26218. * to remove elements from an array by predicate.
  26219. *
  26220. * @static
  26221. * @memberOf _
  26222. * @since 2.0.0
  26223. * @category Array
  26224. * @param {Array} array The array to modify.
  26225. * @param {...*} [values] The values to remove.
  26226. * @returns {Array} Returns `array`.
  26227. * @example
  26228. *
  26229. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26230. *
  26231. * _.pull(array, 'a', 'c');
  26232. * console.log(array);
  26233. * // => ['b', 'b']
  26234. */
  26235. var pull = baseRest(pullAll);
  26236. /**
  26237. * This method is like `_.pull` except that it accepts an array of values to remove.
  26238. *
  26239. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26240. *
  26241. * @static
  26242. * @memberOf _
  26243. * @since 4.0.0
  26244. * @category Array
  26245. * @param {Array} array The array to modify.
  26246. * @param {Array} values The values to remove.
  26247. * @returns {Array} Returns `array`.
  26248. * @example
  26249. *
  26250. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26251. *
  26252. * _.pullAll(array, ['a', 'c']);
  26253. * console.log(array);
  26254. * // => ['b', 'b']
  26255. */
  26256. function pullAll(array, values) {
  26257. return (array && array.length && values && values.length)
  26258. ? basePullAll(array, values)
  26259. : array;
  26260. }
  26261. /**
  26262. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26263. * invoked for each element of `array` and `values` to generate the criterion
  26264. * by which they're compared. The iteratee is invoked with one argument: (value).
  26265. *
  26266. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26267. *
  26268. * @static
  26269. * @memberOf _
  26270. * @since 4.0.0
  26271. * @category Array
  26272. * @param {Array} array The array to modify.
  26273. * @param {Array} values The values to remove.
  26274. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26275. * @returns {Array} Returns `array`.
  26276. * @example
  26277. *
  26278. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26279. *
  26280. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26281. * console.log(array);
  26282. * // => [{ 'x': 2 }]
  26283. */
  26284. function pullAllBy(array, values, iteratee) {
  26285. return (array && array.length && values && values.length)
  26286. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26287. : array;
  26288. }
  26289. /**
  26290. * This method is like `_.pullAll` except that it accepts `comparator` which
  26291. * is invoked to compare elements of `array` to `values`. The comparator is
  26292. * invoked with two arguments: (arrVal, othVal).
  26293. *
  26294. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26295. *
  26296. * @static
  26297. * @memberOf _
  26298. * @since 4.6.0
  26299. * @category Array
  26300. * @param {Array} array The array to modify.
  26301. * @param {Array} values The values to remove.
  26302. * @param {Function} [comparator] The comparator invoked per element.
  26303. * @returns {Array} Returns `array`.
  26304. * @example
  26305. *
  26306. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26307. *
  26308. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26309. * console.log(array);
  26310. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26311. */
  26312. function pullAllWith(array, values, comparator) {
  26313. return (array && array.length && values && values.length)
  26314. ? basePullAll(array, values, undefined, comparator)
  26315. : array;
  26316. }
  26317. /**
  26318. * Removes elements from `array` corresponding to `indexes` and returns an
  26319. * array of removed elements.
  26320. *
  26321. * **Note:** Unlike `_.at`, this method mutates `array`.
  26322. *
  26323. * @static
  26324. * @memberOf _
  26325. * @since 3.0.0
  26326. * @category Array
  26327. * @param {Array} array The array to modify.
  26328. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26329. * @returns {Array} Returns the new array of removed elements.
  26330. * @example
  26331. *
  26332. * var array = ['a', 'b', 'c', 'd'];
  26333. * var pulled = _.pullAt(array, [1, 3]);
  26334. *
  26335. * console.log(array);
  26336. * // => ['a', 'c']
  26337. *
  26338. * console.log(pulled);
  26339. * // => ['b', 'd']
  26340. */
  26341. var pullAt = flatRest(function(array, indexes) {
  26342. var length = array == null ? 0 : array.length,
  26343. result = baseAt(array, indexes);
  26344. basePullAt(array, arrayMap(indexes, function(index) {
  26345. return isIndex(index, length) ? +index : index;
  26346. }).sort(compareAscending));
  26347. return result;
  26348. });
  26349. /**
  26350. * Removes all elements from `array` that `predicate` returns truthy for
  26351. * and returns an array of the removed elements. The predicate is invoked
  26352. * with three arguments: (value, index, array).
  26353. *
  26354. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26355. * to pull elements from an array by value.
  26356. *
  26357. * @static
  26358. * @memberOf _
  26359. * @since 2.0.0
  26360. * @category Array
  26361. * @param {Array} array The array to modify.
  26362. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26363. * @returns {Array} Returns the new array of removed elements.
  26364. * @example
  26365. *
  26366. * var array = [1, 2, 3, 4];
  26367. * var evens = _.remove(array, function(n) {
  26368. * return n % 2 == 0;
  26369. * });
  26370. *
  26371. * console.log(array);
  26372. * // => [1, 3]
  26373. *
  26374. * console.log(evens);
  26375. * // => [2, 4]
  26376. */
  26377. function remove(array, predicate) {
  26378. var result = [];
  26379. if (!(array && array.length)) {
  26380. return result;
  26381. }
  26382. var index = -1,
  26383. indexes = [],
  26384. length = array.length;
  26385. predicate = getIteratee(predicate, 3);
  26386. while (++index < length) {
  26387. var value = array[index];
  26388. if (predicate(value, index, array)) {
  26389. result.push(value);
  26390. indexes.push(index);
  26391. }
  26392. }
  26393. basePullAt(array, indexes);
  26394. return result;
  26395. }
  26396. /**
  26397. * Reverses `array` so that the first element becomes the last, the second
  26398. * element becomes the second to last, and so on.
  26399. *
  26400. * **Note:** This method mutates `array` and is based on
  26401. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26402. *
  26403. * @static
  26404. * @memberOf _
  26405. * @since 4.0.0
  26406. * @category Array
  26407. * @param {Array} array The array to modify.
  26408. * @returns {Array} Returns `array`.
  26409. * @example
  26410. *
  26411. * var array = [1, 2, 3];
  26412. *
  26413. * _.reverse(array);
  26414. * // => [3, 2, 1]
  26415. *
  26416. * console.log(array);
  26417. * // => [3, 2, 1]
  26418. */
  26419. function reverse(array) {
  26420. return array == null ? array : nativeReverse.call(array);
  26421. }
  26422. /**
  26423. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26424. *
  26425. * **Note:** This method is used instead of
  26426. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26427. * returned.
  26428. *
  26429. * @static
  26430. * @memberOf _
  26431. * @since 3.0.0
  26432. * @category Array
  26433. * @param {Array} array The array to slice.
  26434. * @param {number} [start=0] The start position.
  26435. * @param {number} [end=array.length] The end position.
  26436. * @returns {Array} Returns the slice of `array`.
  26437. */
  26438. function slice(array, start, end) {
  26439. var length = array == null ? 0 : array.length;
  26440. if (!length) {
  26441. return [];
  26442. }
  26443. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26444. start = 0;
  26445. end = length;
  26446. }
  26447. else {
  26448. start = start == null ? 0 : toInteger(start);
  26449. end = end === undefined ? length : toInteger(end);
  26450. }
  26451. return baseSlice(array, start, end);
  26452. }
  26453. /**
  26454. * Uses a binary search to determine the lowest index at which `value`
  26455. * should be inserted into `array` in order to maintain its sort order.
  26456. *
  26457. * @static
  26458. * @memberOf _
  26459. * @since 0.1.0
  26460. * @category Array
  26461. * @param {Array} array The sorted array to inspect.
  26462. * @param {*} value The value to evaluate.
  26463. * @returns {number} Returns the index at which `value` should be inserted
  26464. * into `array`.
  26465. * @example
  26466. *
  26467. * _.sortedIndex([30, 50], 40);
  26468. * // => 1
  26469. */
  26470. function sortedIndex(array, value) {
  26471. return baseSortedIndex(array, value);
  26472. }
  26473. /**
  26474. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26475. * which is invoked for `value` and each element of `array` to compute their
  26476. * sort ranking. The iteratee is invoked with one argument: (value).
  26477. *
  26478. * @static
  26479. * @memberOf _
  26480. * @since 4.0.0
  26481. * @category Array
  26482. * @param {Array} array The sorted array to inspect.
  26483. * @param {*} value The value to evaluate.
  26484. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26485. * @returns {number} Returns the index at which `value` should be inserted
  26486. * into `array`.
  26487. * @example
  26488. *
  26489. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26490. *
  26491. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26492. * // => 0
  26493. *
  26494. * // The `_.property` iteratee shorthand.
  26495. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26496. * // => 0
  26497. */
  26498. function sortedIndexBy(array, value, iteratee) {
  26499. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26500. }
  26501. /**
  26502. * This method is like `_.indexOf` except that it performs a binary
  26503. * search on a sorted `array`.
  26504. *
  26505. * @static
  26506. * @memberOf _
  26507. * @since 4.0.0
  26508. * @category Array
  26509. * @param {Array} array The array to inspect.
  26510. * @param {*} value The value to search for.
  26511. * @returns {number} Returns the index of the matched value, else `-1`.
  26512. * @example
  26513. *
  26514. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26515. * // => 1
  26516. */
  26517. function sortedIndexOf(array, value) {
  26518. var length = array == null ? 0 : array.length;
  26519. if (length) {
  26520. var index = baseSortedIndex(array, value);
  26521. if (index < length && eq(array[index], value)) {
  26522. return index;
  26523. }
  26524. }
  26525. return -1;
  26526. }
  26527. /**
  26528. * This method is like `_.sortedIndex` except that it returns the highest
  26529. * index at which `value` should be inserted into `array` in order to
  26530. * maintain its sort order.
  26531. *
  26532. * @static
  26533. * @memberOf _
  26534. * @since 3.0.0
  26535. * @category Array
  26536. * @param {Array} array The sorted array to inspect.
  26537. * @param {*} value The value to evaluate.
  26538. * @returns {number} Returns the index at which `value` should be inserted
  26539. * into `array`.
  26540. * @example
  26541. *
  26542. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26543. * // => 4
  26544. */
  26545. function sortedLastIndex(array, value) {
  26546. return baseSortedIndex(array, value, true);
  26547. }
  26548. /**
  26549. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26550. * which is invoked for `value` and each element of `array` to compute their
  26551. * sort ranking. The iteratee is invoked with one argument: (value).
  26552. *
  26553. * @static
  26554. * @memberOf _
  26555. * @since 4.0.0
  26556. * @category Array
  26557. * @param {Array} array The sorted array to inspect.
  26558. * @param {*} value The value to evaluate.
  26559. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26560. * @returns {number} Returns the index at which `value` should be inserted
  26561. * into `array`.
  26562. * @example
  26563. *
  26564. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26565. *
  26566. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26567. * // => 1
  26568. *
  26569. * // The `_.property` iteratee shorthand.
  26570. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26571. * // => 1
  26572. */
  26573. function sortedLastIndexBy(array, value, iteratee) {
  26574. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26575. }
  26576. /**
  26577. * This method is like `_.lastIndexOf` except that it performs a binary
  26578. * search on a sorted `array`.
  26579. *
  26580. * @static
  26581. * @memberOf _
  26582. * @since 4.0.0
  26583. * @category Array
  26584. * @param {Array} array The array to inspect.
  26585. * @param {*} value The value to search for.
  26586. * @returns {number} Returns the index of the matched value, else `-1`.
  26587. * @example
  26588. *
  26589. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26590. * // => 3
  26591. */
  26592. function sortedLastIndexOf(array, value) {
  26593. var length = array == null ? 0 : array.length;
  26594. if (length) {
  26595. var index = baseSortedIndex(array, value, true) - 1;
  26596. if (eq(array[index], value)) {
  26597. return index;
  26598. }
  26599. }
  26600. return -1;
  26601. }
  26602. /**
  26603. * This method is like `_.uniq` except that it's designed and optimized
  26604. * for sorted arrays.
  26605. *
  26606. * @static
  26607. * @memberOf _
  26608. * @since 4.0.0
  26609. * @category Array
  26610. * @param {Array} array The array to inspect.
  26611. * @returns {Array} Returns the new duplicate free array.
  26612. * @example
  26613. *
  26614. * _.sortedUniq([1, 1, 2]);
  26615. * // => [1, 2]
  26616. */
  26617. function sortedUniq(array) {
  26618. return (array && array.length)
  26619. ? baseSortedUniq(array)
  26620. : [];
  26621. }
  26622. /**
  26623. * This method is like `_.uniqBy` except that it's designed and optimized
  26624. * for sorted arrays.
  26625. *
  26626. * @static
  26627. * @memberOf _
  26628. * @since 4.0.0
  26629. * @category Array
  26630. * @param {Array} array The array to inspect.
  26631. * @param {Function} [iteratee] The iteratee invoked per element.
  26632. * @returns {Array} Returns the new duplicate free array.
  26633. * @example
  26634. *
  26635. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26636. * // => [1.1, 2.3]
  26637. */
  26638. function sortedUniqBy(array, iteratee) {
  26639. return (array && array.length)
  26640. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26641. : [];
  26642. }
  26643. /**
  26644. * Gets all but the first element of `array`.
  26645. *
  26646. * @static
  26647. * @memberOf _
  26648. * @since 4.0.0
  26649. * @category Array
  26650. * @param {Array} array The array to query.
  26651. * @returns {Array} Returns the slice of `array`.
  26652. * @example
  26653. *
  26654. * _.tail([1, 2, 3]);
  26655. * // => [2, 3]
  26656. */
  26657. function tail(array) {
  26658. var length = array == null ? 0 : array.length;
  26659. return length ? baseSlice(array, 1, length) : [];
  26660. }
  26661. /**
  26662. * Creates a slice of `array` with `n` elements taken from the beginning.
  26663. *
  26664. * @static
  26665. * @memberOf _
  26666. * @since 0.1.0
  26667. * @category Array
  26668. * @param {Array} array The array to query.
  26669. * @param {number} [n=1] The number of elements to take.
  26670. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26671. * @returns {Array} Returns the slice of `array`.
  26672. * @example
  26673. *
  26674. * _.take([1, 2, 3]);
  26675. * // => [1]
  26676. *
  26677. * _.take([1, 2, 3], 2);
  26678. * // => [1, 2]
  26679. *
  26680. * _.take([1, 2, 3], 5);
  26681. * // => [1, 2, 3]
  26682. *
  26683. * _.take([1, 2, 3], 0);
  26684. * // => []
  26685. */
  26686. function take(array, n, guard) {
  26687. if (!(array && array.length)) {
  26688. return [];
  26689. }
  26690. n = (guard || n === undefined) ? 1 : toInteger(n);
  26691. return baseSlice(array, 0, n < 0 ? 0 : n);
  26692. }
  26693. /**
  26694. * Creates a slice of `array` with `n` elements taken from the end.
  26695. *
  26696. * @static
  26697. * @memberOf _
  26698. * @since 3.0.0
  26699. * @category Array
  26700. * @param {Array} array The array to query.
  26701. * @param {number} [n=1] The number of elements to take.
  26702. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26703. * @returns {Array} Returns the slice of `array`.
  26704. * @example
  26705. *
  26706. * _.takeRight([1, 2, 3]);
  26707. * // => [3]
  26708. *
  26709. * _.takeRight([1, 2, 3], 2);
  26710. * // => [2, 3]
  26711. *
  26712. * _.takeRight([1, 2, 3], 5);
  26713. * // => [1, 2, 3]
  26714. *
  26715. * _.takeRight([1, 2, 3], 0);
  26716. * // => []
  26717. */
  26718. function takeRight(array, n, guard) {
  26719. var length = array == null ? 0 : array.length;
  26720. if (!length) {
  26721. return [];
  26722. }
  26723. n = (guard || n === undefined) ? 1 : toInteger(n);
  26724. n = length - n;
  26725. return baseSlice(array, n < 0 ? 0 : n, length);
  26726. }
  26727. /**
  26728. * Creates a slice of `array` with elements taken from the end. Elements are
  26729. * taken until `predicate` returns falsey. The predicate is invoked with
  26730. * three arguments: (value, index, array).
  26731. *
  26732. * @static
  26733. * @memberOf _
  26734. * @since 3.0.0
  26735. * @category Array
  26736. * @param {Array} array The array to query.
  26737. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26738. * @returns {Array} Returns the slice of `array`.
  26739. * @example
  26740. *
  26741. * var users = [
  26742. * { 'user': 'barney', 'active': true },
  26743. * { 'user': 'fred', 'active': false },
  26744. * { 'user': 'pebbles', 'active': false }
  26745. * ];
  26746. *
  26747. * _.takeRightWhile(users, function(o) { return !o.active; });
  26748. * // => objects for ['fred', 'pebbles']
  26749. *
  26750. * // The `_.matches` iteratee shorthand.
  26751. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26752. * // => objects for ['pebbles']
  26753. *
  26754. * // The `_.matchesProperty` iteratee shorthand.
  26755. * _.takeRightWhile(users, ['active', false]);
  26756. * // => objects for ['fred', 'pebbles']
  26757. *
  26758. * // The `_.property` iteratee shorthand.
  26759. * _.takeRightWhile(users, 'active');
  26760. * // => []
  26761. */
  26762. function takeRightWhile(array, predicate) {
  26763. return (array && array.length)
  26764. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26765. : [];
  26766. }
  26767. /**
  26768. * Creates a slice of `array` with elements taken from the beginning. Elements
  26769. * are taken until `predicate` returns falsey. The predicate is invoked with
  26770. * three arguments: (value, index, array).
  26771. *
  26772. * @static
  26773. * @memberOf _
  26774. * @since 3.0.0
  26775. * @category Array
  26776. * @param {Array} array The array to query.
  26777. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26778. * @returns {Array} Returns the slice of `array`.
  26779. * @example
  26780. *
  26781. * var users = [
  26782. * { 'user': 'barney', 'active': false },
  26783. * { 'user': 'fred', 'active': false },
  26784. * { 'user': 'pebbles', 'active': true }
  26785. * ];
  26786. *
  26787. * _.takeWhile(users, function(o) { return !o.active; });
  26788. * // => objects for ['barney', 'fred']
  26789. *
  26790. * // The `_.matches` iteratee shorthand.
  26791. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26792. * // => objects for ['barney']
  26793. *
  26794. * // The `_.matchesProperty` iteratee shorthand.
  26795. * _.takeWhile(users, ['active', false]);
  26796. * // => objects for ['barney', 'fred']
  26797. *
  26798. * // The `_.property` iteratee shorthand.
  26799. * _.takeWhile(users, 'active');
  26800. * // => []
  26801. */
  26802. function takeWhile(array, predicate) {
  26803. return (array && array.length)
  26804. ? baseWhile(array, getIteratee(predicate, 3))
  26805. : [];
  26806. }
  26807. /**
  26808. * Creates an array of unique values, in order, from all given arrays using
  26809. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26810. * for equality comparisons.
  26811. *
  26812. * @static
  26813. * @memberOf _
  26814. * @since 0.1.0
  26815. * @category Array
  26816. * @param {...Array} [arrays] The arrays to inspect.
  26817. * @returns {Array} Returns the new array of combined values.
  26818. * @example
  26819. *
  26820. * _.union([2], [1, 2]);
  26821. * // => [2, 1]
  26822. */
  26823. var union = baseRest(function(arrays) {
  26824. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26825. });
  26826. /**
  26827. * This method is like `_.union` except that it accepts `iteratee` which is
  26828. * invoked for each element of each `arrays` to generate the criterion by
  26829. * which uniqueness is computed. Result values are chosen from the first
  26830. * array in which the value occurs. The iteratee is invoked with one argument:
  26831. * (value).
  26832. *
  26833. * @static
  26834. * @memberOf _
  26835. * @since 4.0.0
  26836. * @category Array
  26837. * @param {...Array} [arrays] The arrays to inspect.
  26838. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26839. * @returns {Array} Returns the new array of combined values.
  26840. * @example
  26841. *
  26842. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26843. * // => [2.1, 1.2]
  26844. *
  26845. * // The `_.property` iteratee shorthand.
  26846. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26847. * // => [{ 'x': 1 }, { 'x': 2 }]
  26848. */
  26849. var unionBy = baseRest(function(arrays) {
  26850. var iteratee = last(arrays);
  26851. if (isArrayLikeObject(iteratee)) {
  26852. iteratee = undefined;
  26853. }
  26854. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26855. });
  26856. /**
  26857. * This method is like `_.union` except that it accepts `comparator` which
  26858. * is invoked to compare elements of `arrays`. Result values are chosen from
  26859. * the first array in which the value occurs. The comparator is invoked
  26860. * with two arguments: (arrVal, othVal).
  26861. *
  26862. * @static
  26863. * @memberOf _
  26864. * @since 4.0.0
  26865. * @category Array
  26866. * @param {...Array} [arrays] The arrays to inspect.
  26867. * @param {Function} [comparator] The comparator invoked per element.
  26868. * @returns {Array} Returns the new array of combined values.
  26869. * @example
  26870. *
  26871. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26872. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26873. *
  26874. * _.unionWith(objects, others, _.isEqual);
  26875. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26876. */
  26877. var unionWith = baseRest(function(arrays) {
  26878. var comparator = last(arrays);
  26879. comparator = typeof comparator == 'function' ? comparator : undefined;
  26880. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26881. });
  26882. /**
  26883. * Creates a duplicate-free version of an array, using
  26884. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26885. * for equality comparisons, in which only the first occurrence of each element
  26886. * is kept. The order of result values is determined by the order they occur
  26887. * in the array.
  26888. *
  26889. * @static
  26890. * @memberOf _
  26891. * @since 0.1.0
  26892. * @category Array
  26893. * @param {Array} array The array to inspect.
  26894. * @returns {Array} Returns the new duplicate free array.
  26895. * @example
  26896. *
  26897. * _.uniq([2, 1, 2]);
  26898. * // => [2, 1]
  26899. */
  26900. function uniq(array) {
  26901. return (array && array.length) ? baseUniq(array) : [];
  26902. }
  26903. /**
  26904. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26905. * invoked for each element in `array` to generate the criterion by which
  26906. * uniqueness is computed. The order of result values is determined by the
  26907. * order they occur in the array. The iteratee is invoked with one argument:
  26908. * (value).
  26909. *
  26910. * @static
  26911. * @memberOf _
  26912. * @since 4.0.0
  26913. * @category Array
  26914. * @param {Array} array The array to inspect.
  26915. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26916. * @returns {Array} Returns the new duplicate free array.
  26917. * @example
  26918. *
  26919. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26920. * // => [2.1, 1.2]
  26921. *
  26922. * // The `_.property` iteratee shorthand.
  26923. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26924. * // => [{ 'x': 1 }, { 'x': 2 }]
  26925. */
  26926. function uniqBy(array, iteratee) {
  26927. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26928. }
  26929. /**
  26930. * This method is like `_.uniq` except that it accepts `comparator` which
  26931. * is invoked to compare elements of `array`. The order of result values is
  26932. * determined by the order they occur in the array.The comparator is invoked
  26933. * with two arguments: (arrVal, othVal).
  26934. *
  26935. * @static
  26936. * @memberOf _
  26937. * @since 4.0.0
  26938. * @category Array
  26939. * @param {Array} array The array to inspect.
  26940. * @param {Function} [comparator] The comparator invoked per element.
  26941. * @returns {Array} Returns the new duplicate free array.
  26942. * @example
  26943. *
  26944. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26945. *
  26946. * _.uniqWith(objects, _.isEqual);
  26947. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26948. */
  26949. function uniqWith(array, comparator) {
  26950. comparator = typeof comparator == 'function' ? comparator : undefined;
  26951. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26952. }
  26953. /**
  26954. * This method is like `_.zip` except that it accepts an array of grouped
  26955. * elements and creates an array regrouping the elements to their pre-zip
  26956. * configuration.
  26957. *
  26958. * @static
  26959. * @memberOf _
  26960. * @since 1.2.0
  26961. * @category Array
  26962. * @param {Array} array The array of grouped elements to process.
  26963. * @returns {Array} Returns the new array of regrouped elements.
  26964. * @example
  26965. *
  26966. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26967. * // => [['a', 1, true], ['b', 2, false]]
  26968. *
  26969. * _.unzip(zipped);
  26970. * // => [['a', 'b'], [1, 2], [true, false]]
  26971. */
  26972. function unzip(array) {
  26973. if (!(array && array.length)) {
  26974. return [];
  26975. }
  26976. var length = 0;
  26977. array = arrayFilter(array, function(group) {
  26978. if (isArrayLikeObject(group)) {
  26979. length = nativeMax(group.length, length);
  26980. return true;
  26981. }
  26982. });
  26983. return baseTimes(length, function(index) {
  26984. return arrayMap(array, baseProperty(index));
  26985. });
  26986. }
  26987. /**
  26988. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26989. * how regrouped values should be combined. The iteratee is invoked with the
  26990. * elements of each group: (...group).
  26991. *
  26992. * @static
  26993. * @memberOf _
  26994. * @since 3.8.0
  26995. * @category Array
  26996. * @param {Array} array The array of grouped elements to process.
  26997. * @param {Function} [iteratee=_.identity] The function to combine
  26998. * regrouped values.
  26999. * @returns {Array} Returns the new array of regrouped elements.
  27000. * @example
  27001. *
  27002. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  27003. * // => [[1, 10, 100], [2, 20, 200]]
  27004. *
  27005. * _.unzipWith(zipped, _.add);
  27006. * // => [3, 30, 300]
  27007. */
  27008. function unzipWith(array, iteratee) {
  27009. if (!(array && array.length)) {
  27010. return [];
  27011. }
  27012. var result = unzip(array);
  27013. if (iteratee == null) {
  27014. return result;
  27015. }
  27016. return arrayMap(result, function(group) {
  27017. return apply(iteratee, undefined, group);
  27018. });
  27019. }
  27020. /**
  27021. * Creates an array excluding all given values using
  27022. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27023. * for equality comparisons.
  27024. *
  27025. * **Note:** Unlike `_.pull`, this method returns a new array.
  27026. *
  27027. * @static
  27028. * @memberOf _
  27029. * @since 0.1.0
  27030. * @category Array
  27031. * @param {Array} array The array to inspect.
  27032. * @param {...*} [values] The values to exclude.
  27033. * @returns {Array} Returns the new array of filtered values.
  27034. * @see _.difference, _.xor
  27035. * @example
  27036. *
  27037. * _.without([2, 1, 2, 3], 1, 2);
  27038. * // => [3]
  27039. */
  27040. var without = baseRest(function(array, values) {
  27041. return isArrayLikeObject(array)
  27042. ? baseDifference(array, values)
  27043. : [];
  27044. });
  27045. /**
  27046. * Creates an array of unique values that is the
  27047. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27048. * of the given arrays. The order of result values is determined by the order
  27049. * they occur in the arrays.
  27050. *
  27051. * @static
  27052. * @memberOf _
  27053. * @since 2.4.0
  27054. * @category Array
  27055. * @param {...Array} [arrays] The arrays to inspect.
  27056. * @returns {Array} Returns the new array of filtered values.
  27057. * @see _.difference, _.without
  27058. * @example
  27059. *
  27060. * _.xor([2, 1], [2, 3]);
  27061. * // => [1, 3]
  27062. */
  27063. var xor = baseRest(function(arrays) {
  27064. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27065. });
  27066. /**
  27067. * This method is like `_.xor` except that it accepts `iteratee` which is
  27068. * invoked for each element of each `arrays` to generate the criterion by
  27069. * which by which they're compared. The order of result values is determined
  27070. * by the order they occur in the arrays. The iteratee is invoked with one
  27071. * argument: (value).
  27072. *
  27073. * @static
  27074. * @memberOf _
  27075. * @since 4.0.0
  27076. * @category Array
  27077. * @param {...Array} [arrays] The arrays to inspect.
  27078. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27079. * @returns {Array} Returns the new array of filtered values.
  27080. * @example
  27081. *
  27082. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27083. * // => [1.2, 3.4]
  27084. *
  27085. * // The `_.property` iteratee shorthand.
  27086. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27087. * // => [{ 'x': 2 }]
  27088. */
  27089. var xorBy = baseRest(function(arrays) {
  27090. var iteratee = last(arrays);
  27091. if (isArrayLikeObject(iteratee)) {
  27092. iteratee = undefined;
  27093. }
  27094. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27095. });
  27096. /**
  27097. * This method is like `_.xor` except that it accepts `comparator` which is
  27098. * invoked to compare elements of `arrays`. The order of result values is
  27099. * determined by the order they occur in the arrays. The comparator is invoked
  27100. * with two arguments: (arrVal, othVal).
  27101. *
  27102. * @static
  27103. * @memberOf _
  27104. * @since 4.0.0
  27105. * @category Array
  27106. * @param {...Array} [arrays] The arrays to inspect.
  27107. * @param {Function} [comparator] The comparator invoked per element.
  27108. * @returns {Array} Returns the new array of filtered values.
  27109. * @example
  27110. *
  27111. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27112. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27113. *
  27114. * _.xorWith(objects, others, _.isEqual);
  27115. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27116. */
  27117. var xorWith = baseRest(function(arrays) {
  27118. var comparator = last(arrays);
  27119. comparator = typeof comparator == 'function' ? comparator : undefined;
  27120. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27121. });
  27122. /**
  27123. * Creates an array of grouped elements, the first of which contains the
  27124. * first elements of the given arrays, the second of which contains the
  27125. * second elements of the given arrays, and so on.
  27126. *
  27127. * @static
  27128. * @memberOf _
  27129. * @since 0.1.0
  27130. * @category Array
  27131. * @param {...Array} [arrays] The arrays to process.
  27132. * @returns {Array} Returns the new array of grouped elements.
  27133. * @example
  27134. *
  27135. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27136. * // => [['a', 1, true], ['b', 2, false]]
  27137. */
  27138. var zip = baseRest(unzip);
  27139. /**
  27140. * This method is like `_.fromPairs` except that it accepts two arrays,
  27141. * one of property identifiers and one of corresponding values.
  27142. *
  27143. * @static
  27144. * @memberOf _
  27145. * @since 0.4.0
  27146. * @category Array
  27147. * @param {Array} [props=[]] The property identifiers.
  27148. * @param {Array} [values=[]] The property values.
  27149. * @returns {Object} Returns the new object.
  27150. * @example
  27151. *
  27152. * _.zipObject(['a', 'b'], [1, 2]);
  27153. * // => { 'a': 1, 'b': 2 }
  27154. */
  27155. function zipObject(props, values) {
  27156. return baseZipObject(props || [], values || [], assignValue);
  27157. }
  27158. /**
  27159. * This method is like `_.zipObject` except that it supports property paths.
  27160. *
  27161. * @static
  27162. * @memberOf _
  27163. * @since 4.1.0
  27164. * @category Array
  27165. * @param {Array} [props=[]] The property identifiers.
  27166. * @param {Array} [values=[]] The property values.
  27167. * @returns {Object} Returns the new object.
  27168. * @example
  27169. *
  27170. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27171. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27172. */
  27173. function zipObjectDeep(props, values) {
  27174. return baseZipObject(props || [], values || [], baseSet);
  27175. }
  27176. /**
  27177. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27178. * how grouped values should be combined. The iteratee is invoked with the
  27179. * elements of each group: (...group).
  27180. *
  27181. * @static
  27182. * @memberOf _
  27183. * @since 3.8.0
  27184. * @category Array
  27185. * @param {...Array} [arrays] The arrays to process.
  27186. * @param {Function} [iteratee=_.identity] The function to combine
  27187. * grouped values.
  27188. * @returns {Array} Returns the new array of grouped elements.
  27189. * @example
  27190. *
  27191. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27192. * return a + b + c;
  27193. * });
  27194. * // => [111, 222]
  27195. */
  27196. var zipWith = baseRest(function(arrays) {
  27197. var length = arrays.length,
  27198. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27199. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27200. return unzipWith(arrays, iteratee);
  27201. });
  27202. /*------------------------------------------------------------------------*/
  27203. /**
  27204. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27205. * chain sequences enabled. The result of such sequences must be unwrapped
  27206. * with `_#value`.
  27207. *
  27208. * @static
  27209. * @memberOf _
  27210. * @since 1.3.0
  27211. * @category Seq
  27212. * @param {*} value The value to wrap.
  27213. * @returns {Object} Returns the new `lodash` wrapper instance.
  27214. * @example
  27215. *
  27216. * var users = [
  27217. * { 'user': 'barney', 'age': 36 },
  27218. * { 'user': 'fred', 'age': 40 },
  27219. * { 'user': 'pebbles', 'age': 1 }
  27220. * ];
  27221. *
  27222. * var youngest = _
  27223. * .chain(users)
  27224. * .sortBy('age')
  27225. * .map(function(o) {
  27226. * return o.user + ' is ' + o.age;
  27227. * })
  27228. * .head()
  27229. * .value();
  27230. * // => 'pebbles is 1'
  27231. */
  27232. function chain(value) {
  27233. var result = lodash(value);
  27234. result.__chain__ = true;
  27235. return result;
  27236. }
  27237. /**
  27238. * This method invokes `interceptor` and returns `value`. The interceptor
  27239. * is invoked with one argument; (value). The purpose of this method is to
  27240. * "tap into" a method chain sequence in order to modify intermediate results.
  27241. *
  27242. * @static
  27243. * @memberOf _
  27244. * @since 0.1.0
  27245. * @category Seq
  27246. * @param {*} value The value to provide to `interceptor`.
  27247. * @param {Function} interceptor The function to invoke.
  27248. * @returns {*} Returns `value`.
  27249. * @example
  27250. *
  27251. * _([1, 2, 3])
  27252. * .tap(function(array) {
  27253. * // Mutate input array.
  27254. * array.pop();
  27255. * })
  27256. * .reverse()
  27257. * .value();
  27258. * // => [2, 1]
  27259. */
  27260. function tap(value, interceptor) {
  27261. interceptor(value);
  27262. return value;
  27263. }
  27264. /**
  27265. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27266. * The purpose of this method is to "pass thru" values replacing intermediate
  27267. * results in a method chain sequence.
  27268. *
  27269. * @static
  27270. * @memberOf _
  27271. * @since 3.0.0
  27272. * @category Seq
  27273. * @param {*} value The value to provide to `interceptor`.
  27274. * @param {Function} interceptor The function to invoke.
  27275. * @returns {*} Returns the result of `interceptor`.
  27276. * @example
  27277. *
  27278. * _(' abc ')
  27279. * .chain()
  27280. * .trim()
  27281. * .thru(function(value) {
  27282. * return [value];
  27283. * })
  27284. * .value();
  27285. * // => ['abc']
  27286. */
  27287. function thru(value, interceptor) {
  27288. return interceptor(value);
  27289. }
  27290. /**
  27291. * This method is the wrapper version of `_.at`.
  27292. *
  27293. * @name at
  27294. * @memberOf _
  27295. * @since 1.0.0
  27296. * @category Seq
  27297. * @param {...(string|string[])} [paths] The property paths to pick.
  27298. * @returns {Object} Returns the new `lodash` wrapper instance.
  27299. * @example
  27300. *
  27301. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27302. *
  27303. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27304. * // => [3, 4]
  27305. */
  27306. var wrapperAt = flatRest(function(paths) {
  27307. var length = paths.length,
  27308. start = length ? paths[0] : 0,
  27309. value = this.__wrapped__,
  27310. interceptor = function(object) { return baseAt(object, paths); };
  27311. if (length > 1 || this.__actions__.length ||
  27312. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27313. return this.thru(interceptor);
  27314. }
  27315. value = value.slice(start, +start + (length ? 1 : 0));
  27316. value.__actions__.push({
  27317. 'func': thru,
  27318. 'args': [interceptor],
  27319. 'thisArg': undefined
  27320. });
  27321. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27322. if (length && !array.length) {
  27323. array.push(undefined);
  27324. }
  27325. return array;
  27326. });
  27327. });
  27328. /**
  27329. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27330. *
  27331. * @name chain
  27332. * @memberOf _
  27333. * @since 0.1.0
  27334. * @category Seq
  27335. * @returns {Object} Returns the new `lodash` wrapper instance.
  27336. * @example
  27337. *
  27338. * var users = [
  27339. * { 'user': 'barney', 'age': 36 },
  27340. * { 'user': 'fred', 'age': 40 }
  27341. * ];
  27342. *
  27343. * // A sequence without explicit chaining.
  27344. * _(users).head();
  27345. * // => { 'user': 'barney', 'age': 36 }
  27346. *
  27347. * // A sequence with explicit chaining.
  27348. * _(users)
  27349. * .chain()
  27350. * .head()
  27351. * .pick('user')
  27352. * .value();
  27353. * // => { 'user': 'barney' }
  27354. */
  27355. function wrapperChain() {
  27356. return chain(this);
  27357. }
  27358. /**
  27359. * Executes the chain sequence and returns the wrapped result.
  27360. *
  27361. * @name commit
  27362. * @memberOf _
  27363. * @since 3.2.0
  27364. * @category Seq
  27365. * @returns {Object} Returns the new `lodash` wrapper instance.
  27366. * @example
  27367. *
  27368. * var array = [1, 2];
  27369. * var wrapped = _(array).push(3);
  27370. *
  27371. * console.log(array);
  27372. * // => [1, 2]
  27373. *
  27374. * wrapped = wrapped.commit();
  27375. * console.log(array);
  27376. * // => [1, 2, 3]
  27377. *
  27378. * wrapped.last();
  27379. * // => 3
  27380. *
  27381. * console.log(array);
  27382. * // => [1, 2, 3]
  27383. */
  27384. function wrapperCommit() {
  27385. return new LodashWrapper(this.value(), this.__chain__);
  27386. }
  27387. /**
  27388. * Gets the next value on a wrapped object following the
  27389. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27390. *
  27391. * @name next
  27392. * @memberOf _
  27393. * @since 4.0.0
  27394. * @category Seq
  27395. * @returns {Object} Returns the next iterator value.
  27396. * @example
  27397. *
  27398. * var wrapped = _([1, 2]);
  27399. *
  27400. * wrapped.next();
  27401. * // => { 'done': false, 'value': 1 }
  27402. *
  27403. * wrapped.next();
  27404. * // => { 'done': false, 'value': 2 }
  27405. *
  27406. * wrapped.next();
  27407. * // => { 'done': true, 'value': undefined }
  27408. */
  27409. function wrapperNext() {
  27410. if (this.__values__ === undefined) {
  27411. this.__values__ = toArray(this.value());
  27412. }
  27413. var done = this.__index__ >= this.__values__.length,
  27414. value = done ? undefined : this.__values__[this.__index__++];
  27415. return { 'done': done, 'value': value };
  27416. }
  27417. /**
  27418. * Enables the wrapper to be iterable.
  27419. *
  27420. * @name Symbol.iterator
  27421. * @memberOf _
  27422. * @since 4.0.0
  27423. * @category Seq
  27424. * @returns {Object} Returns the wrapper object.
  27425. * @example
  27426. *
  27427. * var wrapped = _([1, 2]);
  27428. *
  27429. * wrapped[Symbol.iterator]() === wrapped;
  27430. * // => true
  27431. *
  27432. * Array.from(wrapped);
  27433. * // => [1, 2]
  27434. */
  27435. function wrapperToIterator() {
  27436. return this;
  27437. }
  27438. /**
  27439. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27440. *
  27441. * @name plant
  27442. * @memberOf _
  27443. * @since 3.2.0
  27444. * @category Seq
  27445. * @param {*} value The value to plant.
  27446. * @returns {Object} Returns the new `lodash` wrapper instance.
  27447. * @example
  27448. *
  27449. * function square(n) {
  27450. * return n * n;
  27451. * }
  27452. *
  27453. * var wrapped = _([1, 2]).map(square);
  27454. * var other = wrapped.plant([3, 4]);
  27455. *
  27456. * other.value();
  27457. * // => [9, 16]
  27458. *
  27459. * wrapped.value();
  27460. * // => [1, 4]
  27461. */
  27462. function wrapperPlant(value) {
  27463. var result,
  27464. parent = this;
  27465. while (parent instanceof baseLodash) {
  27466. var clone = wrapperClone(parent);
  27467. clone.__index__ = 0;
  27468. clone.__values__ = undefined;
  27469. if (result) {
  27470. previous.__wrapped__ = clone;
  27471. } else {
  27472. result = clone;
  27473. }
  27474. var previous = clone;
  27475. parent = parent.__wrapped__;
  27476. }
  27477. previous.__wrapped__ = value;
  27478. return result;
  27479. }
  27480. /**
  27481. * This method is the wrapper version of `_.reverse`.
  27482. *
  27483. * **Note:** This method mutates the wrapped array.
  27484. *
  27485. * @name reverse
  27486. * @memberOf _
  27487. * @since 0.1.0
  27488. * @category Seq
  27489. * @returns {Object} Returns the new `lodash` wrapper instance.
  27490. * @example
  27491. *
  27492. * var array = [1, 2, 3];
  27493. *
  27494. * _(array).reverse().value()
  27495. * // => [3, 2, 1]
  27496. *
  27497. * console.log(array);
  27498. * // => [3, 2, 1]
  27499. */
  27500. function wrapperReverse() {
  27501. var value = this.__wrapped__;
  27502. if (value instanceof LazyWrapper) {
  27503. var wrapped = value;
  27504. if (this.__actions__.length) {
  27505. wrapped = new LazyWrapper(this);
  27506. }
  27507. wrapped = wrapped.reverse();
  27508. wrapped.__actions__.push({
  27509. 'func': thru,
  27510. 'args': [reverse],
  27511. 'thisArg': undefined
  27512. });
  27513. return new LodashWrapper(wrapped, this.__chain__);
  27514. }
  27515. return this.thru(reverse);
  27516. }
  27517. /**
  27518. * Executes the chain sequence to resolve the unwrapped value.
  27519. *
  27520. * @name value
  27521. * @memberOf _
  27522. * @since 0.1.0
  27523. * @alias toJSON, valueOf
  27524. * @category Seq
  27525. * @returns {*} Returns the resolved unwrapped value.
  27526. * @example
  27527. *
  27528. * _([1, 2, 3]).value();
  27529. * // => [1, 2, 3]
  27530. */
  27531. function wrapperValue() {
  27532. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27533. }
  27534. /*------------------------------------------------------------------------*/
  27535. /**
  27536. * Creates an object composed of keys generated from the results of running
  27537. * each element of `collection` thru `iteratee`. The corresponding value of
  27538. * each key is the number of times the key was returned by `iteratee`. The
  27539. * iteratee is invoked with one argument: (value).
  27540. *
  27541. * @static
  27542. * @memberOf _
  27543. * @since 0.5.0
  27544. * @category Collection
  27545. * @param {Array|Object} collection The collection to iterate over.
  27546. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27547. * @returns {Object} Returns the composed aggregate object.
  27548. * @example
  27549. *
  27550. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27551. * // => { '4': 1, '6': 2 }
  27552. *
  27553. * // The `_.property` iteratee shorthand.
  27554. * _.countBy(['one', 'two', 'three'], 'length');
  27555. * // => { '3': 2, '5': 1 }
  27556. */
  27557. var countBy = createAggregator(function(result, value, key) {
  27558. if (hasOwnProperty.call(result, key)) {
  27559. ++result[key];
  27560. } else {
  27561. baseAssignValue(result, key, 1);
  27562. }
  27563. });
  27564. /**
  27565. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27566. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27567. * invoked with three arguments: (value, index|key, collection).
  27568. *
  27569. * **Note:** This method returns `true` for
  27570. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27571. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27572. * elements of empty collections.
  27573. *
  27574. * @static
  27575. * @memberOf _
  27576. * @since 0.1.0
  27577. * @category Collection
  27578. * @param {Array|Object} collection The collection to iterate over.
  27579. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27580. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27581. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27582. * else `false`.
  27583. * @example
  27584. *
  27585. * _.every([true, 1, null, 'yes'], Boolean);
  27586. * // => false
  27587. *
  27588. * var users = [
  27589. * { 'user': 'barney', 'age': 36, 'active': false },
  27590. * { 'user': 'fred', 'age': 40, 'active': false }
  27591. * ];
  27592. *
  27593. * // The `_.matches` iteratee shorthand.
  27594. * _.every(users, { 'user': 'barney', 'active': false });
  27595. * // => false
  27596. *
  27597. * // The `_.matchesProperty` iteratee shorthand.
  27598. * _.every(users, ['active', false]);
  27599. * // => true
  27600. *
  27601. * // The `_.property` iteratee shorthand.
  27602. * _.every(users, 'active');
  27603. * // => false
  27604. */
  27605. function every(collection, predicate, guard) {
  27606. var func = isArray(collection) ? arrayEvery : baseEvery;
  27607. if (guard && isIterateeCall(collection, predicate, guard)) {
  27608. predicate = undefined;
  27609. }
  27610. return func(collection, getIteratee(predicate, 3));
  27611. }
  27612. /**
  27613. * Iterates over elements of `collection`, returning an array of all elements
  27614. * `predicate` returns truthy for. The predicate is invoked with three
  27615. * arguments: (value, index|key, collection).
  27616. *
  27617. * **Note:** Unlike `_.remove`, this method returns a new array.
  27618. *
  27619. * @static
  27620. * @memberOf _
  27621. * @since 0.1.0
  27622. * @category Collection
  27623. * @param {Array|Object} collection The collection to iterate over.
  27624. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27625. * @returns {Array} Returns the new filtered array.
  27626. * @see _.reject
  27627. * @example
  27628. *
  27629. * var users = [
  27630. * { 'user': 'barney', 'age': 36, 'active': true },
  27631. * { 'user': 'fred', 'age': 40, 'active': false }
  27632. * ];
  27633. *
  27634. * _.filter(users, function(o) { return !o.active; });
  27635. * // => objects for ['fred']
  27636. *
  27637. * // The `_.matches` iteratee shorthand.
  27638. * _.filter(users, { 'age': 36, 'active': true });
  27639. * // => objects for ['barney']
  27640. *
  27641. * // The `_.matchesProperty` iteratee shorthand.
  27642. * _.filter(users, ['active', false]);
  27643. * // => objects for ['fred']
  27644. *
  27645. * // The `_.property` iteratee shorthand.
  27646. * _.filter(users, 'active');
  27647. * // => objects for ['barney']
  27648. */
  27649. function filter(collection, predicate) {
  27650. var func = isArray(collection) ? arrayFilter : baseFilter;
  27651. return func(collection, getIteratee(predicate, 3));
  27652. }
  27653. /**
  27654. * Iterates over elements of `collection`, returning the first element
  27655. * `predicate` returns truthy for. The predicate is invoked with three
  27656. * arguments: (value, index|key, collection).
  27657. *
  27658. * @static
  27659. * @memberOf _
  27660. * @since 0.1.0
  27661. * @category Collection
  27662. * @param {Array|Object} collection The collection to inspect.
  27663. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27664. * @param {number} [fromIndex=0] The index to search from.
  27665. * @returns {*} Returns the matched element, else `undefined`.
  27666. * @example
  27667. *
  27668. * var users = [
  27669. * { 'user': 'barney', 'age': 36, 'active': true },
  27670. * { 'user': 'fred', 'age': 40, 'active': false },
  27671. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27672. * ];
  27673. *
  27674. * _.find(users, function(o) { return o.age < 40; });
  27675. * // => object for 'barney'
  27676. *
  27677. * // The `_.matches` iteratee shorthand.
  27678. * _.find(users, { 'age': 1, 'active': true });
  27679. * // => object for 'pebbles'
  27680. *
  27681. * // The `_.matchesProperty` iteratee shorthand.
  27682. * _.find(users, ['active', false]);
  27683. * // => object for 'fred'
  27684. *
  27685. * // The `_.property` iteratee shorthand.
  27686. * _.find(users, 'active');
  27687. * // => object for 'barney'
  27688. */
  27689. var find = createFind(findIndex);
  27690. /**
  27691. * This method is like `_.find` except that it iterates over elements of
  27692. * `collection` from right to left.
  27693. *
  27694. * @static
  27695. * @memberOf _
  27696. * @since 2.0.0
  27697. * @category Collection
  27698. * @param {Array|Object} collection The collection to inspect.
  27699. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27700. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27701. * @returns {*} Returns the matched element, else `undefined`.
  27702. * @example
  27703. *
  27704. * _.findLast([1, 2, 3, 4], function(n) {
  27705. * return n % 2 == 1;
  27706. * });
  27707. * // => 3
  27708. */
  27709. var findLast = createFind(findLastIndex);
  27710. /**
  27711. * Creates a flattened array of values by running each element in `collection`
  27712. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27713. * with three arguments: (value, index|key, collection).
  27714. *
  27715. * @static
  27716. * @memberOf _
  27717. * @since 4.0.0
  27718. * @category Collection
  27719. * @param {Array|Object} collection The collection to iterate over.
  27720. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27721. * @returns {Array} Returns the new flattened array.
  27722. * @example
  27723. *
  27724. * function duplicate(n) {
  27725. * return [n, n];
  27726. * }
  27727. *
  27728. * _.flatMap([1, 2], duplicate);
  27729. * // => [1, 1, 2, 2]
  27730. */
  27731. function flatMap(collection, iteratee) {
  27732. return baseFlatten(map(collection, iteratee), 1);
  27733. }
  27734. /**
  27735. * This method is like `_.flatMap` except that it recursively flattens the
  27736. * mapped results.
  27737. *
  27738. * @static
  27739. * @memberOf _
  27740. * @since 4.7.0
  27741. * @category Collection
  27742. * @param {Array|Object} collection The collection to iterate over.
  27743. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27744. * @returns {Array} Returns the new flattened array.
  27745. * @example
  27746. *
  27747. * function duplicate(n) {
  27748. * return [[[n, n]]];
  27749. * }
  27750. *
  27751. * _.flatMapDeep([1, 2], duplicate);
  27752. * // => [1, 1, 2, 2]
  27753. */
  27754. function flatMapDeep(collection, iteratee) {
  27755. return baseFlatten(map(collection, iteratee), INFINITY);
  27756. }
  27757. /**
  27758. * This method is like `_.flatMap` except that it recursively flattens the
  27759. * mapped results up to `depth` times.
  27760. *
  27761. * @static
  27762. * @memberOf _
  27763. * @since 4.7.0
  27764. * @category Collection
  27765. * @param {Array|Object} collection The collection to iterate over.
  27766. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27767. * @param {number} [depth=1] The maximum recursion depth.
  27768. * @returns {Array} Returns the new flattened array.
  27769. * @example
  27770. *
  27771. * function duplicate(n) {
  27772. * return [[[n, n]]];
  27773. * }
  27774. *
  27775. * _.flatMapDepth([1, 2], duplicate, 2);
  27776. * // => [[1, 1], [2, 2]]
  27777. */
  27778. function flatMapDepth(collection, iteratee, depth) {
  27779. depth = depth === undefined ? 1 : toInteger(depth);
  27780. return baseFlatten(map(collection, iteratee), depth);
  27781. }
  27782. /**
  27783. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27784. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27785. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27786. *
  27787. * **Note:** As with other "Collections" methods, objects with a "length"
  27788. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27789. * or `_.forOwn` for object iteration.
  27790. *
  27791. * @static
  27792. * @memberOf _
  27793. * @since 0.1.0
  27794. * @alias each
  27795. * @category Collection
  27796. * @param {Array|Object} collection The collection to iterate over.
  27797. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27798. * @returns {Array|Object} Returns `collection`.
  27799. * @see _.forEachRight
  27800. * @example
  27801. *
  27802. * _.forEach([1, 2], function(value) {
  27803. * console.log(value);
  27804. * });
  27805. * // => Logs `1` then `2`.
  27806. *
  27807. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27808. * console.log(key);
  27809. * });
  27810. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27811. */
  27812. function forEach(collection, iteratee) {
  27813. var func = isArray(collection) ? arrayEach : baseEach;
  27814. return func(collection, getIteratee(iteratee, 3));
  27815. }
  27816. /**
  27817. * This method is like `_.forEach` except that it iterates over elements of
  27818. * `collection` from right to left.
  27819. *
  27820. * @static
  27821. * @memberOf _
  27822. * @since 2.0.0
  27823. * @alias eachRight
  27824. * @category Collection
  27825. * @param {Array|Object} collection The collection to iterate over.
  27826. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27827. * @returns {Array|Object} Returns `collection`.
  27828. * @see _.forEach
  27829. * @example
  27830. *
  27831. * _.forEachRight([1, 2], function(value) {
  27832. * console.log(value);
  27833. * });
  27834. * // => Logs `2` then `1`.
  27835. */
  27836. function forEachRight(collection, iteratee) {
  27837. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27838. return func(collection, getIteratee(iteratee, 3));
  27839. }
  27840. /**
  27841. * Creates an object composed of keys generated from the results of running
  27842. * each element of `collection` thru `iteratee`. The order of grouped values
  27843. * is determined by the order they occur in `collection`. The corresponding
  27844. * value of each key is an array of elements responsible for generating the
  27845. * key. The iteratee is invoked with one argument: (value).
  27846. *
  27847. * @static
  27848. * @memberOf _
  27849. * @since 0.1.0
  27850. * @category Collection
  27851. * @param {Array|Object} collection The collection to iterate over.
  27852. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27853. * @returns {Object} Returns the composed aggregate object.
  27854. * @example
  27855. *
  27856. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27857. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27858. *
  27859. * // The `_.property` iteratee shorthand.
  27860. * _.groupBy(['one', 'two', 'three'], 'length');
  27861. * // => { '3': ['one', 'two'], '5': ['three'] }
  27862. */
  27863. var groupBy = createAggregator(function(result, value, key) {
  27864. if (hasOwnProperty.call(result, key)) {
  27865. result[key].push(value);
  27866. } else {
  27867. baseAssignValue(result, key, [value]);
  27868. }
  27869. });
  27870. /**
  27871. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27872. * checked for a substring of `value`, otherwise
  27873. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27874. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27875. * the offset from the end of `collection`.
  27876. *
  27877. * @static
  27878. * @memberOf _
  27879. * @since 0.1.0
  27880. * @category Collection
  27881. * @param {Array|Object|string} collection The collection to inspect.
  27882. * @param {*} value The value to search for.
  27883. * @param {number} [fromIndex=0] The index to search from.
  27884. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27885. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27886. * @example
  27887. *
  27888. * _.includes([1, 2, 3], 1);
  27889. * // => true
  27890. *
  27891. * _.includes([1, 2, 3], 1, 2);
  27892. * // => false
  27893. *
  27894. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27895. * // => true
  27896. *
  27897. * _.includes('abcd', 'bc');
  27898. * // => true
  27899. */
  27900. function includes(collection, value, fromIndex, guard) {
  27901. collection = isArrayLike(collection) ? collection : values(collection);
  27902. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27903. var length = collection.length;
  27904. if (fromIndex < 0) {
  27905. fromIndex = nativeMax(length + fromIndex, 0);
  27906. }
  27907. return isString(collection)
  27908. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27909. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27910. }
  27911. /**
  27912. * Invokes the method at `path` of each element in `collection`, returning
  27913. * an array of the results of each invoked method. Any additional arguments
  27914. * are provided to each invoked method. If `path` is a function, it's invoked
  27915. * for, and `this` bound to, each element in `collection`.
  27916. *
  27917. * @static
  27918. * @memberOf _
  27919. * @since 4.0.0
  27920. * @category Collection
  27921. * @param {Array|Object} collection The collection to iterate over.
  27922. * @param {Array|Function|string} path The path of the method to invoke or
  27923. * the function invoked per iteration.
  27924. * @param {...*} [args] The arguments to invoke each method with.
  27925. * @returns {Array} Returns the array of results.
  27926. * @example
  27927. *
  27928. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27929. * // => [[1, 5, 7], [1, 2, 3]]
  27930. *
  27931. * _.invokeMap([123, 456], String.prototype.split, '');
  27932. * // => [['1', '2', '3'], ['4', '5', '6']]
  27933. */
  27934. var invokeMap = baseRest(function(collection, path, args) {
  27935. var index = -1,
  27936. isFunc = typeof path == 'function',
  27937. result = isArrayLike(collection) ? Array(collection.length) : [];
  27938. baseEach(collection, function(value) {
  27939. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27940. });
  27941. return result;
  27942. });
  27943. /**
  27944. * Creates an object composed of keys generated from the results of running
  27945. * each element of `collection` thru `iteratee`. The corresponding value of
  27946. * each key is the last element responsible for generating the key. The
  27947. * iteratee is invoked with one argument: (value).
  27948. *
  27949. * @static
  27950. * @memberOf _
  27951. * @since 4.0.0
  27952. * @category Collection
  27953. * @param {Array|Object} collection The collection to iterate over.
  27954. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27955. * @returns {Object} Returns the composed aggregate object.
  27956. * @example
  27957. *
  27958. * var array = [
  27959. * { 'dir': 'left', 'code': 97 },
  27960. * { 'dir': 'right', 'code': 100 }
  27961. * ];
  27962. *
  27963. * _.keyBy(array, function(o) {
  27964. * return String.fromCharCode(o.code);
  27965. * });
  27966. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27967. *
  27968. * _.keyBy(array, 'dir');
  27969. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27970. */
  27971. var keyBy = createAggregator(function(result, value, key) {
  27972. baseAssignValue(result, key, value);
  27973. });
  27974. /**
  27975. * Creates an array of values by running each element in `collection` thru
  27976. * `iteratee`. The iteratee is invoked with three arguments:
  27977. * (value, index|key, collection).
  27978. *
  27979. * Many lodash methods are guarded to work as iteratees for methods like
  27980. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27981. *
  27982. * The guarded methods are:
  27983. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27984. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27985. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27986. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27987. *
  27988. * @static
  27989. * @memberOf _
  27990. * @since 0.1.0
  27991. * @category Collection
  27992. * @param {Array|Object} collection The collection to iterate over.
  27993. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27994. * @returns {Array} Returns the new mapped array.
  27995. * @example
  27996. *
  27997. * function square(n) {
  27998. * return n * n;
  27999. * }
  28000. *
  28001. * _.map([4, 8], square);
  28002. * // => [16, 64]
  28003. *
  28004. * _.map({ 'a': 4, 'b': 8 }, square);
  28005. * // => [16, 64] (iteration order is not guaranteed)
  28006. *
  28007. * var users = [
  28008. * { 'user': 'barney' },
  28009. * { 'user': 'fred' }
  28010. * ];
  28011. *
  28012. * // The `_.property` iteratee shorthand.
  28013. * _.map(users, 'user');
  28014. * // => ['barney', 'fred']
  28015. */
  28016. function map(collection, iteratee) {
  28017. var func = isArray(collection) ? arrayMap : baseMap;
  28018. return func(collection, getIteratee(iteratee, 3));
  28019. }
  28020. /**
  28021. * This method is like `_.sortBy` except that it allows specifying the sort
  28022. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28023. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28024. * descending or "asc" for ascending sort order of corresponding values.
  28025. *
  28026. * @static
  28027. * @memberOf _
  28028. * @since 4.0.0
  28029. * @category Collection
  28030. * @param {Array|Object} collection The collection to iterate over.
  28031. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28032. * The iteratees to sort by.
  28033. * @param {string[]} [orders] The sort orders of `iteratees`.
  28034. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28035. * @returns {Array} Returns the new sorted array.
  28036. * @example
  28037. *
  28038. * var users = [
  28039. * { 'user': 'fred', 'age': 48 },
  28040. * { 'user': 'barney', 'age': 34 },
  28041. * { 'user': 'fred', 'age': 40 },
  28042. * { 'user': 'barney', 'age': 36 }
  28043. * ];
  28044. *
  28045. * // Sort by `user` in ascending order and by `age` in descending order.
  28046. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28047. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28048. */
  28049. function orderBy(collection, iteratees, orders, guard) {
  28050. if (collection == null) {
  28051. return [];
  28052. }
  28053. if (!isArray(iteratees)) {
  28054. iteratees = iteratees == null ? [] : [iteratees];
  28055. }
  28056. orders = guard ? undefined : orders;
  28057. if (!isArray(orders)) {
  28058. orders = orders == null ? [] : [orders];
  28059. }
  28060. return baseOrderBy(collection, iteratees, orders);
  28061. }
  28062. /**
  28063. * Creates an array of elements split into two groups, the first of which
  28064. * contains elements `predicate` returns truthy for, the second of which
  28065. * contains elements `predicate` returns falsey for. The predicate is
  28066. * invoked with one argument: (value).
  28067. *
  28068. * @static
  28069. * @memberOf _
  28070. * @since 3.0.0
  28071. * @category Collection
  28072. * @param {Array|Object} collection The collection to iterate over.
  28073. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28074. * @returns {Array} Returns the array of grouped elements.
  28075. * @example
  28076. *
  28077. * var users = [
  28078. * { 'user': 'barney', 'age': 36, 'active': false },
  28079. * { 'user': 'fred', 'age': 40, 'active': true },
  28080. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28081. * ];
  28082. *
  28083. * _.partition(users, function(o) { return o.active; });
  28084. * // => objects for [['fred'], ['barney', 'pebbles']]
  28085. *
  28086. * // The `_.matches` iteratee shorthand.
  28087. * _.partition(users, { 'age': 1, 'active': false });
  28088. * // => objects for [['pebbles'], ['barney', 'fred']]
  28089. *
  28090. * // The `_.matchesProperty` iteratee shorthand.
  28091. * _.partition(users, ['active', false]);
  28092. * // => objects for [['barney', 'pebbles'], ['fred']]
  28093. *
  28094. * // The `_.property` iteratee shorthand.
  28095. * _.partition(users, 'active');
  28096. * // => objects for [['fred'], ['barney', 'pebbles']]
  28097. */
  28098. var partition = createAggregator(function(result, value, key) {
  28099. result[key ? 0 : 1].push(value);
  28100. }, function() { return [[], []]; });
  28101. /**
  28102. * Reduces `collection` to a value which is the accumulated result of running
  28103. * each element in `collection` thru `iteratee`, where each successive
  28104. * invocation is supplied the return value of the previous. If `accumulator`
  28105. * is not given, the first element of `collection` is used as the initial
  28106. * value. The iteratee is invoked with four arguments:
  28107. * (accumulator, value, index|key, collection).
  28108. *
  28109. * Many lodash methods are guarded to work as iteratees for methods like
  28110. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28111. *
  28112. * The guarded methods are:
  28113. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28114. * and `sortBy`
  28115. *
  28116. * @static
  28117. * @memberOf _
  28118. * @since 0.1.0
  28119. * @category Collection
  28120. * @param {Array|Object} collection The collection to iterate over.
  28121. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28122. * @param {*} [accumulator] The initial value.
  28123. * @returns {*} Returns the accumulated value.
  28124. * @see _.reduceRight
  28125. * @example
  28126. *
  28127. * _.reduce([1, 2], function(sum, n) {
  28128. * return sum + n;
  28129. * }, 0);
  28130. * // => 3
  28131. *
  28132. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28133. * (result[value] || (result[value] = [])).push(key);
  28134. * return result;
  28135. * }, {});
  28136. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28137. */
  28138. function reduce(collection, iteratee, accumulator) {
  28139. var func = isArray(collection) ? arrayReduce : baseReduce,
  28140. initAccum = arguments.length < 3;
  28141. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28142. }
  28143. /**
  28144. * This method is like `_.reduce` except that it iterates over elements of
  28145. * `collection` from right to left.
  28146. *
  28147. * @static
  28148. * @memberOf _
  28149. * @since 0.1.0
  28150. * @category Collection
  28151. * @param {Array|Object} collection The collection to iterate over.
  28152. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28153. * @param {*} [accumulator] The initial value.
  28154. * @returns {*} Returns the accumulated value.
  28155. * @see _.reduce
  28156. * @example
  28157. *
  28158. * var array = [[0, 1], [2, 3], [4, 5]];
  28159. *
  28160. * _.reduceRight(array, function(flattened, other) {
  28161. * return flattened.concat(other);
  28162. * }, []);
  28163. * // => [4, 5, 2, 3, 0, 1]
  28164. */
  28165. function reduceRight(collection, iteratee, accumulator) {
  28166. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28167. initAccum = arguments.length < 3;
  28168. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28169. }
  28170. /**
  28171. * The opposite of `_.filter`; this method returns the elements of `collection`
  28172. * that `predicate` does **not** return truthy for.
  28173. *
  28174. * @static
  28175. * @memberOf _
  28176. * @since 0.1.0
  28177. * @category Collection
  28178. * @param {Array|Object} collection The collection to iterate over.
  28179. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28180. * @returns {Array} Returns the new filtered array.
  28181. * @see _.filter
  28182. * @example
  28183. *
  28184. * var users = [
  28185. * { 'user': 'barney', 'age': 36, 'active': false },
  28186. * { 'user': 'fred', 'age': 40, 'active': true }
  28187. * ];
  28188. *
  28189. * _.reject(users, function(o) { return !o.active; });
  28190. * // => objects for ['fred']
  28191. *
  28192. * // The `_.matches` iteratee shorthand.
  28193. * _.reject(users, { 'age': 40, 'active': true });
  28194. * // => objects for ['barney']
  28195. *
  28196. * // The `_.matchesProperty` iteratee shorthand.
  28197. * _.reject(users, ['active', false]);
  28198. * // => objects for ['fred']
  28199. *
  28200. * // The `_.property` iteratee shorthand.
  28201. * _.reject(users, 'active');
  28202. * // => objects for ['barney']
  28203. */
  28204. function reject(collection, predicate) {
  28205. var func = isArray(collection) ? arrayFilter : baseFilter;
  28206. return func(collection, negate(getIteratee(predicate, 3)));
  28207. }
  28208. /**
  28209. * Gets a random element from `collection`.
  28210. *
  28211. * @static
  28212. * @memberOf _
  28213. * @since 2.0.0
  28214. * @category Collection
  28215. * @param {Array|Object} collection The collection to sample.
  28216. * @returns {*} Returns the random element.
  28217. * @example
  28218. *
  28219. * _.sample([1, 2, 3, 4]);
  28220. * // => 2
  28221. */
  28222. function sample(collection) {
  28223. var func = isArray(collection) ? arraySample : baseSample;
  28224. return func(collection);
  28225. }
  28226. /**
  28227. * Gets `n` random elements at unique keys from `collection` up to the
  28228. * size of `collection`.
  28229. *
  28230. * @static
  28231. * @memberOf _
  28232. * @since 4.0.0
  28233. * @category Collection
  28234. * @param {Array|Object} collection The collection to sample.
  28235. * @param {number} [n=1] The number of elements to sample.
  28236. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28237. * @returns {Array} Returns the random elements.
  28238. * @example
  28239. *
  28240. * _.sampleSize([1, 2, 3], 2);
  28241. * // => [3, 1]
  28242. *
  28243. * _.sampleSize([1, 2, 3], 4);
  28244. * // => [2, 3, 1]
  28245. */
  28246. function sampleSize(collection, n, guard) {
  28247. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28248. n = 1;
  28249. } else {
  28250. n = toInteger(n);
  28251. }
  28252. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28253. return func(collection, n);
  28254. }
  28255. /**
  28256. * Creates an array of shuffled values, using a version of the
  28257. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28258. *
  28259. * @static
  28260. * @memberOf _
  28261. * @since 0.1.0
  28262. * @category Collection
  28263. * @param {Array|Object} collection The collection to shuffle.
  28264. * @returns {Array} Returns the new shuffled array.
  28265. * @example
  28266. *
  28267. * _.shuffle([1, 2, 3, 4]);
  28268. * // => [4, 1, 3, 2]
  28269. */
  28270. function shuffle(collection) {
  28271. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28272. return func(collection);
  28273. }
  28274. /**
  28275. * Gets the size of `collection` by returning its length for array-like
  28276. * values or the number of own enumerable string keyed properties for objects.
  28277. *
  28278. * @static
  28279. * @memberOf _
  28280. * @since 0.1.0
  28281. * @category Collection
  28282. * @param {Array|Object|string} collection The collection to inspect.
  28283. * @returns {number} Returns the collection size.
  28284. * @example
  28285. *
  28286. * _.size([1, 2, 3]);
  28287. * // => 3
  28288. *
  28289. * _.size({ 'a': 1, 'b': 2 });
  28290. * // => 2
  28291. *
  28292. * _.size('pebbles');
  28293. * // => 7
  28294. */
  28295. function size(collection) {
  28296. if (collection == null) {
  28297. return 0;
  28298. }
  28299. if (isArrayLike(collection)) {
  28300. return isString(collection) ? stringSize(collection) : collection.length;
  28301. }
  28302. var tag = getTag(collection);
  28303. if (tag == mapTag || tag == setTag) {
  28304. return collection.size;
  28305. }
  28306. return baseKeys(collection).length;
  28307. }
  28308. /**
  28309. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28310. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28311. * invoked with three arguments: (value, index|key, collection).
  28312. *
  28313. * @static
  28314. * @memberOf _
  28315. * @since 0.1.0
  28316. * @category Collection
  28317. * @param {Array|Object} collection The collection to iterate over.
  28318. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28319. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28320. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28321. * else `false`.
  28322. * @example
  28323. *
  28324. * _.some([null, 0, 'yes', false], Boolean);
  28325. * // => true
  28326. *
  28327. * var users = [
  28328. * { 'user': 'barney', 'active': true },
  28329. * { 'user': 'fred', 'active': false }
  28330. * ];
  28331. *
  28332. * // The `_.matches` iteratee shorthand.
  28333. * _.some(users, { 'user': 'barney', 'active': false });
  28334. * // => false
  28335. *
  28336. * // The `_.matchesProperty` iteratee shorthand.
  28337. * _.some(users, ['active', false]);
  28338. * // => true
  28339. *
  28340. * // The `_.property` iteratee shorthand.
  28341. * _.some(users, 'active');
  28342. * // => true
  28343. */
  28344. function some(collection, predicate, guard) {
  28345. var func = isArray(collection) ? arraySome : baseSome;
  28346. if (guard && isIterateeCall(collection, predicate, guard)) {
  28347. predicate = undefined;
  28348. }
  28349. return func(collection, getIteratee(predicate, 3));
  28350. }
  28351. /**
  28352. * Creates an array of elements, sorted in ascending order by the results of
  28353. * running each element in a collection thru each iteratee. This method
  28354. * performs a stable sort, that is, it preserves the original sort order of
  28355. * equal elements. The iteratees are invoked with one argument: (value).
  28356. *
  28357. * @static
  28358. * @memberOf _
  28359. * @since 0.1.0
  28360. * @category Collection
  28361. * @param {Array|Object} collection The collection to iterate over.
  28362. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28363. * The iteratees to sort by.
  28364. * @returns {Array} Returns the new sorted array.
  28365. * @example
  28366. *
  28367. * var users = [
  28368. * { 'user': 'fred', 'age': 48 },
  28369. * { 'user': 'barney', 'age': 36 },
  28370. * { 'user': 'fred', 'age': 40 },
  28371. * { 'user': 'barney', 'age': 34 }
  28372. * ];
  28373. *
  28374. * _.sortBy(users, [function(o) { return o.user; }]);
  28375. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28376. *
  28377. * _.sortBy(users, ['user', 'age']);
  28378. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28379. */
  28380. var sortBy = baseRest(function(collection, iteratees) {
  28381. if (collection == null) {
  28382. return [];
  28383. }
  28384. var length = iteratees.length;
  28385. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28386. iteratees = [];
  28387. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28388. iteratees = [iteratees[0]];
  28389. }
  28390. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28391. });
  28392. /*------------------------------------------------------------------------*/
  28393. /**
  28394. * Gets the timestamp of the number of milliseconds that have elapsed since
  28395. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28396. *
  28397. * @static
  28398. * @memberOf _
  28399. * @since 2.4.0
  28400. * @category Date
  28401. * @returns {number} Returns the timestamp.
  28402. * @example
  28403. *
  28404. * _.defer(function(stamp) {
  28405. * console.log(_.now() - stamp);
  28406. * }, _.now());
  28407. * // => Logs the number of milliseconds it took for the deferred invocation.
  28408. */
  28409. var now = ctxNow || function() {
  28410. return root.Date.now();
  28411. };
  28412. /*------------------------------------------------------------------------*/
  28413. /**
  28414. * The opposite of `_.before`; this method creates a function that invokes
  28415. * `func` once it's called `n` or more times.
  28416. *
  28417. * @static
  28418. * @memberOf _
  28419. * @since 0.1.0
  28420. * @category Function
  28421. * @param {number} n The number of calls before `func` is invoked.
  28422. * @param {Function} func The function to restrict.
  28423. * @returns {Function} Returns the new restricted function.
  28424. * @example
  28425. *
  28426. * var saves = ['profile', 'settings'];
  28427. *
  28428. * var done = _.after(saves.length, function() {
  28429. * console.log('done saving!');
  28430. * });
  28431. *
  28432. * _.forEach(saves, function(type) {
  28433. * asyncSave({ 'type': type, 'complete': done });
  28434. * });
  28435. * // => Logs 'done saving!' after the two async saves have completed.
  28436. */
  28437. function after(n, func) {
  28438. if (typeof func != 'function') {
  28439. throw new TypeError(FUNC_ERROR_TEXT);
  28440. }
  28441. n = toInteger(n);
  28442. return function() {
  28443. if (--n < 1) {
  28444. return func.apply(this, arguments);
  28445. }
  28446. };
  28447. }
  28448. /**
  28449. * Creates a function that invokes `func`, with up to `n` arguments,
  28450. * ignoring any additional arguments.
  28451. *
  28452. * @static
  28453. * @memberOf _
  28454. * @since 3.0.0
  28455. * @category Function
  28456. * @param {Function} func The function to cap arguments for.
  28457. * @param {number} [n=func.length] The arity cap.
  28458. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28459. * @returns {Function} Returns the new capped function.
  28460. * @example
  28461. *
  28462. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28463. * // => [6, 8, 10]
  28464. */
  28465. function ary(func, n, guard) {
  28466. n = guard ? undefined : n;
  28467. n = (func && n == null) ? func.length : n;
  28468. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28469. }
  28470. /**
  28471. * Creates a function that invokes `func`, with the `this` binding and arguments
  28472. * of the created function, while it's called less than `n` times. Subsequent
  28473. * calls to the created function return the result of the last `func` invocation.
  28474. *
  28475. * @static
  28476. * @memberOf _
  28477. * @since 3.0.0
  28478. * @category Function
  28479. * @param {number} n The number of calls at which `func` is no longer invoked.
  28480. * @param {Function} func The function to restrict.
  28481. * @returns {Function} Returns the new restricted function.
  28482. * @example
  28483. *
  28484. * jQuery(element).on('click', _.before(5, addContactToList));
  28485. * // => Allows adding up to 4 contacts to the list.
  28486. */
  28487. function before(n, func) {
  28488. var result;
  28489. if (typeof func != 'function') {
  28490. throw new TypeError(FUNC_ERROR_TEXT);
  28491. }
  28492. n = toInteger(n);
  28493. return function() {
  28494. if (--n > 0) {
  28495. result = func.apply(this, arguments);
  28496. }
  28497. if (n <= 1) {
  28498. func = undefined;
  28499. }
  28500. return result;
  28501. };
  28502. }
  28503. /**
  28504. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28505. * and `partials` prepended to the arguments it receives.
  28506. *
  28507. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28508. * may be used as a placeholder for partially applied arguments.
  28509. *
  28510. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28511. * property of bound functions.
  28512. *
  28513. * @static
  28514. * @memberOf _
  28515. * @since 0.1.0
  28516. * @category Function
  28517. * @param {Function} func The function to bind.
  28518. * @param {*} thisArg The `this` binding of `func`.
  28519. * @param {...*} [partials] The arguments to be partially applied.
  28520. * @returns {Function} Returns the new bound function.
  28521. * @example
  28522. *
  28523. * function greet(greeting, punctuation) {
  28524. * return greeting + ' ' + this.user + punctuation;
  28525. * }
  28526. *
  28527. * var object = { 'user': 'fred' };
  28528. *
  28529. * var bound = _.bind(greet, object, 'hi');
  28530. * bound('!');
  28531. * // => 'hi fred!'
  28532. *
  28533. * // Bound with placeholders.
  28534. * var bound = _.bind(greet, object, _, '!');
  28535. * bound('hi');
  28536. * // => 'hi fred!'
  28537. */
  28538. var bind = baseRest(function(func, thisArg, partials) {
  28539. var bitmask = WRAP_BIND_FLAG;
  28540. if (partials.length) {
  28541. var holders = replaceHolders(partials, getHolder(bind));
  28542. bitmask |= WRAP_PARTIAL_FLAG;
  28543. }
  28544. return createWrap(func, bitmask, thisArg, partials, holders);
  28545. });
  28546. /**
  28547. * Creates a function that invokes the method at `object[key]` with `partials`
  28548. * prepended to the arguments it receives.
  28549. *
  28550. * This method differs from `_.bind` by allowing bound functions to reference
  28551. * methods that may be redefined or don't yet exist. See
  28552. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28553. * for more details.
  28554. *
  28555. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28556. * builds, may be used as a placeholder for partially applied arguments.
  28557. *
  28558. * @static
  28559. * @memberOf _
  28560. * @since 0.10.0
  28561. * @category Function
  28562. * @param {Object} object The object to invoke the method on.
  28563. * @param {string} key The key of the method.
  28564. * @param {...*} [partials] The arguments to be partially applied.
  28565. * @returns {Function} Returns the new bound function.
  28566. * @example
  28567. *
  28568. * var object = {
  28569. * 'user': 'fred',
  28570. * 'greet': function(greeting, punctuation) {
  28571. * return greeting + ' ' + this.user + punctuation;
  28572. * }
  28573. * };
  28574. *
  28575. * var bound = _.bindKey(object, 'greet', 'hi');
  28576. * bound('!');
  28577. * // => 'hi fred!'
  28578. *
  28579. * object.greet = function(greeting, punctuation) {
  28580. * return greeting + 'ya ' + this.user + punctuation;
  28581. * };
  28582. *
  28583. * bound('!');
  28584. * // => 'hiya fred!'
  28585. *
  28586. * // Bound with placeholders.
  28587. * var bound = _.bindKey(object, 'greet', _, '!');
  28588. * bound('hi');
  28589. * // => 'hiya fred!'
  28590. */
  28591. var bindKey = baseRest(function(object, key, partials) {
  28592. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28593. if (partials.length) {
  28594. var holders = replaceHolders(partials, getHolder(bindKey));
  28595. bitmask |= WRAP_PARTIAL_FLAG;
  28596. }
  28597. return createWrap(key, bitmask, object, partials, holders);
  28598. });
  28599. /**
  28600. * Creates a function that accepts arguments of `func` and either invokes
  28601. * `func` returning its result, if at least `arity` number of arguments have
  28602. * been provided, or returns a function that accepts the remaining `func`
  28603. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28604. * is not sufficient.
  28605. *
  28606. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28607. * may be used as a placeholder for provided arguments.
  28608. *
  28609. * **Note:** This method doesn't set the "length" property of curried functions.
  28610. *
  28611. * @static
  28612. * @memberOf _
  28613. * @since 2.0.0
  28614. * @category Function
  28615. * @param {Function} func The function to curry.
  28616. * @param {number} [arity=func.length] The arity of `func`.
  28617. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28618. * @returns {Function} Returns the new curried function.
  28619. * @example
  28620. *
  28621. * var abc = function(a, b, c) {
  28622. * return [a, b, c];
  28623. * };
  28624. *
  28625. * var curried = _.curry(abc);
  28626. *
  28627. * curried(1)(2)(3);
  28628. * // => [1, 2, 3]
  28629. *
  28630. * curried(1, 2)(3);
  28631. * // => [1, 2, 3]
  28632. *
  28633. * curried(1, 2, 3);
  28634. * // => [1, 2, 3]
  28635. *
  28636. * // Curried with placeholders.
  28637. * curried(1)(_, 3)(2);
  28638. * // => [1, 2, 3]
  28639. */
  28640. function curry(func, arity, guard) {
  28641. arity = guard ? undefined : arity;
  28642. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28643. result.placeholder = curry.placeholder;
  28644. return result;
  28645. }
  28646. /**
  28647. * This method is like `_.curry` except that arguments are applied to `func`
  28648. * in the manner of `_.partialRight` instead of `_.partial`.
  28649. *
  28650. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28651. * builds, may be used as a placeholder for provided arguments.
  28652. *
  28653. * **Note:** This method doesn't set the "length" property of curried functions.
  28654. *
  28655. * @static
  28656. * @memberOf _
  28657. * @since 3.0.0
  28658. * @category Function
  28659. * @param {Function} func The function to curry.
  28660. * @param {number} [arity=func.length] The arity of `func`.
  28661. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28662. * @returns {Function} Returns the new curried function.
  28663. * @example
  28664. *
  28665. * var abc = function(a, b, c) {
  28666. * return [a, b, c];
  28667. * };
  28668. *
  28669. * var curried = _.curryRight(abc);
  28670. *
  28671. * curried(3)(2)(1);
  28672. * // => [1, 2, 3]
  28673. *
  28674. * curried(2, 3)(1);
  28675. * // => [1, 2, 3]
  28676. *
  28677. * curried(1, 2, 3);
  28678. * // => [1, 2, 3]
  28679. *
  28680. * // Curried with placeholders.
  28681. * curried(3)(1, _)(2);
  28682. * // => [1, 2, 3]
  28683. */
  28684. function curryRight(func, arity, guard) {
  28685. arity = guard ? undefined : arity;
  28686. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28687. result.placeholder = curryRight.placeholder;
  28688. return result;
  28689. }
  28690. /**
  28691. * Creates a debounced function that delays invoking `func` until after `wait`
  28692. * milliseconds have elapsed since the last time the debounced function was
  28693. * invoked. The debounced function comes with a `cancel` method to cancel
  28694. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28695. * Provide `options` to indicate whether `func` should be invoked on the
  28696. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28697. * with the last arguments provided to the debounced function. Subsequent
  28698. * calls to the debounced function return the result of the last `func`
  28699. * invocation.
  28700. *
  28701. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28702. * invoked on the trailing edge of the timeout only if the debounced function
  28703. * is invoked more than once during the `wait` timeout.
  28704. *
  28705. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28706. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28707. *
  28708. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28709. * for details over the differences between `_.debounce` and `_.throttle`.
  28710. *
  28711. * @static
  28712. * @memberOf _
  28713. * @since 0.1.0
  28714. * @category Function
  28715. * @param {Function} func The function to debounce.
  28716. * @param {number} [wait=0] The number of milliseconds to delay.
  28717. * @param {Object} [options={}] The options object.
  28718. * @param {boolean} [options.leading=false]
  28719. * Specify invoking on the leading edge of the timeout.
  28720. * @param {number} [options.maxWait]
  28721. * The maximum time `func` is allowed to be delayed before it's invoked.
  28722. * @param {boolean} [options.trailing=true]
  28723. * Specify invoking on the trailing edge of the timeout.
  28724. * @returns {Function} Returns the new debounced function.
  28725. * @example
  28726. *
  28727. * // Avoid costly calculations while the window size is in flux.
  28728. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28729. *
  28730. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28731. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28732. * 'leading': true,
  28733. * 'trailing': false
  28734. * }));
  28735. *
  28736. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28737. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28738. * var source = new EventSource('/stream');
  28739. * jQuery(source).on('message', debounced);
  28740. *
  28741. * // Cancel the trailing debounced invocation.
  28742. * jQuery(window).on('popstate', debounced.cancel);
  28743. */
  28744. function debounce(func, wait, options) {
  28745. var lastArgs,
  28746. lastThis,
  28747. maxWait,
  28748. result,
  28749. timerId,
  28750. lastCallTime,
  28751. lastInvokeTime = 0,
  28752. leading = false,
  28753. maxing = false,
  28754. trailing = true;
  28755. if (typeof func != 'function') {
  28756. throw new TypeError(FUNC_ERROR_TEXT);
  28757. }
  28758. wait = toNumber(wait) || 0;
  28759. if (isObject(options)) {
  28760. leading = !!options.leading;
  28761. maxing = 'maxWait' in options;
  28762. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28763. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28764. }
  28765. function invokeFunc(time) {
  28766. var args = lastArgs,
  28767. thisArg = lastThis;
  28768. lastArgs = lastThis = undefined;
  28769. lastInvokeTime = time;
  28770. result = func.apply(thisArg, args);
  28771. return result;
  28772. }
  28773. function leadingEdge(time) {
  28774. // Reset any `maxWait` timer.
  28775. lastInvokeTime = time;
  28776. // Start the timer for the trailing edge.
  28777. timerId = setTimeout(timerExpired, wait);
  28778. // Invoke the leading edge.
  28779. return leading ? invokeFunc(time) : result;
  28780. }
  28781. function remainingWait(time) {
  28782. var timeSinceLastCall = time - lastCallTime,
  28783. timeSinceLastInvoke = time - lastInvokeTime,
  28784. timeWaiting = wait - timeSinceLastCall;
  28785. return maxing
  28786. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28787. : timeWaiting;
  28788. }
  28789. function shouldInvoke(time) {
  28790. var timeSinceLastCall = time - lastCallTime,
  28791. timeSinceLastInvoke = time - lastInvokeTime;
  28792. // Either this is the first call, activity has stopped and we're at the
  28793. // trailing edge, the system time has gone backwards and we're treating
  28794. // it as the trailing edge, or we've hit the `maxWait` limit.
  28795. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28796. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28797. }
  28798. function timerExpired() {
  28799. var time = now();
  28800. if (shouldInvoke(time)) {
  28801. return trailingEdge(time);
  28802. }
  28803. // Restart the timer.
  28804. timerId = setTimeout(timerExpired, remainingWait(time));
  28805. }
  28806. function trailingEdge(time) {
  28807. timerId = undefined;
  28808. // Only invoke if we have `lastArgs` which means `func` has been
  28809. // debounced at least once.
  28810. if (trailing && lastArgs) {
  28811. return invokeFunc(time);
  28812. }
  28813. lastArgs = lastThis = undefined;
  28814. return result;
  28815. }
  28816. function cancel() {
  28817. if (timerId !== undefined) {
  28818. clearTimeout(timerId);
  28819. }
  28820. lastInvokeTime = 0;
  28821. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28822. }
  28823. function flush() {
  28824. return timerId === undefined ? result : trailingEdge(now());
  28825. }
  28826. function debounced() {
  28827. var time = now(),
  28828. isInvoking = shouldInvoke(time);
  28829. lastArgs = arguments;
  28830. lastThis = this;
  28831. lastCallTime = time;
  28832. if (isInvoking) {
  28833. if (timerId === undefined) {
  28834. return leadingEdge(lastCallTime);
  28835. }
  28836. if (maxing) {
  28837. // Handle invocations in a tight loop.
  28838. clearTimeout(timerId);
  28839. timerId = setTimeout(timerExpired, wait);
  28840. return invokeFunc(lastCallTime);
  28841. }
  28842. }
  28843. if (timerId === undefined) {
  28844. timerId = setTimeout(timerExpired, wait);
  28845. }
  28846. return result;
  28847. }
  28848. debounced.cancel = cancel;
  28849. debounced.flush = flush;
  28850. return debounced;
  28851. }
  28852. /**
  28853. * Defers invoking the `func` until the current call stack has cleared. Any
  28854. * additional arguments are provided to `func` when it's invoked.
  28855. *
  28856. * @static
  28857. * @memberOf _
  28858. * @since 0.1.0
  28859. * @category Function
  28860. * @param {Function} func The function to defer.
  28861. * @param {...*} [args] The arguments to invoke `func` with.
  28862. * @returns {number} Returns the timer id.
  28863. * @example
  28864. *
  28865. * _.defer(function(text) {
  28866. * console.log(text);
  28867. * }, 'deferred');
  28868. * // => Logs 'deferred' after one millisecond.
  28869. */
  28870. var defer = baseRest(function(func, args) {
  28871. return baseDelay(func, 1, args);
  28872. });
  28873. /**
  28874. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28875. * provided to `func` when it's invoked.
  28876. *
  28877. * @static
  28878. * @memberOf _
  28879. * @since 0.1.0
  28880. * @category Function
  28881. * @param {Function} func The function to delay.
  28882. * @param {number} wait The number of milliseconds to delay invocation.
  28883. * @param {...*} [args] The arguments to invoke `func` with.
  28884. * @returns {number} Returns the timer id.
  28885. * @example
  28886. *
  28887. * _.delay(function(text) {
  28888. * console.log(text);
  28889. * }, 1000, 'later');
  28890. * // => Logs 'later' after one second.
  28891. */
  28892. var delay = baseRest(function(func, wait, args) {
  28893. return baseDelay(func, toNumber(wait) || 0, args);
  28894. });
  28895. /**
  28896. * Creates a function that invokes `func` with arguments reversed.
  28897. *
  28898. * @static
  28899. * @memberOf _
  28900. * @since 4.0.0
  28901. * @category Function
  28902. * @param {Function} func The function to flip arguments for.
  28903. * @returns {Function} Returns the new flipped function.
  28904. * @example
  28905. *
  28906. * var flipped = _.flip(function() {
  28907. * return _.toArray(arguments);
  28908. * });
  28909. *
  28910. * flipped('a', 'b', 'c', 'd');
  28911. * // => ['d', 'c', 'b', 'a']
  28912. */
  28913. function flip(func) {
  28914. return createWrap(func, WRAP_FLIP_FLAG);
  28915. }
  28916. /**
  28917. * Creates a function that memoizes the result of `func`. If `resolver` is
  28918. * provided, it determines the cache key for storing the result based on the
  28919. * arguments provided to the memoized function. By default, the first argument
  28920. * provided to the memoized function is used as the map cache key. The `func`
  28921. * is invoked with the `this` binding of the memoized function.
  28922. *
  28923. * **Note:** The cache is exposed as the `cache` property on the memoized
  28924. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28925. * constructor with one whose instances implement the
  28926. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28927. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28928. *
  28929. * @static
  28930. * @memberOf _
  28931. * @since 0.1.0
  28932. * @category Function
  28933. * @param {Function} func The function to have its output memoized.
  28934. * @param {Function} [resolver] The function to resolve the cache key.
  28935. * @returns {Function} Returns the new memoized function.
  28936. * @example
  28937. *
  28938. * var object = { 'a': 1, 'b': 2 };
  28939. * var other = { 'c': 3, 'd': 4 };
  28940. *
  28941. * var values = _.memoize(_.values);
  28942. * values(object);
  28943. * // => [1, 2]
  28944. *
  28945. * values(other);
  28946. * // => [3, 4]
  28947. *
  28948. * object.a = 2;
  28949. * values(object);
  28950. * // => [1, 2]
  28951. *
  28952. * // Modify the result cache.
  28953. * values.cache.set(object, ['a', 'b']);
  28954. * values(object);
  28955. * // => ['a', 'b']
  28956. *
  28957. * // Replace `_.memoize.Cache`.
  28958. * _.memoize.Cache = WeakMap;
  28959. */
  28960. function memoize(func, resolver) {
  28961. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28962. throw new TypeError(FUNC_ERROR_TEXT);
  28963. }
  28964. var memoized = function() {
  28965. var args = arguments,
  28966. key = resolver ? resolver.apply(this, args) : args[0],
  28967. cache = memoized.cache;
  28968. if (cache.has(key)) {
  28969. return cache.get(key);
  28970. }
  28971. var result = func.apply(this, args);
  28972. memoized.cache = cache.set(key, result) || cache;
  28973. return result;
  28974. };
  28975. memoized.cache = new (memoize.Cache || MapCache);
  28976. return memoized;
  28977. }
  28978. // Expose `MapCache`.
  28979. memoize.Cache = MapCache;
  28980. /**
  28981. * Creates a function that negates the result of the predicate `func`. The
  28982. * `func` predicate is invoked with the `this` binding and arguments of the
  28983. * created function.
  28984. *
  28985. * @static
  28986. * @memberOf _
  28987. * @since 3.0.0
  28988. * @category Function
  28989. * @param {Function} predicate The predicate to negate.
  28990. * @returns {Function} Returns the new negated function.
  28991. * @example
  28992. *
  28993. * function isEven(n) {
  28994. * return n % 2 == 0;
  28995. * }
  28996. *
  28997. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28998. * // => [1, 3, 5]
  28999. */
  29000. function negate(predicate) {
  29001. if (typeof predicate != 'function') {
  29002. throw new TypeError(FUNC_ERROR_TEXT);
  29003. }
  29004. return function() {
  29005. var args = arguments;
  29006. switch (args.length) {
  29007. case 0: return !predicate.call(this);
  29008. case 1: return !predicate.call(this, args[0]);
  29009. case 2: return !predicate.call(this, args[0], args[1]);
  29010. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  29011. }
  29012. return !predicate.apply(this, args);
  29013. };
  29014. }
  29015. /**
  29016. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29017. * to the function return the value of the first invocation. The `func` is
  29018. * invoked with the `this` binding and arguments of the created function.
  29019. *
  29020. * @static
  29021. * @memberOf _
  29022. * @since 0.1.0
  29023. * @category Function
  29024. * @param {Function} func The function to restrict.
  29025. * @returns {Function} Returns the new restricted function.
  29026. * @example
  29027. *
  29028. * var initialize = _.once(createApplication);
  29029. * initialize();
  29030. * initialize();
  29031. * // => `createApplication` is invoked once
  29032. */
  29033. function once(func) {
  29034. return before(2, func);
  29035. }
  29036. /**
  29037. * Creates a function that invokes `func` with its arguments transformed.
  29038. *
  29039. * @static
  29040. * @since 4.0.0
  29041. * @memberOf _
  29042. * @category Function
  29043. * @param {Function} func The function to wrap.
  29044. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29045. * The argument transforms.
  29046. * @returns {Function} Returns the new function.
  29047. * @example
  29048. *
  29049. * function doubled(n) {
  29050. * return n * 2;
  29051. * }
  29052. *
  29053. * function square(n) {
  29054. * return n * n;
  29055. * }
  29056. *
  29057. * var func = _.overArgs(function(x, y) {
  29058. * return [x, y];
  29059. * }, [square, doubled]);
  29060. *
  29061. * func(9, 3);
  29062. * // => [81, 6]
  29063. *
  29064. * func(10, 5);
  29065. * // => [100, 10]
  29066. */
  29067. var overArgs = castRest(function(func, transforms) {
  29068. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29069. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29070. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29071. var funcsLength = transforms.length;
  29072. return baseRest(function(args) {
  29073. var index = -1,
  29074. length = nativeMin(args.length, funcsLength);
  29075. while (++index < length) {
  29076. args[index] = transforms[index].call(this, args[index]);
  29077. }
  29078. return apply(func, this, args);
  29079. });
  29080. });
  29081. /**
  29082. * Creates a function that invokes `func` with `partials` prepended to the
  29083. * arguments it receives. This method is like `_.bind` except it does **not**
  29084. * alter the `this` binding.
  29085. *
  29086. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29087. * builds, may be used as a placeholder for partially applied arguments.
  29088. *
  29089. * **Note:** This method doesn't set the "length" property of partially
  29090. * applied functions.
  29091. *
  29092. * @static
  29093. * @memberOf _
  29094. * @since 0.2.0
  29095. * @category Function
  29096. * @param {Function} func The function to partially apply arguments to.
  29097. * @param {...*} [partials] The arguments to be partially applied.
  29098. * @returns {Function} Returns the new partially applied function.
  29099. * @example
  29100. *
  29101. * function greet(greeting, name) {
  29102. * return greeting + ' ' + name;
  29103. * }
  29104. *
  29105. * var sayHelloTo = _.partial(greet, 'hello');
  29106. * sayHelloTo('fred');
  29107. * // => 'hello fred'
  29108. *
  29109. * // Partially applied with placeholders.
  29110. * var greetFred = _.partial(greet, _, 'fred');
  29111. * greetFred('hi');
  29112. * // => 'hi fred'
  29113. */
  29114. var partial = baseRest(function(func, partials) {
  29115. var holders = replaceHolders(partials, getHolder(partial));
  29116. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29117. });
  29118. /**
  29119. * This method is like `_.partial` except that partially applied arguments
  29120. * are appended to the arguments it receives.
  29121. *
  29122. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29123. * builds, may be used as a placeholder for partially applied arguments.
  29124. *
  29125. * **Note:** This method doesn't set the "length" property of partially
  29126. * applied functions.
  29127. *
  29128. * @static
  29129. * @memberOf _
  29130. * @since 1.0.0
  29131. * @category Function
  29132. * @param {Function} func The function to partially apply arguments to.
  29133. * @param {...*} [partials] The arguments to be partially applied.
  29134. * @returns {Function} Returns the new partially applied function.
  29135. * @example
  29136. *
  29137. * function greet(greeting, name) {
  29138. * return greeting + ' ' + name;
  29139. * }
  29140. *
  29141. * var greetFred = _.partialRight(greet, 'fred');
  29142. * greetFred('hi');
  29143. * // => 'hi fred'
  29144. *
  29145. * // Partially applied with placeholders.
  29146. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29147. * sayHelloTo('fred');
  29148. * // => 'hello fred'
  29149. */
  29150. var partialRight = baseRest(function(func, partials) {
  29151. var holders = replaceHolders(partials, getHolder(partialRight));
  29152. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29153. });
  29154. /**
  29155. * Creates a function that invokes `func` with arguments arranged according
  29156. * to the specified `indexes` where the argument value at the first index is
  29157. * provided as the first argument, the argument value at the second index is
  29158. * provided as the second argument, and so on.
  29159. *
  29160. * @static
  29161. * @memberOf _
  29162. * @since 3.0.0
  29163. * @category Function
  29164. * @param {Function} func The function to rearrange arguments for.
  29165. * @param {...(number|number[])} indexes The arranged argument indexes.
  29166. * @returns {Function} Returns the new function.
  29167. * @example
  29168. *
  29169. * var rearged = _.rearg(function(a, b, c) {
  29170. * return [a, b, c];
  29171. * }, [2, 0, 1]);
  29172. *
  29173. * rearged('b', 'c', 'a')
  29174. * // => ['a', 'b', 'c']
  29175. */
  29176. var rearg = flatRest(function(func, indexes) {
  29177. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29178. });
  29179. /**
  29180. * Creates a function that invokes `func` with the `this` binding of the
  29181. * created function and arguments from `start` and beyond provided as
  29182. * an array.
  29183. *
  29184. * **Note:** This method is based on the
  29185. * [rest parameter](https://mdn.io/rest_parameters).
  29186. *
  29187. * @static
  29188. * @memberOf _
  29189. * @since 4.0.0
  29190. * @category Function
  29191. * @param {Function} func The function to apply a rest parameter to.
  29192. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29193. * @returns {Function} Returns the new function.
  29194. * @example
  29195. *
  29196. * var say = _.rest(function(what, names) {
  29197. * return what + ' ' + _.initial(names).join(', ') +
  29198. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29199. * });
  29200. *
  29201. * say('hello', 'fred', 'barney', 'pebbles');
  29202. * // => 'hello fred, barney, & pebbles'
  29203. */
  29204. function rest(func, start) {
  29205. if (typeof func != 'function') {
  29206. throw new TypeError(FUNC_ERROR_TEXT);
  29207. }
  29208. start = start === undefined ? start : toInteger(start);
  29209. return baseRest(func, start);
  29210. }
  29211. /**
  29212. * Creates a function that invokes `func` with the `this` binding of the
  29213. * create function and an array of arguments much like
  29214. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29215. *
  29216. * **Note:** This method is based on the
  29217. * [spread operator](https://mdn.io/spread_operator).
  29218. *
  29219. * @static
  29220. * @memberOf _
  29221. * @since 3.2.0
  29222. * @category Function
  29223. * @param {Function} func The function to spread arguments over.
  29224. * @param {number} [start=0] The start position of the spread.
  29225. * @returns {Function} Returns the new function.
  29226. * @example
  29227. *
  29228. * var say = _.spread(function(who, what) {
  29229. * return who + ' says ' + what;
  29230. * });
  29231. *
  29232. * say(['fred', 'hello']);
  29233. * // => 'fred says hello'
  29234. *
  29235. * var numbers = Promise.all([
  29236. * Promise.resolve(40),
  29237. * Promise.resolve(36)
  29238. * ]);
  29239. *
  29240. * numbers.then(_.spread(function(x, y) {
  29241. * return x + y;
  29242. * }));
  29243. * // => a Promise of 76
  29244. */
  29245. function spread(func, start) {
  29246. if (typeof func != 'function') {
  29247. throw new TypeError(FUNC_ERROR_TEXT);
  29248. }
  29249. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29250. return baseRest(function(args) {
  29251. var array = args[start],
  29252. otherArgs = castSlice(args, 0, start);
  29253. if (array) {
  29254. arrayPush(otherArgs, array);
  29255. }
  29256. return apply(func, this, otherArgs);
  29257. });
  29258. }
  29259. /**
  29260. * Creates a throttled function that only invokes `func` at most once per
  29261. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29262. * method to cancel delayed `func` invocations and a `flush` method to
  29263. * immediately invoke them. Provide `options` to indicate whether `func`
  29264. * should be invoked on the leading and/or trailing edge of the `wait`
  29265. * timeout. The `func` is invoked with the last arguments provided to the
  29266. * throttled function. Subsequent calls to the throttled function return the
  29267. * result of the last `func` invocation.
  29268. *
  29269. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29270. * invoked on the trailing edge of the timeout only if the throttled function
  29271. * is invoked more than once during the `wait` timeout.
  29272. *
  29273. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29274. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29275. *
  29276. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29277. * for details over the differences between `_.throttle` and `_.debounce`.
  29278. *
  29279. * @static
  29280. * @memberOf _
  29281. * @since 0.1.0
  29282. * @category Function
  29283. * @param {Function} func The function to throttle.
  29284. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29285. * @param {Object} [options={}] The options object.
  29286. * @param {boolean} [options.leading=true]
  29287. * Specify invoking on the leading edge of the timeout.
  29288. * @param {boolean} [options.trailing=true]
  29289. * Specify invoking on the trailing edge of the timeout.
  29290. * @returns {Function} Returns the new throttled function.
  29291. * @example
  29292. *
  29293. * // Avoid excessively updating the position while scrolling.
  29294. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29295. *
  29296. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29297. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29298. * jQuery(element).on('click', throttled);
  29299. *
  29300. * // Cancel the trailing throttled invocation.
  29301. * jQuery(window).on('popstate', throttled.cancel);
  29302. */
  29303. function throttle(func, wait, options) {
  29304. var leading = true,
  29305. trailing = true;
  29306. if (typeof func != 'function') {
  29307. throw new TypeError(FUNC_ERROR_TEXT);
  29308. }
  29309. if (isObject(options)) {
  29310. leading = 'leading' in options ? !!options.leading : leading;
  29311. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29312. }
  29313. return debounce(func, wait, {
  29314. 'leading': leading,
  29315. 'maxWait': wait,
  29316. 'trailing': trailing
  29317. });
  29318. }
  29319. /**
  29320. * Creates a function that accepts up to one argument, ignoring any
  29321. * additional arguments.
  29322. *
  29323. * @static
  29324. * @memberOf _
  29325. * @since 4.0.0
  29326. * @category Function
  29327. * @param {Function} func The function to cap arguments for.
  29328. * @returns {Function} Returns the new capped function.
  29329. * @example
  29330. *
  29331. * _.map(['6', '8', '10'], _.unary(parseInt));
  29332. * // => [6, 8, 10]
  29333. */
  29334. function unary(func) {
  29335. return ary(func, 1);
  29336. }
  29337. /**
  29338. * Creates a function that provides `value` to `wrapper` as its first
  29339. * argument. Any additional arguments provided to the function are appended
  29340. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29341. * binding of the created function.
  29342. *
  29343. * @static
  29344. * @memberOf _
  29345. * @since 0.1.0
  29346. * @category Function
  29347. * @param {*} value The value to wrap.
  29348. * @param {Function} [wrapper=identity] The wrapper function.
  29349. * @returns {Function} Returns the new function.
  29350. * @example
  29351. *
  29352. * var p = _.wrap(_.escape, function(func, text) {
  29353. * return '<p>' + func(text) + '</p>';
  29354. * });
  29355. *
  29356. * p('fred, barney, & pebbles');
  29357. * // => '<p>fred, barney, &amp; pebbles</p>'
  29358. */
  29359. function wrap(value, wrapper) {
  29360. return partial(castFunction(wrapper), value);
  29361. }
  29362. /*------------------------------------------------------------------------*/
  29363. /**
  29364. * Casts `value` as an array if it's not one.
  29365. *
  29366. * @static
  29367. * @memberOf _
  29368. * @since 4.4.0
  29369. * @category Lang
  29370. * @param {*} value The value to inspect.
  29371. * @returns {Array} Returns the cast array.
  29372. * @example
  29373. *
  29374. * _.castArray(1);
  29375. * // => [1]
  29376. *
  29377. * _.castArray({ 'a': 1 });
  29378. * // => [{ 'a': 1 }]
  29379. *
  29380. * _.castArray('abc');
  29381. * // => ['abc']
  29382. *
  29383. * _.castArray(null);
  29384. * // => [null]
  29385. *
  29386. * _.castArray(undefined);
  29387. * // => [undefined]
  29388. *
  29389. * _.castArray();
  29390. * // => []
  29391. *
  29392. * var array = [1, 2, 3];
  29393. * console.log(_.castArray(array) === array);
  29394. * // => true
  29395. */
  29396. function castArray() {
  29397. if (!arguments.length) {
  29398. return [];
  29399. }
  29400. var value = arguments[0];
  29401. return isArray(value) ? value : [value];
  29402. }
  29403. /**
  29404. * Creates a shallow clone of `value`.
  29405. *
  29406. * **Note:** This method is loosely based on the
  29407. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29408. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29409. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29410. * arrays. The own enumerable properties of `arguments` objects are cloned
  29411. * as plain objects. An empty object is returned for uncloneable values such
  29412. * as error objects, functions, DOM nodes, and WeakMaps.
  29413. *
  29414. * @static
  29415. * @memberOf _
  29416. * @since 0.1.0
  29417. * @category Lang
  29418. * @param {*} value The value to clone.
  29419. * @returns {*} Returns the cloned value.
  29420. * @see _.cloneDeep
  29421. * @example
  29422. *
  29423. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29424. *
  29425. * var shallow = _.clone(objects);
  29426. * console.log(shallow[0] === objects[0]);
  29427. * // => true
  29428. */
  29429. function clone(value) {
  29430. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29431. }
  29432. /**
  29433. * This method is like `_.clone` except that it accepts `customizer` which
  29434. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29435. * cloning is handled by the method instead. The `customizer` is invoked with
  29436. * up to four arguments; (value [, index|key, object, stack]).
  29437. *
  29438. * @static
  29439. * @memberOf _
  29440. * @since 4.0.0
  29441. * @category Lang
  29442. * @param {*} value The value to clone.
  29443. * @param {Function} [customizer] The function to customize cloning.
  29444. * @returns {*} Returns the cloned value.
  29445. * @see _.cloneDeepWith
  29446. * @example
  29447. *
  29448. * function customizer(value) {
  29449. * if (_.isElement(value)) {
  29450. * return value.cloneNode(false);
  29451. * }
  29452. * }
  29453. *
  29454. * var el = _.cloneWith(document.body, customizer);
  29455. *
  29456. * console.log(el === document.body);
  29457. * // => false
  29458. * console.log(el.nodeName);
  29459. * // => 'BODY'
  29460. * console.log(el.childNodes.length);
  29461. * // => 0
  29462. */
  29463. function cloneWith(value, customizer) {
  29464. customizer = typeof customizer == 'function' ? customizer : undefined;
  29465. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29466. }
  29467. /**
  29468. * This method is like `_.clone` except that it recursively clones `value`.
  29469. *
  29470. * @static
  29471. * @memberOf _
  29472. * @since 1.0.0
  29473. * @category Lang
  29474. * @param {*} value The value to recursively clone.
  29475. * @returns {*} Returns the deep cloned value.
  29476. * @see _.clone
  29477. * @example
  29478. *
  29479. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29480. *
  29481. * var deep = _.cloneDeep(objects);
  29482. * console.log(deep[0] === objects[0]);
  29483. * // => false
  29484. */
  29485. function cloneDeep(value) {
  29486. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29487. }
  29488. /**
  29489. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29490. *
  29491. * @static
  29492. * @memberOf _
  29493. * @since 4.0.0
  29494. * @category Lang
  29495. * @param {*} value The value to recursively clone.
  29496. * @param {Function} [customizer] The function to customize cloning.
  29497. * @returns {*} Returns the deep cloned value.
  29498. * @see _.cloneWith
  29499. * @example
  29500. *
  29501. * function customizer(value) {
  29502. * if (_.isElement(value)) {
  29503. * return value.cloneNode(true);
  29504. * }
  29505. * }
  29506. *
  29507. * var el = _.cloneDeepWith(document.body, customizer);
  29508. *
  29509. * console.log(el === document.body);
  29510. * // => false
  29511. * console.log(el.nodeName);
  29512. * // => 'BODY'
  29513. * console.log(el.childNodes.length);
  29514. * // => 20
  29515. */
  29516. function cloneDeepWith(value, customizer) {
  29517. customizer = typeof customizer == 'function' ? customizer : undefined;
  29518. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29519. }
  29520. /**
  29521. * Checks if `object` conforms to `source` by invoking the predicate
  29522. * properties of `source` with the corresponding property values of `object`.
  29523. *
  29524. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29525. * partially applied.
  29526. *
  29527. * @static
  29528. * @memberOf _
  29529. * @since 4.14.0
  29530. * @category Lang
  29531. * @param {Object} object The object to inspect.
  29532. * @param {Object} source The object of property predicates to conform to.
  29533. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29534. * @example
  29535. *
  29536. * var object = { 'a': 1, 'b': 2 };
  29537. *
  29538. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29539. * // => true
  29540. *
  29541. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29542. * // => false
  29543. */
  29544. function conformsTo(object, source) {
  29545. return source == null || baseConformsTo(object, source, keys(source));
  29546. }
  29547. /**
  29548. * Performs a
  29549. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29550. * comparison between two values to determine if they are equivalent.
  29551. *
  29552. * @static
  29553. * @memberOf _
  29554. * @since 4.0.0
  29555. * @category Lang
  29556. * @param {*} value The value to compare.
  29557. * @param {*} other The other value to compare.
  29558. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29559. * @example
  29560. *
  29561. * var object = { 'a': 1 };
  29562. * var other = { 'a': 1 };
  29563. *
  29564. * _.eq(object, object);
  29565. * // => true
  29566. *
  29567. * _.eq(object, other);
  29568. * // => false
  29569. *
  29570. * _.eq('a', 'a');
  29571. * // => true
  29572. *
  29573. * _.eq('a', Object('a'));
  29574. * // => false
  29575. *
  29576. * _.eq(NaN, NaN);
  29577. * // => true
  29578. */
  29579. function eq(value, other) {
  29580. return value === other || (value !== value && other !== other);
  29581. }
  29582. /**
  29583. * Checks if `value` is greater than `other`.
  29584. *
  29585. * @static
  29586. * @memberOf _
  29587. * @since 3.9.0
  29588. * @category Lang
  29589. * @param {*} value The value to compare.
  29590. * @param {*} other The other value to compare.
  29591. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29592. * else `false`.
  29593. * @see _.lt
  29594. * @example
  29595. *
  29596. * _.gt(3, 1);
  29597. * // => true
  29598. *
  29599. * _.gt(3, 3);
  29600. * // => false
  29601. *
  29602. * _.gt(1, 3);
  29603. * // => false
  29604. */
  29605. var gt = createRelationalOperation(baseGt);
  29606. /**
  29607. * Checks if `value` is greater than or equal to `other`.
  29608. *
  29609. * @static
  29610. * @memberOf _
  29611. * @since 3.9.0
  29612. * @category Lang
  29613. * @param {*} value The value to compare.
  29614. * @param {*} other The other value to compare.
  29615. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29616. * `other`, else `false`.
  29617. * @see _.lte
  29618. * @example
  29619. *
  29620. * _.gte(3, 1);
  29621. * // => true
  29622. *
  29623. * _.gte(3, 3);
  29624. * // => true
  29625. *
  29626. * _.gte(1, 3);
  29627. * // => false
  29628. */
  29629. var gte = createRelationalOperation(function(value, other) {
  29630. return value >= other;
  29631. });
  29632. /**
  29633. * Checks if `value` is likely an `arguments` object.
  29634. *
  29635. * @static
  29636. * @memberOf _
  29637. * @since 0.1.0
  29638. * @category Lang
  29639. * @param {*} value The value to check.
  29640. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29641. * else `false`.
  29642. * @example
  29643. *
  29644. * _.isArguments(function() { return arguments; }());
  29645. * // => true
  29646. *
  29647. * _.isArguments([1, 2, 3]);
  29648. * // => false
  29649. */
  29650. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29651. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29652. !propertyIsEnumerable.call(value, 'callee');
  29653. };
  29654. /**
  29655. * Checks if `value` is classified as an `Array` object.
  29656. *
  29657. * @static
  29658. * @memberOf _
  29659. * @since 0.1.0
  29660. * @category Lang
  29661. * @param {*} value The value to check.
  29662. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29663. * @example
  29664. *
  29665. * _.isArray([1, 2, 3]);
  29666. * // => true
  29667. *
  29668. * _.isArray(document.body.children);
  29669. * // => false
  29670. *
  29671. * _.isArray('abc');
  29672. * // => false
  29673. *
  29674. * _.isArray(_.noop);
  29675. * // => false
  29676. */
  29677. var isArray = Array.isArray;
  29678. /**
  29679. * Checks if `value` is classified as an `ArrayBuffer` object.
  29680. *
  29681. * @static
  29682. * @memberOf _
  29683. * @since 4.3.0
  29684. * @category Lang
  29685. * @param {*} value The value to check.
  29686. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29687. * @example
  29688. *
  29689. * _.isArrayBuffer(new ArrayBuffer(2));
  29690. * // => true
  29691. *
  29692. * _.isArrayBuffer(new Array(2));
  29693. * // => false
  29694. */
  29695. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29696. /**
  29697. * Checks if `value` is array-like. A value is considered array-like if it's
  29698. * not a function and has a `value.length` that's an integer greater than or
  29699. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29700. *
  29701. * @static
  29702. * @memberOf _
  29703. * @since 4.0.0
  29704. * @category Lang
  29705. * @param {*} value The value to check.
  29706. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29707. * @example
  29708. *
  29709. * _.isArrayLike([1, 2, 3]);
  29710. * // => true
  29711. *
  29712. * _.isArrayLike(document.body.children);
  29713. * // => true
  29714. *
  29715. * _.isArrayLike('abc');
  29716. * // => true
  29717. *
  29718. * _.isArrayLike(_.noop);
  29719. * // => false
  29720. */
  29721. function isArrayLike(value) {
  29722. return value != null && isLength(value.length) && !isFunction(value);
  29723. }
  29724. /**
  29725. * This method is like `_.isArrayLike` except that it also checks if `value`
  29726. * is an object.
  29727. *
  29728. * @static
  29729. * @memberOf _
  29730. * @since 4.0.0
  29731. * @category Lang
  29732. * @param {*} value The value to check.
  29733. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29734. * else `false`.
  29735. * @example
  29736. *
  29737. * _.isArrayLikeObject([1, 2, 3]);
  29738. * // => true
  29739. *
  29740. * _.isArrayLikeObject(document.body.children);
  29741. * // => true
  29742. *
  29743. * _.isArrayLikeObject('abc');
  29744. * // => false
  29745. *
  29746. * _.isArrayLikeObject(_.noop);
  29747. * // => false
  29748. */
  29749. function isArrayLikeObject(value) {
  29750. return isObjectLike(value) && isArrayLike(value);
  29751. }
  29752. /**
  29753. * Checks if `value` is classified as a boolean primitive or object.
  29754. *
  29755. * @static
  29756. * @memberOf _
  29757. * @since 0.1.0
  29758. * @category Lang
  29759. * @param {*} value The value to check.
  29760. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29761. * @example
  29762. *
  29763. * _.isBoolean(false);
  29764. * // => true
  29765. *
  29766. * _.isBoolean(null);
  29767. * // => false
  29768. */
  29769. function isBoolean(value) {
  29770. return value === true || value === false ||
  29771. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29772. }
  29773. /**
  29774. * Checks if `value` is a buffer.
  29775. *
  29776. * @static
  29777. * @memberOf _
  29778. * @since 4.3.0
  29779. * @category Lang
  29780. * @param {*} value The value to check.
  29781. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29782. * @example
  29783. *
  29784. * _.isBuffer(new Buffer(2));
  29785. * // => true
  29786. *
  29787. * _.isBuffer(new Uint8Array(2));
  29788. * // => false
  29789. */
  29790. var isBuffer = nativeIsBuffer || stubFalse;
  29791. /**
  29792. * Checks if `value` is classified as a `Date` object.
  29793. *
  29794. * @static
  29795. * @memberOf _
  29796. * @since 0.1.0
  29797. * @category Lang
  29798. * @param {*} value The value to check.
  29799. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29800. * @example
  29801. *
  29802. * _.isDate(new Date);
  29803. * // => true
  29804. *
  29805. * _.isDate('Mon April 23 2012');
  29806. * // => false
  29807. */
  29808. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29809. /**
  29810. * Checks if `value` is likely a DOM element.
  29811. *
  29812. * @static
  29813. * @memberOf _
  29814. * @since 0.1.0
  29815. * @category Lang
  29816. * @param {*} value The value to check.
  29817. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29818. * @example
  29819. *
  29820. * _.isElement(document.body);
  29821. * // => true
  29822. *
  29823. * _.isElement('<body>');
  29824. * // => false
  29825. */
  29826. function isElement(value) {
  29827. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29828. }
  29829. /**
  29830. * Checks if `value` is an empty object, collection, map, or set.
  29831. *
  29832. * Objects are considered empty if they have no own enumerable string keyed
  29833. * properties.
  29834. *
  29835. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29836. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29837. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29838. *
  29839. * @static
  29840. * @memberOf _
  29841. * @since 0.1.0
  29842. * @category Lang
  29843. * @param {*} value The value to check.
  29844. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29845. * @example
  29846. *
  29847. * _.isEmpty(null);
  29848. * // => true
  29849. *
  29850. * _.isEmpty(true);
  29851. * // => true
  29852. *
  29853. * _.isEmpty(1);
  29854. * // => true
  29855. *
  29856. * _.isEmpty([1, 2, 3]);
  29857. * // => false
  29858. *
  29859. * _.isEmpty({ 'a': 1 });
  29860. * // => false
  29861. */
  29862. function isEmpty(value) {
  29863. if (value == null) {
  29864. return true;
  29865. }
  29866. if (isArrayLike(value) &&
  29867. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29868. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29869. return !value.length;
  29870. }
  29871. var tag = getTag(value);
  29872. if (tag == mapTag || tag == setTag) {
  29873. return !value.size;
  29874. }
  29875. if (isPrototype(value)) {
  29876. return !baseKeys(value).length;
  29877. }
  29878. for (var key in value) {
  29879. if (hasOwnProperty.call(value, key)) {
  29880. return false;
  29881. }
  29882. }
  29883. return true;
  29884. }
  29885. /**
  29886. * Performs a deep comparison between two values to determine if they are
  29887. * equivalent.
  29888. *
  29889. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29890. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29891. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29892. * by their own, not inherited, enumerable properties. Functions and DOM
  29893. * nodes are compared by strict equality, i.e. `===`.
  29894. *
  29895. * @static
  29896. * @memberOf _
  29897. * @since 0.1.0
  29898. * @category Lang
  29899. * @param {*} value The value to compare.
  29900. * @param {*} other The other value to compare.
  29901. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29902. * @example
  29903. *
  29904. * var object = { 'a': 1 };
  29905. * var other = { 'a': 1 };
  29906. *
  29907. * _.isEqual(object, other);
  29908. * // => true
  29909. *
  29910. * object === other;
  29911. * // => false
  29912. */
  29913. function isEqual(value, other) {
  29914. return baseIsEqual(value, other);
  29915. }
  29916. /**
  29917. * This method is like `_.isEqual` except that it accepts `customizer` which
  29918. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29919. * are handled by the method instead. The `customizer` is invoked with up to
  29920. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29921. *
  29922. * @static
  29923. * @memberOf _
  29924. * @since 4.0.0
  29925. * @category Lang
  29926. * @param {*} value The value to compare.
  29927. * @param {*} other The other value to compare.
  29928. * @param {Function} [customizer] The function to customize comparisons.
  29929. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29930. * @example
  29931. *
  29932. * function isGreeting(value) {
  29933. * return /^h(?:i|ello)$/.test(value);
  29934. * }
  29935. *
  29936. * function customizer(objValue, othValue) {
  29937. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29938. * return true;
  29939. * }
  29940. * }
  29941. *
  29942. * var array = ['hello', 'goodbye'];
  29943. * var other = ['hi', 'goodbye'];
  29944. *
  29945. * _.isEqualWith(array, other, customizer);
  29946. * // => true
  29947. */
  29948. function isEqualWith(value, other, customizer) {
  29949. customizer = typeof customizer == 'function' ? customizer : undefined;
  29950. var result = customizer ? customizer(value, other) : undefined;
  29951. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29952. }
  29953. /**
  29954. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29955. * `SyntaxError`, `TypeError`, or `URIError` object.
  29956. *
  29957. * @static
  29958. * @memberOf _
  29959. * @since 3.0.0
  29960. * @category Lang
  29961. * @param {*} value The value to check.
  29962. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29963. * @example
  29964. *
  29965. * _.isError(new Error);
  29966. * // => true
  29967. *
  29968. * _.isError(Error);
  29969. * // => false
  29970. */
  29971. function isError(value) {
  29972. if (!isObjectLike(value)) {
  29973. return false;
  29974. }
  29975. var tag = baseGetTag(value);
  29976. return tag == errorTag || tag == domExcTag ||
  29977. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29978. }
  29979. /**
  29980. * Checks if `value` is a finite primitive number.
  29981. *
  29982. * **Note:** This method is based on
  29983. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29984. *
  29985. * @static
  29986. * @memberOf _
  29987. * @since 0.1.0
  29988. * @category Lang
  29989. * @param {*} value The value to check.
  29990. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29991. * @example
  29992. *
  29993. * _.isFinite(3);
  29994. * // => true
  29995. *
  29996. * _.isFinite(Number.MIN_VALUE);
  29997. * // => true
  29998. *
  29999. * _.isFinite(Infinity);
  30000. * // => false
  30001. *
  30002. * _.isFinite('3');
  30003. * // => false
  30004. */
  30005. function isFinite(value) {
  30006. return typeof value == 'number' && nativeIsFinite(value);
  30007. }
  30008. /**
  30009. * Checks if `value` is classified as a `Function` object.
  30010. *
  30011. * @static
  30012. * @memberOf _
  30013. * @since 0.1.0
  30014. * @category Lang
  30015. * @param {*} value The value to check.
  30016. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30017. * @example
  30018. *
  30019. * _.isFunction(_);
  30020. * // => true
  30021. *
  30022. * _.isFunction(/abc/);
  30023. * // => false
  30024. */
  30025. function isFunction(value) {
  30026. if (!isObject(value)) {
  30027. return false;
  30028. }
  30029. // The use of `Object#toString` avoids issues with the `typeof` operator
  30030. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30031. var tag = baseGetTag(value);
  30032. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30033. }
  30034. /**
  30035. * Checks if `value` is an integer.
  30036. *
  30037. * **Note:** This method is based on
  30038. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30039. *
  30040. * @static
  30041. * @memberOf _
  30042. * @since 4.0.0
  30043. * @category Lang
  30044. * @param {*} value The value to check.
  30045. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30046. * @example
  30047. *
  30048. * _.isInteger(3);
  30049. * // => true
  30050. *
  30051. * _.isInteger(Number.MIN_VALUE);
  30052. * // => false
  30053. *
  30054. * _.isInteger(Infinity);
  30055. * // => false
  30056. *
  30057. * _.isInteger('3');
  30058. * // => false
  30059. */
  30060. function isInteger(value) {
  30061. return typeof value == 'number' && value == toInteger(value);
  30062. }
  30063. /**
  30064. * Checks if `value` is a valid array-like length.
  30065. *
  30066. * **Note:** This method is loosely based on
  30067. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30068. *
  30069. * @static
  30070. * @memberOf _
  30071. * @since 4.0.0
  30072. * @category Lang
  30073. * @param {*} value The value to check.
  30074. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30075. * @example
  30076. *
  30077. * _.isLength(3);
  30078. * // => true
  30079. *
  30080. * _.isLength(Number.MIN_VALUE);
  30081. * // => false
  30082. *
  30083. * _.isLength(Infinity);
  30084. * // => false
  30085. *
  30086. * _.isLength('3');
  30087. * // => false
  30088. */
  30089. function isLength(value) {
  30090. return typeof value == 'number' &&
  30091. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30092. }
  30093. /**
  30094. * Checks if `value` is the
  30095. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30096. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30097. *
  30098. * @static
  30099. * @memberOf _
  30100. * @since 0.1.0
  30101. * @category Lang
  30102. * @param {*} value The value to check.
  30103. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30104. * @example
  30105. *
  30106. * _.isObject({});
  30107. * // => true
  30108. *
  30109. * _.isObject([1, 2, 3]);
  30110. * // => true
  30111. *
  30112. * _.isObject(_.noop);
  30113. * // => true
  30114. *
  30115. * _.isObject(null);
  30116. * // => false
  30117. */
  30118. function isObject(value) {
  30119. var type = typeof value;
  30120. return value != null && (type == 'object' || type == 'function');
  30121. }
  30122. /**
  30123. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30124. * and has a `typeof` result of "object".
  30125. *
  30126. * @static
  30127. * @memberOf _
  30128. * @since 4.0.0
  30129. * @category Lang
  30130. * @param {*} value The value to check.
  30131. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30132. * @example
  30133. *
  30134. * _.isObjectLike({});
  30135. * // => true
  30136. *
  30137. * _.isObjectLike([1, 2, 3]);
  30138. * // => true
  30139. *
  30140. * _.isObjectLike(_.noop);
  30141. * // => false
  30142. *
  30143. * _.isObjectLike(null);
  30144. * // => false
  30145. */
  30146. function isObjectLike(value) {
  30147. return value != null && typeof value == 'object';
  30148. }
  30149. /**
  30150. * Checks if `value` is classified as a `Map` object.
  30151. *
  30152. * @static
  30153. * @memberOf _
  30154. * @since 4.3.0
  30155. * @category Lang
  30156. * @param {*} value The value to check.
  30157. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30158. * @example
  30159. *
  30160. * _.isMap(new Map);
  30161. * // => true
  30162. *
  30163. * _.isMap(new WeakMap);
  30164. * // => false
  30165. */
  30166. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30167. /**
  30168. * Performs a partial deep comparison between `object` and `source` to
  30169. * determine if `object` contains equivalent property values.
  30170. *
  30171. * **Note:** This method is equivalent to `_.matches` when `source` is
  30172. * partially applied.
  30173. *
  30174. * Partial comparisons will match empty array and empty object `source`
  30175. * values against any array or object value, respectively. See `_.isEqual`
  30176. * for a list of supported value comparisons.
  30177. *
  30178. * @static
  30179. * @memberOf _
  30180. * @since 3.0.0
  30181. * @category Lang
  30182. * @param {Object} object The object to inspect.
  30183. * @param {Object} source The object of property values to match.
  30184. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30185. * @example
  30186. *
  30187. * var object = { 'a': 1, 'b': 2 };
  30188. *
  30189. * _.isMatch(object, { 'b': 2 });
  30190. * // => true
  30191. *
  30192. * _.isMatch(object, { 'b': 1 });
  30193. * // => false
  30194. */
  30195. function isMatch(object, source) {
  30196. return object === source || baseIsMatch(object, source, getMatchData(source));
  30197. }
  30198. /**
  30199. * This method is like `_.isMatch` except that it accepts `customizer` which
  30200. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30201. * are handled by the method instead. The `customizer` is invoked with five
  30202. * arguments: (objValue, srcValue, index|key, object, source).
  30203. *
  30204. * @static
  30205. * @memberOf _
  30206. * @since 4.0.0
  30207. * @category Lang
  30208. * @param {Object} object The object to inspect.
  30209. * @param {Object} source The object of property values to match.
  30210. * @param {Function} [customizer] The function to customize comparisons.
  30211. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30212. * @example
  30213. *
  30214. * function isGreeting(value) {
  30215. * return /^h(?:i|ello)$/.test(value);
  30216. * }
  30217. *
  30218. * function customizer(objValue, srcValue) {
  30219. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30220. * return true;
  30221. * }
  30222. * }
  30223. *
  30224. * var object = { 'greeting': 'hello' };
  30225. * var source = { 'greeting': 'hi' };
  30226. *
  30227. * _.isMatchWith(object, source, customizer);
  30228. * // => true
  30229. */
  30230. function isMatchWith(object, source, customizer) {
  30231. customizer = typeof customizer == 'function' ? customizer : undefined;
  30232. return baseIsMatch(object, source, getMatchData(source), customizer);
  30233. }
  30234. /**
  30235. * Checks if `value` is `NaN`.
  30236. *
  30237. * **Note:** This method is based on
  30238. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30239. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30240. * `undefined` and other non-number values.
  30241. *
  30242. * @static
  30243. * @memberOf _
  30244. * @since 0.1.0
  30245. * @category Lang
  30246. * @param {*} value The value to check.
  30247. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30248. * @example
  30249. *
  30250. * _.isNaN(NaN);
  30251. * // => true
  30252. *
  30253. * _.isNaN(new Number(NaN));
  30254. * // => true
  30255. *
  30256. * isNaN(undefined);
  30257. * // => true
  30258. *
  30259. * _.isNaN(undefined);
  30260. * // => false
  30261. */
  30262. function isNaN(value) {
  30263. // An `NaN` primitive is the only value that is not equal to itself.
  30264. // Perform the `toStringTag` check first to avoid errors with some
  30265. // ActiveX objects in IE.
  30266. return isNumber(value) && value != +value;
  30267. }
  30268. /**
  30269. * Checks if `value` is a pristine native function.
  30270. *
  30271. * **Note:** This method can't reliably detect native functions in the presence
  30272. * of the core-js package because core-js circumvents this kind of detection.
  30273. * Despite multiple requests, the core-js maintainer has made it clear: any
  30274. * attempt to fix the detection will be obstructed. As a result, we're left
  30275. * with little choice but to throw an error. Unfortunately, this also affects
  30276. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30277. * which rely on core-js.
  30278. *
  30279. * @static
  30280. * @memberOf _
  30281. * @since 3.0.0
  30282. * @category Lang
  30283. * @param {*} value The value to check.
  30284. * @returns {boolean} Returns `true` if `value` is a native function,
  30285. * else `false`.
  30286. * @example
  30287. *
  30288. * _.isNative(Array.prototype.push);
  30289. * // => true
  30290. *
  30291. * _.isNative(_);
  30292. * // => false
  30293. */
  30294. function isNative(value) {
  30295. if (isMaskable(value)) {
  30296. throw new Error(CORE_ERROR_TEXT);
  30297. }
  30298. return baseIsNative(value);
  30299. }
  30300. /**
  30301. * Checks if `value` is `null`.
  30302. *
  30303. * @static
  30304. * @memberOf _
  30305. * @since 0.1.0
  30306. * @category Lang
  30307. * @param {*} value The value to check.
  30308. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30309. * @example
  30310. *
  30311. * _.isNull(null);
  30312. * // => true
  30313. *
  30314. * _.isNull(void 0);
  30315. * // => false
  30316. */
  30317. function isNull(value) {
  30318. return value === null;
  30319. }
  30320. /**
  30321. * Checks if `value` is `null` or `undefined`.
  30322. *
  30323. * @static
  30324. * @memberOf _
  30325. * @since 4.0.0
  30326. * @category Lang
  30327. * @param {*} value The value to check.
  30328. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30329. * @example
  30330. *
  30331. * _.isNil(null);
  30332. * // => true
  30333. *
  30334. * _.isNil(void 0);
  30335. * // => true
  30336. *
  30337. * _.isNil(NaN);
  30338. * // => false
  30339. */
  30340. function isNil(value) {
  30341. return value == null;
  30342. }
  30343. /**
  30344. * Checks if `value` is classified as a `Number` primitive or object.
  30345. *
  30346. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30347. * classified as numbers, use the `_.isFinite` method.
  30348. *
  30349. * @static
  30350. * @memberOf _
  30351. * @since 0.1.0
  30352. * @category Lang
  30353. * @param {*} value The value to check.
  30354. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30355. * @example
  30356. *
  30357. * _.isNumber(3);
  30358. * // => true
  30359. *
  30360. * _.isNumber(Number.MIN_VALUE);
  30361. * // => true
  30362. *
  30363. * _.isNumber(Infinity);
  30364. * // => true
  30365. *
  30366. * _.isNumber('3');
  30367. * // => false
  30368. */
  30369. function isNumber(value) {
  30370. return typeof value == 'number' ||
  30371. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30372. }
  30373. /**
  30374. * Checks if `value` is a plain object, that is, an object created by the
  30375. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30376. *
  30377. * @static
  30378. * @memberOf _
  30379. * @since 0.8.0
  30380. * @category Lang
  30381. * @param {*} value The value to check.
  30382. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30383. * @example
  30384. *
  30385. * function Foo() {
  30386. * this.a = 1;
  30387. * }
  30388. *
  30389. * _.isPlainObject(new Foo);
  30390. * // => false
  30391. *
  30392. * _.isPlainObject([1, 2, 3]);
  30393. * // => false
  30394. *
  30395. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30396. * // => true
  30397. *
  30398. * _.isPlainObject(Object.create(null));
  30399. * // => true
  30400. */
  30401. function isPlainObject(value) {
  30402. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30403. return false;
  30404. }
  30405. var proto = getPrototype(value);
  30406. if (proto === null) {
  30407. return true;
  30408. }
  30409. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30410. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30411. funcToString.call(Ctor) == objectCtorString;
  30412. }
  30413. /**
  30414. * Checks if `value` is classified as a `RegExp` object.
  30415. *
  30416. * @static
  30417. * @memberOf _
  30418. * @since 0.1.0
  30419. * @category Lang
  30420. * @param {*} value The value to check.
  30421. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30422. * @example
  30423. *
  30424. * _.isRegExp(/abc/);
  30425. * // => true
  30426. *
  30427. * _.isRegExp('/abc/');
  30428. * // => false
  30429. */
  30430. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30431. /**
  30432. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30433. * double precision number which isn't the result of a rounded unsafe integer.
  30434. *
  30435. * **Note:** This method is based on
  30436. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30437. *
  30438. * @static
  30439. * @memberOf _
  30440. * @since 4.0.0
  30441. * @category Lang
  30442. * @param {*} value The value to check.
  30443. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30444. * @example
  30445. *
  30446. * _.isSafeInteger(3);
  30447. * // => true
  30448. *
  30449. * _.isSafeInteger(Number.MIN_VALUE);
  30450. * // => false
  30451. *
  30452. * _.isSafeInteger(Infinity);
  30453. * // => false
  30454. *
  30455. * _.isSafeInteger('3');
  30456. * // => false
  30457. */
  30458. function isSafeInteger(value) {
  30459. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30460. }
  30461. /**
  30462. * Checks if `value` is classified as a `Set` object.
  30463. *
  30464. * @static
  30465. * @memberOf _
  30466. * @since 4.3.0
  30467. * @category Lang
  30468. * @param {*} value The value to check.
  30469. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30470. * @example
  30471. *
  30472. * _.isSet(new Set);
  30473. * // => true
  30474. *
  30475. * _.isSet(new WeakSet);
  30476. * // => false
  30477. */
  30478. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30479. /**
  30480. * Checks if `value` is classified as a `String` primitive or object.
  30481. *
  30482. * @static
  30483. * @since 0.1.0
  30484. * @memberOf _
  30485. * @category Lang
  30486. * @param {*} value The value to check.
  30487. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30488. * @example
  30489. *
  30490. * _.isString('abc');
  30491. * // => true
  30492. *
  30493. * _.isString(1);
  30494. * // => false
  30495. */
  30496. function isString(value) {
  30497. return typeof value == 'string' ||
  30498. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30499. }
  30500. /**
  30501. * Checks if `value` is classified as a `Symbol` primitive or object.
  30502. *
  30503. * @static
  30504. * @memberOf _
  30505. * @since 4.0.0
  30506. * @category Lang
  30507. * @param {*} value The value to check.
  30508. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30509. * @example
  30510. *
  30511. * _.isSymbol(Symbol.iterator);
  30512. * // => true
  30513. *
  30514. * _.isSymbol('abc');
  30515. * // => false
  30516. */
  30517. function isSymbol(value) {
  30518. return typeof value == 'symbol' ||
  30519. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30520. }
  30521. /**
  30522. * Checks if `value` is classified as a typed array.
  30523. *
  30524. * @static
  30525. * @memberOf _
  30526. * @since 3.0.0
  30527. * @category Lang
  30528. * @param {*} value The value to check.
  30529. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30530. * @example
  30531. *
  30532. * _.isTypedArray(new Uint8Array);
  30533. * // => true
  30534. *
  30535. * _.isTypedArray([]);
  30536. * // => false
  30537. */
  30538. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30539. /**
  30540. * Checks if `value` is `undefined`.
  30541. *
  30542. * @static
  30543. * @since 0.1.0
  30544. * @memberOf _
  30545. * @category Lang
  30546. * @param {*} value The value to check.
  30547. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30548. * @example
  30549. *
  30550. * _.isUndefined(void 0);
  30551. * // => true
  30552. *
  30553. * _.isUndefined(null);
  30554. * // => false
  30555. */
  30556. function isUndefined(value) {
  30557. return value === undefined;
  30558. }
  30559. /**
  30560. * Checks if `value` is classified as a `WeakMap` object.
  30561. *
  30562. * @static
  30563. * @memberOf _
  30564. * @since 4.3.0
  30565. * @category Lang
  30566. * @param {*} value The value to check.
  30567. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30568. * @example
  30569. *
  30570. * _.isWeakMap(new WeakMap);
  30571. * // => true
  30572. *
  30573. * _.isWeakMap(new Map);
  30574. * // => false
  30575. */
  30576. function isWeakMap(value) {
  30577. return isObjectLike(value) && getTag(value) == weakMapTag;
  30578. }
  30579. /**
  30580. * Checks if `value` is classified as a `WeakSet` object.
  30581. *
  30582. * @static
  30583. * @memberOf _
  30584. * @since 4.3.0
  30585. * @category Lang
  30586. * @param {*} value The value to check.
  30587. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30588. * @example
  30589. *
  30590. * _.isWeakSet(new WeakSet);
  30591. * // => true
  30592. *
  30593. * _.isWeakSet(new Set);
  30594. * // => false
  30595. */
  30596. function isWeakSet(value) {
  30597. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30598. }
  30599. /**
  30600. * Checks if `value` is less than `other`.
  30601. *
  30602. * @static
  30603. * @memberOf _
  30604. * @since 3.9.0
  30605. * @category Lang
  30606. * @param {*} value The value to compare.
  30607. * @param {*} other The other value to compare.
  30608. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30609. * else `false`.
  30610. * @see _.gt
  30611. * @example
  30612. *
  30613. * _.lt(1, 3);
  30614. * // => true
  30615. *
  30616. * _.lt(3, 3);
  30617. * // => false
  30618. *
  30619. * _.lt(3, 1);
  30620. * // => false
  30621. */
  30622. var lt = createRelationalOperation(baseLt);
  30623. /**
  30624. * Checks if `value` is less than or equal to `other`.
  30625. *
  30626. * @static
  30627. * @memberOf _
  30628. * @since 3.9.0
  30629. * @category Lang
  30630. * @param {*} value The value to compare.
  30631. * @param {*} other The other value to compare.
  30632. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30633. * `other`, else `false`.
  30634. * @see _.gte
  30635. * @example
  30636. *
  30637. * _.lte(1, 3);
  30638. * // => true
  30639. *
  30640. * _.lte(3, 3);
  30641. * // => true
  30642. *
  30643. * _.lte(3, 1);
  30644. * // => false
  30645. */
  30646. var lte = createRelationalOperation(function(value, other) {
  30647. return value <= other;
  30648. });
  30649. /**
  30650. * Converts `value` to an array.
  30651. *
  30652. * @static
  30653. * @since 0.1.0
  30654. * @memberOf _
  30655. * @category Lang
  30656. * @param {*} value The value to convert.
  30657. * @returns {Array} Returns the converted array.
  30658. * @example
  30659. *
  30660. * _.toArray({ 'a': 1, 'b': 2 });
  30661. * // => [1, 2]
  30662. *
  30663. * _.toArray('abc');
  30664. * // => ['a', 'b', 'c']
  30665. *
  30666. * _.toArray(1);
  30667. * // => []
  30668. *
  30669. * _.toArray(null);
  30670. * // => []
  30671. */
  30672. function toArray(value) {
  30673. if (!value) {
  30674. return [];
  30675. }
  30676. if (isArrayLike(value)) {
  30677. return isString(value) ? stringToArray(value) : copyArray(value);
  30678. }
  30679. if (symIterator && value[symIterator]) {
  30680. return iteratorToArray(value[symIterator]());
  30681. }
  30682. var tag = getTag(value),
  30683. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30684. return func(value);
  30685. }
  30686. /**
  30687. * Converts `value` to a finite number.
  30688. *
  30689. * @static
  30690. * @memberOf _
  30691. * @since 4.12.0
  30692. * @category Lang
  30693. * @param {*} value The value to convert.
  30694. * @returns {number} Returns the converted number.
  30695. * @example
  30696. *
  30697. * _.toFinite(3.2);
  30698. * // => 3.2
  30699. *
  30700. * _.toFinite(Number.MIN_VALUE);
  30701. * // => 5e-324
  30702. *
  30703. * _.toFinite(Infinity);
  30704. * // => 1.7976931348623157e+308
  30705. *
  30706. * _.toFinite('3.2');
  30707. * // => 3.2
  30708. */
  30709. function toFinite(value) {
  30710. if (!value) {
  30711. return value === 0 ? value : 0;
  30712. }
  30713. value = toNumber(value);
  30714. if (value === INFINITY || value === -INFINITY) {
  30715. var sign = (value < 0 ? -1 : 1);
  30716. return sign * MAX_INTEGER;
  30717. }
  30718. return value === value ? value : 0;
  30719. }
  30720. /**
  30721. * Converts `value` to an integer.
  30722. *
  30723. * **Note:** This method is loosely based on
  30724. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30725. *
  30726. * @static
  30727. * @memberOf _
  30728. * @since 4.0.0
  30729. * @category Lang
  30730. * @param {*} value The value to convert.
  30731. * @returns {number} Returns the converted integer.
  30732. * @example
  30733. *
  30734. * _.toInteger(3.2);
  30735. * // => 3
  30736. *
  30737. * _.toInteger(Number.MIN_VALUE);
  30738. * // => 0
  30739. *
  30740. * _.toInteger(Infinity);
  30741. * // => 1.7976931348623157e+308
  30742. *
  30743. * _.toInteger('3.2');
  30744. * // => 3
  30745. */
  30746. function toInteger(value) {
  30747. var result = toFinite(value),
  30748. remainder = result % 1;
  30749. return result === result ? (remainder ? result - remainder : result) : 0;
  30750. }
  30751. /**
  30752. * Converts `value` to an integer suitable for use as the length of an
  30753. * array-like object.
  30754. *
  30755. * **Note:** This method is based on
  30756. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30757. *
  30758. * @static
  30759. * @memberOf _
  30760. * @since 4.0.0
  30761. * @category Lang
  30762. * @param {*} value The value to convert.
  30763. * @returns {number} Returns the converted integer.
  30764. * @example
  30765. *
  30766. * _.toLength(3.2);
  30767. * // => 3
  30768. *
  30769. * _.toLength(Number.MIN_VALUE);
  30770. * // => 0
  30771. *
  30772. * _.toLength(Infinity);
  30773. * // => 4294967295
  30774. *
  30775. * _.toLength('3.2');
  30776. * // => 3
  30777. */
  30778. function toLength(value) {
  30779. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30780. }
  30781. /**
  30782. * Converts `value` to a number.
  30783. *
  30784. * @static
  30785. * @memberOf _
  30786. * @since 4.0.0
  30787. * @category Lang
  30788. * @param {*} value The value to process.
  30789. * @returns {number} Returns the number.
  30790. * @example
  30791. *
  30792. * _.toNumber(3.2);
  30793. * // => 3.2
  30794. *
  30795. * _.toNumber(Number.MIN_VALUE);
  30796. * // => 5e-324
  30797. *
  30798. * _.toNumber(Infinity);
  30799. * // => Infinity
  30800. *
  30801. * _.toNumber('3.2');
  30802. * // => 3.2
  30803. */
  30804. function toNumber(value) {
  30805. if (typeof value == 'number') {
  30806. return value;
  30807. }
  30808. if (isSymbol(value)) {
  30809. return NAN;
  30810. }
  30811. if (isObject(value)) {
  30812. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30813. value = isObject(other) ? (other + '') : other;
  30814. }
  30815. if (typeof value != 'string') {
  30816. return value === 0 ? value : +value;
  30817. }
  30818. value = value.replace(reTrim, '');
  30819. var isBinary = reIsBinary.test(value);
  30820. return (isBinary || reIsOctal.test(value))
  30821. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30822. : (reIsBadHex.test(value) ? NAN : +value);
  30823. }
  30824. /**
  30825. * Converts `value` to a plain object flattening inherited enumerable string
  30826. * keyed properties of `value` to own properties of the plain object.
  30827. *
  30828. * @static
  30829. * @memberOf _
  30830. * @since 3.0.0
  30831. * @category Lang
  30832. * @param {*} value The value to convert.
  30833. * @returns {Object} Returns the converted plain object.
  30834. * @example
  30835. *
  30836. * function Foo() {
  30837. * this.b = 2;
  30838. * }
  30839. *
  30840. * Foo.prototype.c = 3;
  30841. *
  30842. * _.assign({ 'a': 1 }, new Foo);
  30843. * // => { 'a': 1, 'b': 2 }
  30844. *
  30845. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30846. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30847. */
  30848. function toPlainObject(value) {
  30849. return copyObject(value, keysIn(value));
  30850. }
  30851. /**
  30852. * Converts `value` to a safe integer. A safe integer can be compared and
  30853. * represented correctly.
  30854. *
  30855. * @static
  30856. * @memberOf _
  30857. * @since 4.0.0
  30858. * @category Lang
  30859. * @param {*} value The value to convert.
  30860. * @returns {number} Returns the converted integer.
  30861. * @example
  30862. *
  30863. * _.toSafeInteger(3.2);
  30864. * // => 3
  30865. *
  30866. * _.toSafeInteger(Number.MIN_VALUE);
  30867. * // => 0
  30868. *
  30869. * _.toSafeInteger(Infinity);
  30870. * // => 9007199254740991
  30871. *
  30872. * _.toSafeInteger('3.2');
  30873. * // => 3
  30874. */
  30875. function toSafeInteger(value) {
  30876. return value
  30877. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30878. : (value === 0 ? value : 0);
  30879. }
  30880. /**
  30881. * Converts `value` to a string. An empty string is returned for `null`
  30882. * and `undefined` values. The sign of `-0` is preserved.
  30883. *
  30884. * @static
  30885. * @memberOf _
  30886. * @since 4.0.0
  30887. * @category Lang
  30888. * @param {*} value The value to convert.
  30889. * @returns {string} Returns the converted string.
  30890. * @example
  30891. *
  30892. * _.toString(null);
  30893. * // => ''
  30894. *
  30895. * _.toString(-0);
  30896. * // => '-0'
  30897. *
  30898. * _.toString([1, 2, 3]);
  30899. * // => '1,2,3'
  30900. */
  30901. function toString(value) {
  30902. return value == null ? '' : baseToString(value);
  30903. }
  30904. /*------------------------------------------------------------------------*/
  30905. /**
  30906. * Assigns own enumerable string keyed properties of source objects to the
  30907. * destination object. Source objects are applied from left to right.
  30908. * Subsequent sources overwrite property assignments of previous sources.
  30909. *
  30910. * **Note:** This method mutates `object` and is loosely based on
  30911. * [`Object.assign`](https://mdn.io/Object/assign).
  30912. *
  30913. * @static
  30914. * @memberOf _
  30915. * @since 0.10.0
  30916. * @category Object
  30917. * @param {Object} object The destination object.
  30918. * @param {...Object} [sources] The source objects.
  30919. * @returns {Object} Returns `object`.
  30920. * @see _.assignIn
  30921. * @example
  30922. *
  30923. * function Foo() {
  30924. * this.a = 1;
  30925. * }
  30926. *
  30927. * function Bar() {
  30928. * this.c = 3;
  30929. * }
  30930. *
  30931. * Foo.prototype.b = 2;
  30932. * Bar.prototype.d = 4;
  30933. *
  30934. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30935. * // => { 'a': 1, 'c': 3 }
  30936. */
  30937. var assign = createAssigner(function(object, source) {
  30938. if (isPrototype(source) || isArrayLike(source)) {
  30939. copyObject(source, keys(source), object);
  30940. return;
  30941. }
  30942. for (var key in source) {
  30943. if (hasOwnProperty.call(source, key)) {
  30944. assignValue(object, key, source[key]);
  30945. }
  30946. }
  30947. });
  30948. /**
  30949. * This method is like `_.assign` except that it iterates over own and
  30950. * inherited source properties.
  30951. *
  30952. * **Note:** This method mutates `object`.
  30953. *
  30954. * @static
  30955. * @memberOf _
  30956. * @since 4.0.0
  30957. * @alias extend
  30958. * @category Object
  30959. * @param {Object} object The destination object.
  30960. * @param {...Object} [sources] The source objects.
  30961. * @returns {Object} Returns `object`.
  30962. * @see _.assign
  30963. * @example
  30964. *
  30965. * function Foo() {
  30966. * this.a = 1;
  30967. * }
  30968. *
  30969. * function Bar() {
  30970. * this.c = 3;
  30971. * }
  30972. *
  30973. * Foo.prototype.b = 2;
  30974. * Bar.prototype.d = 4;
  30975. *
  30976. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30977. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30978. */
  30979. var assignIn = createAssigner(function(object, source) {
  30980. copyObject(source, keysIn(source), object);
  30981. });
  30982. /**
  30983. * This method is like `_.assignIn` except that it accepts `customizer`
  30984. * which is invoked to produce the assigned values. If `customizer` returns
  30985. * `undefined`, assignment is handled by the method instead. The `customizer`
  30986. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30987. *
  30988. * **Note:** This method mutates `object`.
  30989. *
  30990. * @static
  30991. * @memberOf _
  30992. * @since 4.0.0
  30993. * @alias extendWith
  30994. * @category Object
  30995. * @param {Object} object The destination object.
  30996. * @param {...Object} sources The source objects.
  30997. * @param {Function} [customizer] The function to customize assigned values.
  30998. * @returns {Object} Returns `object`.
  30999. * @see _.assignWith
  31000. * @example
  31001. *
  31002. * function customizer(objValue, srcValue) {
  31003. * return _.isUndefined(objValue) ? srcValue : objValue;
  31004. * }
  31005. *
  31006. * var defaults = _.partialRight(_.assignInWith, customizer);
  31007. *
  31008. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31009. * // => { 'a': 1, 'b': 2 }
  31010. */
  31011. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  31012. copyObject(source, keysIn(source), object, customizer);
  31013. });
  31014. /**
  31015. * This method is like `_.assign` except that it accepts `customizer`
  31016. * which is invoked to produce the assigned values. If `customizer` returns
  31017. * `undefined`, assignment is handled by the method instead. The `customizer`
  31018. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31019. *
  31020. * **Note:** This method mutates `object`.
  31021. *
  31022. * @static
  31023. * @memberOf _
  31024. * @since 4.0.0
  31025. * @category Object
  31026. * @param {Object} object The destination object.
  31027. * @param {...Object} sources The source objects.
  31028. * @param {Function} [customizer] The function to customize assigned values.
  31029. * @returns {Object} Returns `object`.
  31030. * @see _.assignInWith
  31031. * @example
  31032. *
  31033. * function customizer(objValue, srcValue) {
  31034. * return _.isUndefined(objValue) ? srcValue : objValue;
  31035. * }
  31036. *
  31037. * var defaults = _.partialRight(_.assignWith, customizer);
  31038. *
  31039. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31040. * // => { 'a': 1, 'b': 2 }
  31041. */
  31042. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31043. copyObject(source, keys(source), object, customizer);
  31044. });
  31045. /**
  31046. * Creates an array of values corresponding to `paths` of `object`.
  31047. *
  31048. * @static
  31049. * @memberOf _
  31050. * @since 1.0.0
  31051. * @category Object
  31052. * @param {Object} object The object to iterate over.
  31053. * @param {...(string|string[])} [paths] The property paths to pick.
  31054. * @returns {Array} Returns the picked values.
  31055. * @example
  31056. *
  31057. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31058. *
  31059. * _.at(object, ['a[0].b.c', 'a[1]']);
  31060. * // => [3, 4]
  31061. */
  31062. var at = flatRest(baseAt);
  31063. /**
  31064. * Creates an object that inherits from the `prototype` object. If a
  31065. * `properties` object is given, its own enumerable string keyed properties
  31066. * are assigned to the created object.
  31067. *
  31068. * @static
  31069. * @memberOf _
  31070. * @since 2.3.0
  31071. * @category Object
  31072. * @param {Object} prototype The object to inherit from.
  31073. * @param {Object} [properties] The properties to assign to the object.
  31074. * @returns {Object} Returns the new object.
  31075. * @example
  31076. *
  31077. * function Shape() {
  31078. * this.x = 0;
  31079. * this.y = 0;
  31080. * }
  31081. *
  31082. * function Circle() {
  31083. * Shape.call(this);
  31084. * }
  31085. *
  31086. * Circle.prototype = _.create(Shape.prototype, {
  31087. * 'constructor': Circle
  31088. * });
  31089. *
  31090. * var circle = new Circle;
  31091. * circle instanceof Circle;
  31092. * // => true
  31093. *
  31094. * circle instanceof Shape;
  31095. * // => true
  31096. */
  31097. function create(prototype, properties) {
  31098. var result = baseCreate(prototype);
  31099. return properties == null ? result : baseAssign(result, properties);
  31100. }
  31101. /**
  31102. * Assigns own and inherited enumerable string keyed properties of source
  31103. * objects to the destination object for all destination properties that
  31104. * resolve to `undefined`. Source objects are applied from left to right.
  31105. * Once a property is set, additional values of the same property are ignored.
  31106. *
  31107. * **Note:** This method mutates `object`.
  31108. *
  31109. * @static
  31110. * @since 0.1.0
  31111. * @memberOf _
  31112. * @category Object
  31113. * @param {Object} object The destination object.
  31114. * @param {...Object} [sources] The source objects.
  31115. * @returns {Object} Returns `object`.
  31116. * @see _.defaultsDeep
  31117. * @example
  31118. *
  31119. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31120. * // => { 'a': 1, 'b': 2 }
  31121. */
  31122. var defaults = baseRest(function(object, sources) {
  31123. object = Object(object);
  31124. var index = -1;
  31125. var length = sources.length;
  31126. var guard = length > 2 ? sources[2] : undefined;
  31127. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31128. length = 1;
  31129. }
  31130. while (++index < length) {
  31131. var source = sources[index];
  31132. var props = keysIn(source);
  31133. var propsIndex = -1;
  31134. var propsLength = props.length;
  31135. while (++propsIndex < propsLength) {
  31136. var key = props[propsIndex];
  31137. var value = object[key];
  31138. if (value === undefined ||
  31139. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31140. object[key] = source[key];
  31141. }
  31142. }
  31143. }
  31144. return object;
  31145. });
  31146. /**
  31147. * This method is like `_.defaults` except that it recursively assigns
  31148. * default properties.
  31149. *
  31150. * **Note:** This method mutates `object`.
  31151. *
  31152. * @static
  31153. * @memberOf _
  31154. * @since 3.10.0
  31155. * @category Object
  31156. * @param {Object} object The destination object.
  31157. * @param {...Object} [sources] The source objects.
  31158. * @returns {Object} Returns `object`.
  31159. * @see _.defaults
  31160. * @example
  31161. *
  31162. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31163. * // => { 'a': { 'b': 2, 'c': 3 } }
  31164. */
  31165. var defaultsDeep = baseRest(function(args) {
  31166. args.push(undefined, customDefaultsMerge);
  31167. return apply(mergeWith, undefined, args);
  31168. });
  31169. /**
  31170. * This method is like `_.find` except that it returns the key of the first
  31171. * element `predicate` returns truthy for instead of the element itself.
  31172. *
  31173. * @static
  31174. * @memberOf _
  31175. * @since 1.1.0
  31176. * @category Object
  31177. * @param {Object} object The object to inspect.
  31178. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31179. * @returns {string|undefined} Returns the key of the matched element,
  31180. * else `undefined`.
  31181. * @example
  31182. *
  31183. * var users = {
  31184. * 'barney': { 'age': 36, 'active': true },
  31185. * 'fred': { 'age': 40, 'active': false },
  31186. * 'pebbles': { 'age': 1, 'active': true }
  31187. * };
  31188. *
  31189. * _.findKey(users, function(o) { return o.age < 40; });
  31190. * // => 'barney' (iteration order is not guaranteed)
  31191. *
  31192. * // The `_.matches` iteratee shorthand.
  31193. * _.findKey(users, { 'age': 1, 'active': true });
  31194. * // => 'pebbles'
  31195. *
  31196. * // The `_.matchesProperty` iteratee shorthand.
  31197. * _.findKey(users, ['active', false]);
  31198. * // => 'fred'
  31199. *
  31200. * // The `_.property` iteratee shorthand.
  31201. * _.findKey(users, 'active');
  31202. * // => 'barney'
  31203. */
  31204. function findKey(object, predicate) {
  31205. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31206. }
  31207. /**
  31208. * This method is like `_.findKey` except that it iterates over elements of
  31209. * a collection in the opposite order.
  31210. *
  31211. * @static
  31212. * @memberOf _
  31213. * @since 2.0.0
  31214. * @category Object
  31215. * @param {Object} object The object to inspect.
  31216. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31217. * @returns {string|undefined} Returns the key of the matched element,
  31218. * else `undefined`.
  31219. * @example
  31220. *
  31221. * var users = {
  31222. * 'barney': { 'age': 36, 'active': true },
  31223. * 'fred': { 'age': 40, 'active': false },
  31224. * 'pebbles': { 'age': 1, 'active': true }
  31225. * };
  31226. *
  31227. * _.findLastKey(users, function(o) { return o.age < 40; });
  31228. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31229. *
  31230. * // The `_.matches` iteratee shorthand.
  31231. * _.findLastKey(users, { 'age': 36, 'active': true });
  31232. * // => 'barney'
  31233. *
  31234. * // The `_.matchesProperty` iteratee shorthand.
  31235. * _.findLastKey(users, ['active', false]);
  31236. * // => 'fred'
  31237. *
  31238. * // The `_.property` iteratee shorthand.
  31239. * _.findLastKey(users, 'active');
  31240. * // => 'pebbles'
  31241. */
  31242. function findLastKey(object, predicate) {
  31243. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31244. }
  31245. /**
  31246. * Iterates over own and inherited enumerable string keyed properties of an
  31247. * object and invokes `iteratee` for each property. The iteratee is invoked
  31248. * with three arguments: (value, key, object). Iteratee functions may exit
  31249. * iteration early by explicitly returning `false`.
  31250. *
  31251. * @static
  31252. * @memberOf _
  31253. * @since 0.3.0
  31254. * @category Object
  31255. * @param {Object} object The object to iterate over.
  31256. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31257. * @returns {Object} Returns `object`.
  31258. * @see _.forInRight
  31259. * @example
  31260. *
  31261. * function Foo() {
  31262. * this.a = 1;
  31263. * this.b = 2;
  31264. * }
  31265. *
  31266. * Foo.prototype.c = 3;
  31267. *
  31268. * _.forIn(new Foo, function(value, key) {
  31269. * console.log(key);
  31270. * });
  31271. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31272. */
  31273. function forIn(object, iteratee) {
  31274. return object == null
  31275. ? object
  31276. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31277. }
  31278. /**
  31279. * This method is like `_.forIn` except that it iterates over properties of
  31280. * `object` in the opposite order.
  31281. *
  31282. * @static
  31283. * @memberOf _
  31284. * @since 2.0.0
  31285. * @category Object
  31286. * @param {Object} object The object to iterate over.
  31287. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31288. * @returns {Object} Returns `object`.
  31289. * @see _.forIn
  31290. * @example
  31291. *
  31292. * function Foo() {
  31293. * this.a = 1;
  31294. * this.b = 2;
  31295. * }
  31296. *
  31297. * Foo.prototype.c = 3;
  31298. *
  31299. * _.forInRight(new Foo, function(value, key) {
  31300. * console.log(key);
  31301. * });
  31302. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31303. */
  31304. function forInRight(object, iteratee) {
  31305. return object == null
  31306. ? object
  31307. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31308. }
  31309. /**
  31310. * Iterates over own enumerable string keyed properties of an object and
  31311. * invokes `iteratee` for each property. The iteratee is invoked with three
  31312. * arguments: (value, key, object). Iteratee functions may exit iteration
  31313. * early by explicitly returning `false`.
  31314. *
  31315. * @static
  31316. * @memberOf _
  31317. * @since 0.3.0
  31318. * @category Object
  31319. * @param {Object} object The object to iterate over.
  31320. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31321. * @returns {Object} Returns `object`.
  31322. * @see _.forOwnRight
  31323. * @example
  31324. *
  31325. * function Foo() {
  31326. * this.a = 1;
  31327. * this.b = 2;
  31328. * }
  31329. *
  31330. * Foo.prototype.c = 3;
  31331. *
  31332. * _.forOwn(new Foo, function(value, key) {
  31333. * console.log(key);
  31334. * });
  31335. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31336. */
  31337. function forOwn(object, iteratee) {
  31338. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31339. }
  31340. /**
  31341. * This method is like `_.forOwn` except that it iterates over properties of
  31342. * `object` in the opposite order.
  31343. *
  31344. * @static
  31345. * @memberOf _
  31346. * @since 2.0.0
  31347. * @category Object
  31348. * @param {Object} object The object to iterate over.
  31349. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31350. * @returns {Object} Returns `object`.
  31351. * @see _.forOwn
  31352. * @example
  31353. *
  31354. * function Foo() {
  31355. * this.a = 1;
  31356. * this.b = 2;
  31357. * }
  31358. *
  31359. * Foo.prototype.c = 3;
  31360. *
  31361. * _.forOwnRight(new Foo, function(value, key) {
  31362. * console.log(key);
  31363. * });
  31364. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31365. */
  31366. function forOwnRight(object, iteratee) {
  31367. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31368. }
  31369. /**
  31370. * Creates an array of function property names from own enumerable properties
  31371. * of `object`.
  31372. *
  31373. * @static
  31374. * @since 0.1.0
  31375. * @memberOf _
  31376. * @category Object
  31377. * @param {Object} object The object to inspect.
  31378. * @returns {Array} Returns the function names.
  31379. * @see _.functionsIn
  31380. * @example
  31381. *
  31382. * function Foo() {
  31383. * this.a = _.constant('a');
  31384. * this.b = _.constant('b');
  31385. * }
  31386. *
  31387. * Foo.prototype.c = _.constant('c');
  31388. *
  31389. * _.functions(new Foo);
  31390. * // => ['a', 'b']
  31391. */
  31392. function functions(object) {
  31393. return object == null ? [] : baseFunctions(object, keys(object));
  31394. }
  31395. /**
  31396. * Creates an array of function property names from own and inherited
  31397. * enumerable properties of `object`.
  31398. *
  31399. * @static
  31400. * @memberOf _
  31401. * @since 4.0.0
  31402. * @category Object
  31403. * @param {Object} object The object to inspect.
  31404. * @returns {Array} Returns the function names.
  31405. * @see _.functions
  31406. * @example
  31407. *
  31408. * function Foo() {
  31409. * this.a = _.constant('a');
  31410. * this.b = _.constant('b');
  31411. * }
  31412. *
  31413. * Foo.prototype.c = _.constant('c');
  31414. *
  31415. * _.functionsIn(new Foo);
  31416. * // => ['a', 'b', 'c']
  31417. */
  31418. function functionsIn(object) {
  31419. return object == null ? [] : baseFunctions(object, keysIn(object));
  31420. }
  31421. /**
  31422. * Gets the value at `path` of `object`. If the resolved value is
  31423. * `undefined`, the `defaultValue` is returned in its place.
  31424. *
  31425. * @static
  31426. * @memberOf _
  31427. * @since 3.7.0
  31428. * @category Object
  31429. * @param {Object} object The object to query.
  31430. * @param {Array|string} path The path of the property to get.
  31431. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31432. * @returns {*} Returns the resolved value.
  31433. * @example
  31434. *
  31435. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31436. *
  31437. * _.get(object, 'a[0].b.c');
  31438. * // => 3
  31439. *
  31440. * _.get(object, ['a', '0', 'b', 'c']);
  31441. * // => 3
  31442. *
  31443. * _.get(object, 'a.b.c', 'default');
  31444. * // => 'default'
  31445. */
  31446. function get(object, path, defaultValue) {
  31447. var result = object == null ? undefined : baseGet(object, path);
  31448. return result === undefined ? defaultValue : result;
  31449. }
  31450. /**
  31451. * Checks if `path` is a direct property of `object`.
  31452. *
  31453. * @static
  31454. * @since 0.1.0
  31455. * @memberOf _
  31456. * @category Object
  31457. * @param {Object} object The object to query.
  31458. * @param {Array|string} path The path to check.
  31459. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31460. * @example
  31461. *
  31462. * var object = { 'a': { 'b': 2 } };
  31463. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31464. *
  31465. * _.has(object, 'a');
  31466. * // => true
  31467. *
  31468. * _.has(object, 'a.b');
  31469. * // => true
  31470. *
  31471. * _.has(object, ['a', 'b']);
  31472. * // => true
  31473. *
  31474. * _.has(other, 'a');
  31475. * // => false
  31476. */
  31477. function has(object, path) {
  31478. return object != null && hasPath(object, path, baseHas);
  31479. }
  31480. /**
  31481. * Checks if `path` is a direct or inherited property of `object`.
  31482. *
  31483. * @static
  31484. * @memberOf _
  31485. * @since 4.0.0
  31486. * @category Object
  31487. * @param {Object} object The object to query.
  31488. * @param {Array|string} path The path to check.
  31489. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31490. * @example
  31491. *
  31492. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31493. *
  31494. * _.hasIn(object, 'a');
  31495. * // => true
  31496. *
  31497. * _.hasIn(object, 'a.b');
  31498. * // => true
  31499. *
  31500. * _.hasIn(object, ['a', 'b']);
  31501. * // => true
  31502. *
  31503. * _.hasIn(object, 'b');
  31504. * // => false
  31505. */
  31506. function hasIn(object, path) {
  31507. return object != null && hasPath(object, path, baseHasIn);
  31508. }
  31509. /**
  31510. * Creates an object composed of the inverted keys and values of `object`.
  31511. * If `object` contains duplicate values, subsequent values overwrite
  31512. * property assignments of previous values.
  31513. *
  31514. * @static
  31515. * @memberOf _
  31516. * @since 0.7.0
  31517. * @category Object
  31518. * @param {Object} object The object to invert.
  31519. * @returns {Object} Returns the new inverted object.
  31520. * @example
  31521. *
  31522. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31523. *
  31524. * _.invert(object);
  31525. * // => { '1': 'c', '2': 'b' }
  31526. */
  31527. var invert = createInverter(function(result, value, key) {
  31528. if (value != null &&
  31529. typeof value.toString != 'function') {
  31530. value = nativeObjectToString.call(value);
  31531. }
  31532. result[value] = key;
  31533. }, constant(identity));
  31534. /**
  31535. * This method is like `_.invert` except that the inverted object is generated
  31536. * from the results of running each element of `object` thru `iteratee`. The
  31537. * corresponding inverted value of each inverted key is an array of keys
  31538. * responsible for generating the inverted value. The iteratee is invoked
  31539. * with one argument: (value).
  31540. *
  31541. * @static
  31542. * @memberOf _
  31543. * @since 4.1.0
  31544. * @category Object
  31545. * @param {Object} object The object to invert.
  31546. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31547. * @returns {Object} Returns the new inverted object.
  31548. * @example
  31549. *
  31550. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31551. *
  31552. * _.invertBy(object);
  31553. * // => { '1': ['a', 'c'], '2': ['b'] }
  31554. *
  31555. * _.invertBy(object, function(value) {
  31556. * return 'group' + value;
  31557. * });
  31558. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31559. */
  31560. var invertBy = createInverter(function(result, value, key) {
  31561. if (value != null &&
  31562. typeof value.toString != 'function') {
  31563. value = nativeObjectToString.call(value);
  31564. }
  31565. if (hasOwnProperty.call(result, value)) {
  31566. result[value].push(key);
  31567. } else {
  31568. result[value] = [key];
  31569. }
  31570. }, getIteratee);
  31571. /**
  31572. * Invokes the method at `path` of `object`.
  31573. *
  31574. * @static
  31575. * @memberOf _
  31576. * @since 4.0.0
  31577. * @category Object
  31578. * @param {Object} object The object to query.
  31579. * @param {Array|string} path The path of the method to invoke.
  31580. * @param {...*} [args] The arguments to invoke the method with.
  31581. * @returns {*} Returns the result of the invoked method.
  31582. * @example
  31583. *
  31584. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31585. *
  31586. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31587. * // => [2, 3]
  31588. */
  31589. var invoke = baseRest(baseInvoke);
  31590. /**
  31591. * Creates an array of the own enumerable property names of `object`.
  31592. *
  31593. * **Note:** Non-object values are coerced to objects. See the
  31594. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31595. * for more details.
  31596. *
  31597. * @static
  31598. * @since 0.1.0
  31599. * @memberOf _
  31600. * @category Object
  31601. * @param {Object} object The object to query.
  31602. * @returns {Array} Returns the array of property names.
  31603. * @example
  31604. *
  31605. * function Foo() {
  31606. * this.a = 1;
  31607. * this.b = 2;
  31608. * }
  31609. *
  31610. * Foo.prototype.c = 3;
  31611. *
  31612. * _.keys(new Foo);
  31613. * // => ['a', 'b'] (iteration order is not guaranteed)
  31614. *
  31615. * _.keys('hi');
  31616. * // => ['0', '1']
  31617. */
  31618. function keys(object) {
  31619. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31620. }
  31621. /**
  31622. * Creates an array of the own and inherited enumerable property names of `object`.
  31623. *
  31624. * **Note:** Non-object values are coerced to objects.
  31625. *
  31626. * @static
  31627. * @memberOf _
  31628. * @since 3.0.0
  31629. * @category Object
  31630. * @param {Object} object The object to query.
  31631. * @returns {Array} Returns the array of property names.
  31632. * @example
  31633. *
  31634. * function Foo() {
  31635. * this.a = 1;
  31636. * this.b = 2;
  31637. * }
  31638. *
  31639. * Foo.prototype.c = 3;
  31640. *
  31641. * _.keysIn(new Foo);
  31642. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31643. */
  31644. function keysIn(object) {
  31645. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31646. }
  31647. /**
  31648. * The opposite of `_.mapValues`; this method creates an object with the
  31649. * same values as `object` and keys generated by running each own enumerable
  31650. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31651. * with three arguments: (value, key, object).
  31652. *
  31653. * @static
  31654. * @memberOf _
  31655. * @since 3.8.0
  31656. * @category Object
  31657. * @param {Object} object The object to iterate over.
  31658. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31659. * @returns {Object} Returns the new mapped object.
  31660. * @see _.mapValues
  31661. * @example
  31662. *
  31663. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31664. * return key + value;
  31665. * });
  31666. * // => { 'a1': 1, 'b2': 2 }
  31667. */
  31668. function mapKeys(object, iteratee) {
  31669. var result = {};
  31670. iteratee = getIteratee(iteratee, 3);
  31671. baseForOwn(object, function(value, key, object) {
  31672. baseAssignValue(result, iteratee(value, key, object), value);
  31673. });
  31674. return result;
  31675. }
  31676. /**
  31677. * Creates an object with the same keys as `object` and values generated
  31678. * by running each own enumerable string keyed property of `object` thru
  31679. * `iteratee`. The iteratee is invoked with three arguments:
  31680. * (value, key, object).
  31681. *
  31682. * @static
  31683. * @memberOf _
  31684. * @since 2.4.0
  31685. * @category Object
  31686. * @param {Object} object The object to iterate over.
  31687. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31688. * @returns {Object} Returns the new mapped object.
  31689. * @see _.mapKeys
  31690. * @example
  31691. *
  31692. * var users = {
  31693. * 'fred': { 'user': 'fred', 'age': 40 },
  31694. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31695. * };
  31696. *
  31697. * _.mapValues(users, function(o) { return o.age; });
  31698. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31699. *
  31700. * // The `_.property` iteratee shorthand.
  31701. * _.mapValues(users, 'age');
  31702. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31703. */
  31704. function mapValues(object, iteratee) {
  31705. var result = {};
  31706. iteratee = getIteratee(iteratee, 3);
  31707. baseForOwn(object, function(value, key, object) {
  31708. baseAssignValue(result, key, iteratee(value, key, object));
  31709. });
  31710. return result;
  31711. }
  31712. /**
  31713. * This method is like `_.assign` except that it recursively merges own and
  31714. * inherited enumerable string keyed properties of source objects into the
  31715. * destination object. Source properties that resolve to `undefined` are
  31716. * skipped if a destination value exists. Array and plain object properties
  31717. * are merged recursively. Other objects and value types are overridden by
  31718. * assignment. Source objects are applied from left to right. Subsequent
  31719. * sources overwrite property assignments of previous sources.
  31720. *
  31721. * **Note:** This method mutates `object`.
  31722. *
  31723. * @static
  31724. * @memberOf _
  31725. * @since 0.5.0
  31726. * @category Object
  31727. * @param {Object} object The destination object.
  31728. * @param {...Object} [sources] The source objects.
  31729. * @returns {Object} Returns `object`.
  31730. * @example
  31731. *
  31732. * var object = {
  31733. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31734. * };
  31735. *
  31736. * var other = {
  31737. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31738. * };
  31739. *
  31740. * _.merge(object, other);
  31741. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31742. */
  31743. var merge = createAssigner(function(object, source, srcIndex) {
  31744. baseMerge(object, source, srcIndex);
  31745. });
  31746. /**
  31747. * This method is like `_.merge` except that it accepts `customizer` which
  31748. * is invoked to produce the merged values of the destination and source
  31749. * properties. If `customizer` returns `undefined`, merging is handled by the
  31750. * method instead. The `customizer` is invoked with six arguments:
  31751. * (objValue, srcValue, key, object, source, stack).
  31752. *
  31753. * **Note:** This method mutates `object`.
  31754. *
  31755. * @static
  31756. * @memberOf _
  31757. * @since 4.0.0
  31758. * @category Object
  31759. * @param {Object} object The destination object.
  31760. * @param {...Object} sources The source objects.
  31761. * @param {Function} customizer The function to customize assigned values.
  31762. * @returns {Object} Returns `object`.
  31763. * @example
  31764. *
  31765. * function customizer(objValue, srcValue) {
  31766. * if (_.isArray(objValue)) {
  31767. * return objValue.concat(srcValue);
  31768. * }
  31769. * }
  31770. *
  31771. * var object = { 'a': [1], 'b': [2] };
  31772. * var other = { 'a': [3], 'b': [4] };
  31773. *
  31774. * _.mergeWith(object, other, customizer);
  31775. * // => { 'a': [1, 3], 'b': [2, 4] }
  31776. */
  31777. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31778. baseMerge(object, source, srcIndex, customizer);
  31779. });
  31780. /**
  31781. * The opposite of `_.pick`; this method creates an object composed of the
  31782. * own and inherited enumerable property paths of `object` that are not omitted.
  31783. *
  31784. * **Note:** This method is considerably slower than `_.pick`.
  31785. *
  31786. * @static
  31787. * @since 0.1.0
  31788. * @memberOf _
  31789. * @category Object
  31790. * @param {Object} object The source object.
  31791. * @param {...(string|string[])} [paths] The property paths to omit.
  31792. * @returns {Object} Returns the new object.
  31793. * @example
  31794. *
  31795. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31796. *
  31797. * _.omit(object, ['a', 'c']);
  31798. * // => { 'b': '2' }
  31799. */
  31800. var omit = flatRest(function(object, paths) {
  31801. var result = {};
  31802. if (object == null) {
  31803. return result;
  31804. }
  31805. var isDeep = false;
  31806. paths = arrayMap(paths, function(path) {
  31807. path = castPath(path, object);
  31808. isDeep || (isDeep = path.length > 1);
  31809. return path;
  31810. });
  31811. copyObject(object, getAllKeysIn(object), result);
  31812. if (isDeep) {
  31813. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31814. }
  31815. var length = paths.length;
  31816. while (length--) {
  31817. baseUnset(result, paths[length]);
  31818. }
  31819. return result;
  31820. });
  31821. /**
  31822. * The opposite of `_.pickBy`; this method creates an object composed of
  31823. * the own and inherited enumerable string keyed properties of `object` that
  31824. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31825. * arguments: (value, key).
  31826. *
  31827. * @static
  31828. * @memberOf _
  31829. * @since 4.0.0
  31830. * @category Object
  31831. * @param {Object} object The source object.
  31832. * @param {Function} [predicate=_.identity] The function invoked per property.
  31833. * @returns {Object} Returns the new object.
  31834. * @example
  31835. *
  31836. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31837. *
  31838. * _.omitBy(object, _.isNumber);
  31839. * // => { 'b': '2' }
  31840. */
  31841. function omitBy(object, predicate) {
  31842. return pickBy(object, negate(getIteratee(predicate)));
  31843. }
  31844. /**
  31845. * Creates an object composed of the picked `object` properties.
  31846. *
  31847. * @static
  31848. * @since 0.1.0
  31849. * @memberOf _
  31850. * @category Object
  31851. * @param {Object} object The source object.
  31852. * @param {...(string|string[])} [paths] The property paths to pick.
  31853. * @returns {Object} Returns the new object.
  31854. * @example
  31855. *
  31856. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31857. *
  31858. * _.pick(object, ['a', 'c']);
  31859. * // => { 'a': 1, 'c': 3 }
  31860. */
  31861. var pick = flatRest(function(object, paths) {
  31862. return object == null ? {} : basePick(object, paths);
  31863. });
  31864. /**
  31865. * Creates an object composed of the `object` properties `predicate` returns
  31866. * truthy for. The predicate is invoked with two arguments: (value, key).
  31867. *
  31868. * @static
  31869. * @memberOf _
  31870. * @since 4.0.0
  31871. * @category Object
  31872. * @param {Object} object The source object.
  31873. * @param {Function} [predicate=_.identity] The function invoked per property.
  31874. * @returns {Object} Returns the new object.
  31875. * @example
  31876. *
  31877. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31878. *
  31879. * _.pickBy(object, _.isNumber);
  31880. * // => { 'a': 1, 'c': 3 }
  31881. */
  31882. function pickBy(object, predicate) {
  31883. if (object == null) {
  31884. return {};
  31885. }
  31886. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31887. return [prop];
  31888. });
  31889. predicate = getIteratee(predicate);
  31890. return basePickBy(object, props, function(value, path) {
  31891. return predicate(value, path[0]);
  31892. });
  31893. }
  31894. /**
  31895. * This method is like `_.get` except that if the resolved value is a
  31896. * function it's invoked with the `this` binding of its parent object and
  31897. * its result is returned.
  31898. *
  31899. * @static
  31900. * @since 0.1.0
  31901. * @memberOf _
  31902. * @category Object
  31903. * @param {Object} object The object to query.
  31904. * @param {Array|string} path The path of the property to resolve.
  31905. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31906. * @returns {*} Returns the resolved value.
  31907. * @example
  31908. *
  31909. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31910. *
  31911. * _.result(object, 'a[0].b.c1');
  31912. * // => 3
  31913. *
  31914. * _.result(object, 'a[0].b.c2');
  31915. * // => 4
  31916. *
  31917. * _.result(object, 'a[0].b.c3', 'default');
  31918. * // => 'default'
  31919. *
  31920. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31921. * // => 'default'
  31922. */
  31923. function result(object, path, defaultValue) {
  31924. path = castPath(path, object);
  31925. var index = -1,
  31926. length = path.length;
  31927. // Ensure the loop is entered when path is empty.
  31928. if (!length) {
  31929. length = 1;
  31930. object = undefined;
  31931. }
  31932. while (++index < length) {
  31933. var value = object == null ? undefined : object[toKey(path[index])];
  31934. if (value === undefined) {
  31935. index = length;
  31936. value = defaultValue;
  31937. }
  31938. object = isFunction(value) ? value.call(object) : value;
  31939. }
  31940. return object;
  31941. }
  31942. /**
  31943. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31944. * it's created. Arrays are created for missing index properties while objects
  31945. * are created for all other missing properties. Use `_.setWith` to customize
  31946. * `path` creation.
  31947. *
  31948. * **Note:** This method mutates `object`.
  31949. *
  31950. * @static
  31951. * @memberOf _
  31952. * @since 3.7.0
  31953. * @category Object
  31954. * @param {Object} object The object to modify.
  31955. * @param {Array|string} path The path of the property to set.
  31956. * @param {*} value The value to set.
  31957. * @returns {Object} Returns `object`.
  31958. * @example
  31959. *
  31960. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31961. *
  31962. * _.set(object, 'a[0].b.c', 4);
  31963. * console.log(object.a[0].b.c);
  31964. * // => 4
  31965. *
  31966. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31967. * console.log(object.x[0].y.z);
  31968. * // => 5
  31969. */
  31970. function set(object, path, value) {
  31971. return object == null ? object : baseSet(object, path, value);
  31972. }
  31973. /**
  31974. * This method is like `_.set` except that it accepts `customizer` which is
  31975. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31976. * path creation is handled by the method instead. The `customizer` is invoked
  31977. * with three arguments: (nsValue, key, nsObject).
  31978. *
  31979. * **Note:** This method mutates `object`.
  31980. *
  31981. * @static
  31982. * @memberOf _
  31983. * @since 4.0.0
  31984. * @category Object
  31985. * @param {Object} object The object to modify.
  31986. * @param {Array|string} path The path of the property to set.
  31987. * @param {*} value The value to set.
  31988. * @param {Function} [customizer] The function to customize assigned values.
  31989. * @returns {Object} Returns `object`.
  31990. * @example
  31991. *
  31992. * var object = {};
  31993. *
  31994. * _.setWith(object, '[0][1]', 'a', Object);
  31995. * // => { '0': { '1': 'a' } }
  31996. */
  31997. function setWith(object, path, value, customizer) {
  31998. customizer = typeof customizer == 'function' ? customizer : undefined;
  31999. return object == null ? object : baseSet(object, path, value, customizer);
  32000. }
  32001. /**
  32002. * Creates an array of own enumerable string keyed-value pairs for `object`
  32003. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  32004. * entries are returned.
  32005. *
  32006. * @static
  32007. * @memberOf _
  32008. * @since 4.0.0
  32009. * @alias entries
  32010. * @category Object
  32011. * @param {Object} object The object to query.
  32012. * @returns {Array} Returns the key-value pairs.
  32013. * @example
  32014. *
  32015. * function Foo() {
  32016. * this.a = 1;
  32017. * this.b = 2;
  32018. * }
  32019. *
  32020. * Foo.prototype.c = 3;
  32021. *
  32022. * _.toPairs(new Foo);
  32023. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32024. */
  32025. var toPairs = createToPairs(keys);
  32026. /**
  32027. * Creates an array of own and inherited enumerable string keyed-value pairs
  32028. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32029. * or set, its entries are returned.
  32030. *
  32031. * @static
  32032. * @memberOf _
  32033. * @since 4.0.0
  32034. * @alias entriesIn
  32035. * @category Object
  32036. * @param {Object} object The object to query.
  32037. * @returns {Array} Returns the key-value pairs.
  32038. * @example
  32039. *
  32040. * function Foo() {
  32041. * this.a = 1;
  32042. * this.b = 2;
  32043. * }
  32044. *
  32045. * Foo.prototype.c = 3;
  32046. *
  32047. * _.toPairsIn(new Foo);
  32048. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32049. */
  32050. var toPairsIn = createToPairs(keysIn);
  32051. /**
  32052. * An alternative to `_.reduce`; this method transforms `object` to a new
  32053. * `accumulator` object which is the result of running each of its own
  32054. * enumerable string keyed properties thru `iteratee`, with each invocation
  32055. * potentially mutating the `accumulator` object. If `accumulator` is not
  32056. * provided, a new object with the same `[[Prototype]]` will be used. The
  32057. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32058. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32059. *
  32060. * @static
  32061. * @memberOf _
  32062. * @since 1.3.0
  32063. * @category Object
  32064. * @param {Object} object The object to iterate over.
  32065. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32066. * @param {*} [accumulator] The custom accumulator value.
  32067. * @returns {*} Returns the accumulated value.
  32068. * @example
  32069. *
  32070. * _.transform([2, 3, 4], function(result, n) {
  32071. * result.push(n *= n);
  32072. * return n % 2 == 0;
  32073. * }, []);
  32074. * // => [4, 9]
  32075. *
  32076. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32077. * (result[value] || (result[value] = [])).push(key);
  32078. * }, {});
  32079. * // => { '1': ['a', 'c'], '2': ['b'] }
  32080. */
  32081. function transform(object, iteratee, accumulator) {
  32082. var isArr = isArray(object),
  32083. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32084. iteratee = getIteratee(iteratee, 4);
  32085. if (accumulator == null) {
  32086. var Ctor = object && object.constructor;
  32087. if (isArrLike) {
  32088. accumulator = isArr ? new Ctor : [];
  32089. }
  32090. else if (isObject(object)) {
  32091. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32092. }
  32093. else {
  32094. accumulator = {};
  32095. }
  32096. }
  32097. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32098. return iteratee(accumulator, value, index, object);
  32099. });
  32100. return accumulator;
  32101. }
  32102. /**
  32103. * Removes the property at `path` of `object`.
  32104. *
  32105. * **Note:** This method mutates `object`.
  32106. *
  32107. * @static
  32108. * @memberOf _
  32109. * @since 4.0.0
  32110. * @category Object
  32111. * @param {Object} object The object to modify.
  32112. * @param {Array|string} path The path of the property to unset.
  32113. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32114. * @example
  32115. *
  32116. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32117. * _.unset(object, 'a[0].b.c');
  32118. * // => true
  32119. *
  32120. * console.log(object);
  32121. * // => { 'a': [{ 'b': {} }] };
  32122. *
  32123. * _.unset(object, ['a', '0', 'b', 'c']);
  32124. * // => true
  32125. *
  32126. * console.log(object);
  32127. * // => { 'a': [{ 'b': {} }] };
  32128. */
  32129. function unset(object, path) {
  32130. return object == null ? true : baseUnset(object, path);
  32131. }
  32132. /**
  32133. * This method is like `_.set` except that accepts `updater` to produce the
  32134. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32135. * is invoked with one argument: (value).
  32136. *
  32137. * **Note:** This method mutates `object`.
  32138. *
  32139. * @static
  32140. * @memberOf _
  32141. * @since 4.6.0
  32142. * @category Object
  32143. * @param {Object} object The object to modify.
  32144. * @param {Array|string} path The path of the property to set.
  32145. * @param {Function} updater The function to produce the updated value.
  32146. * @returns {Object} Returns `object`.
  32147. * @example
  32148. *
  32149. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32150. *
  32151. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32152. * console.log(object.a[0].b.c);
  32153. * // => 9
  32154. *
  32155. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32156. * console.log(object.x[0].y.z);
  32157. * // => 0
  32158. */
  32159. function update(object, path, updater) {
  32160. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32161. }
  32162. /**
  32163. * This method is like `_.update` except that it accepts `customizer` which is
  32164. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32165. * path creation is handled by the method instead. The `customizer` is invoked
  32166. * with three arguments: (nsValue, key, nsObject).
  32167. *
  32168. * **Note:** This method mutates `object`.
  32169. *
  32170. * @static
  32171. * @memberOf _
  32172. * @since 4.6.0
  32173. * @category Object
  32174. * @param {Object} object The object to modify.
  32175. * @param {Array|string} path The path of the property to set.
  32176. * @param {Function} updater The function to produce the updated value.
  32177. * @param {Function} [customizer] The function to customize assigned values.
  32178. * @returns {Object} Returns `object`.
  32179. * @example
  32180. *
  32181. * var object = {};
  32182. *
  32183. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32184. * // => { '0': { '1': 'a' } }
  32185. */
  32186. function updateWith(object, path, updater, customizer) {
  32187. customizer = typeof customizer == 'function' ? customizer : undefined;
  32188. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32189. }
  32190. /**
  32191. * Creates an array of the own enumerable string keyed property values of `object`.
  32192. *
  32193. * **Note:** Non-object values are coerced to objects.
  32194. *
  32195. * @static
  32196. * @since 0.1.0
  32197. * @memberOf _
  32198. * @category Object
  32199. * @param {Object} object The object to query.
  32200. * @returns {Array} Returns the array of property values.
  32201. * @example
  32202. *
  32203. * function Foo() {
  32204. * this.a = 1;
  32205. * this.b = 2;
  32206. * }
  32207. *
  32208. * Foo.prototype.c = 3;
  32209. *
  32210. * _.values(new Foo);
  32211. * // => [1, 2] (iteration order is not guaranteed)
  32212. *
  32213. * _.values('hi');
  32214. * // => ['h', 'i']
  32215. */
  32216. function values(object) {
  32217. return object == null ? [] : baseValues(object, keys(object));
  32218. }
  32219. /**
  32220. * Creates an array of the own and inherited enumerable string keyed property
  32221. * values of `object`.
  32222. *
  32223. * **Note:** Non-object values are coerced to objects.
  32224. *
  32225. * @static
  32226. * @memberOf _
  32227. * @since 3.0.0
  32228. * @category Object
  32229. * @param {Object} object The object to query.
  32230. * @returns {Array} Returns the array of property values.
  32231. * @example
  32232. *
  32233. * function Foo() {
  32234. * this.a = 1;
  32235. * this.b = 2;
  32236. * }
  32237. *
  32238. * Foo.prototype.c = 3;
  32239. *
  32240. * _.valuesIn(new Foo);
  32241. * // => [1, 2, 3] (iteration order is not guaranteed)
  32242. */
  32243. function valuesIn(object) {
  32244. return object == null ? [] : baseValues(object, keysIn(object));
  32245. }
  32246. /*------------------------------------------------------------------------*/
  32247. /**
  32248. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32249. *
  32250. * @static
  32251. * @memberOf _
  32252. * @since 4.0.0
  32253. * @category Number
  32254. * @param {number} number The number to clamp.
  32255. * @param {number} [lower] The lower bound.
  32256. * @param {number} upper The upper bound.
  32257. * @returns {number} Returns the clamped number.
  32258. * @example
  32259. *
  32260. * _.clamp(-10, -5, 5);
  32261. * // => -5
  32262. *
  32263. * _.clamp(10, -5, 5);
  32264. * // => 5
  32265. */
  32266. function clamp(number, lower, upper) {
  32267. if (upper === undefined) {
  32268. upper = lower;
  32269. lower = undefined;
  32270. }
  32271. if (upper !== undefined) {
  32272. upper = toNumber(upper);
  32273. upper = upper === upper ? upper : 0;
  32274. }
  32275. if (lower !== undefined) {
  32276. lower = toNumber(lower);
  32277. lower = lower === lower ? lower : 0;
  32278. }
  32279. return baseClamp(toNumber(number), lower, upper);
  32280. }
  32281. /**
  32282. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32283. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32284. * If `start` is greater than `end` the params are swapped to support
  32285. * negative ranges.
  32286. *
  32287. * @static
  32288. * @memberOf _
  32289. * @since 3.3.0
  32290. * @category Number
  32291. * @param {number} number The number to check.
  32292. * @param {number} [start=0] The start of the range.
  32293. * @param {number} end The end of the range.
  32294. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32295. * @see _.range, _.rangeRight
  32296. * @example
  32297. *
  32298. * _.inRange(3, 2, 4);
  32299. * // => true
  32300. *
  32301. * _.inRange(4, 8);
  32302. * // => true
  32303. *
  32304. * _.inRange(4, 2);
  32305. * // => false
  32306. *
  32307. * _.inRange(2, 2);
  32308. * // => false
  32309. *
  32310. * _.inRange(1.2, 2);
  32311. * // => true
  32312. *
  32313. * _.inRange(5.2, 4);
  32314. * // => false
  32315. *
  32316. * _.inRange(-3, -2, -6);
  32317. * // => true
  32318. */
  32319. function inRange(number, start, end) {
  32320. start = toFinite(start);
  32321. if (end === undefined) {
  32322. end = start;
  32323. start = 0;
  32324. } else {
  32325. end = toFinite(end);
  32326. }
  32327. number = toNumber(number);
  32328. return baseInRange(number, start, end);
  32329. }
  32330. /**
  32331. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32332. * If only one argument is provided a number between `0` and the given number
  32333. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32334. * floats, a floating-point number is returned instead of an integer.
  32335. *
  32336. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32337. * floating-point values which can produce unexpected results.
  32338. *
  32339. * @static
  32340. * @memberOf _
  32341. * @since 0.7.0
  32342. * @category Number
  32343. * @param {number} [lower=0] The lower bound.
  32344. * @param {number} [upper=1] The upper bound.
  32345. * @param {boolean} [floating] Specify returning a floating-point number.
  32346. * @returns {number} Returns the random number.
  32347. * @example
  32348. *
  32349. * _.random(0, 5);
  32350. * // => an integer between 0 and 5
  32351. *
  32352. * _.random(5);
  32353. * // => also an integer between 0 and 5
  32354. *
  32355. * _.random(5, true);
  32356. * // => a floating-point number between 0 and 5
  32357. *
  32358. * _.random(1.2, 5.2);
  32359. * // => a floating-point number between 1.2 and 5.2
  32360. */
  32361. function random(lower, upper, floating) {
  32362. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32363. upper = floating = undefined;
  32364. }
  32365. if (floating === undefined) {
  32366. if (typeof upper == 'boolean') {
  32367. floating = upper;
  32368. upper = undefined;
  32369. }
  32370. else if (typeof lower == 'boolean') {
  32371. floating = lower;
  32372. lower = undefined;
  32373. }
  32374. }
  32375. if (lower === undefined && upper === undefined) {
  32376. lower = 0;
  32377. upper = 1;
  32378. }
  32379. else {
  32380. lower = toFinite(lower);
  32381. if (upper === undefined) {
  32382. upper = lower;
  32383. lower = 0;
  32384. } else {
  32385. upper = toFinite(upper);
  32386. }
  32387. }
  32388. if (lower > upper) {
  32389. var temp = lower;
  32390. lower = upper;
  32391. upper = temp;
  32392. }
  32393. if (floating || lower % 1 || upper % 1) {
  32394. var rand = nativeRandom();
  32395. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32396. }
  32397. return baseRandom(lower, upper);
  32398. }
  32399. /*------------------------------------------------------------------------*/
  32400. /**
  32401. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32402. *
  32403. * @static
  32404. * @memberOf _
  32405. * @since 3.0.0
  32406. * @category String
  32407. * @param {string} [string=''] The string to convert.
  32408. * @returns {string} Returns the camel cased string.
  32409. * @example
  32410. *
  32411. * _.camelCase('Foo Bar');
  32412. * // => 'fooBar'
  32413. *
  32414. * _.camelCase('--foo-bar--');
  32415. * // => 'fooBar'
  32416. *
  32417. * _.camelCase('__FOO_BAR__');
  32418. * // => 'fooBar'
  32419. */
  32420. var camelCase = createCompounder(function(result, word, index) {
  32421. word = word.toLowerCase();
  32422. return result + (index ? capitalize(word) : word);
  32423. });
  32424. /**
  32425. * Converts the first character of `string` to upper case and the remaining
  32426. * to lower case.
  32427. *
  32428. * @static
  32429. * @memberOf _
  32430. * @since 3.0.0
  32431. * @category String
  32432. * @param {string} [string=''] The string to capitalize.
  32433. * @returns {string} Returns the capitalized string.
  32434. * @example
  32435. *
  32436. * _.capitalize('FRED');
  32437. * // => 'Fred'
  32438. */
  32439. function capitalize(string) {
  32440. return upperFirst(toString(string).toLowerCase());
  32441. }
  32442. /**
  32443. * Deburrs `string` by converting
  32444. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32445. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32446. * letters to basic Latin letters and removing
  32447. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32448. *
  32449. * @static
  32450. * @memberOf _
  32451. * @since 3.0.0
  32452. * @category String
  32453. * @param {string} [string=''] The string to deburr.
  32454. * @returns {string} Returns the deburred string.
  32455. * @example
  32456. *
  32457. * _.deburr('déjà vu');
  32458. * // => 'deja vu'
  32459. */
  32460. function deburr(string) {
  32461. string = toString(string);
  32462. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32463. }
  32464. /**
  32465. * Checks if `string` ends with the given target string.
  32466. *
  32467. * @static
  32468. * @memberOf _
  32469. * @since 3.0.0
  32470. * @category String
  32471. * @param {string} [string=''] The string to inspect.
  32472. * @param {string} [target] The string to search for.
  32473. * @param {number} [position=string.length] The position to search up to.
  32474. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32475. * else `false`.
  32476. * @example
  32477. *
  32478. * _.endsWith('abc', 'c');
  32479. * // => true
  32480. *
  32481. * _.endsWith('abc', 'b');
  32482. * // => false
  32483. *
  32484. * _.endsWith('abc', 'b', 2);
  32485. * // => true
  32486. */
  32487. function endsWith(string, target, position) {
  32488. string = toString(string);
  32489. target = baseToString(target);
  32490. var length = string.length;
  32491. position = position === undefined
  32492. ? length
  32493. : baseClamp(toInteger(position), 0, length);
  32494. var end = position;
  32495. position -= target.length;
  32496. return position >= 0 && string.slice(position, end) == target;
  32497. }
  32498. /**
  32499. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32500. * corresponding HTML entities.
  32501. *
  32502. * **Note:** No other characters are escaped. To escape additional
  32503. * characters use a third-party library like [_he_](https://mths.be/he).
  32504. *
  32505. * Though the ">" character is escaped for symmetry, characters like
  32506. * ">" and "/" don't need escaping in HTML and have no special meaning
  32507. * unless they're part of a tag or unquoted attribute value. See
  32508. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32509. * (under "semi-related fun fact") for more details.
  32510. *
  32511. * When working with HTML you should always
  32512. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32513. * XSS vectors.
  32514. *
  32515. * @static
  32516. * @since 0.1.0
  32517. * @memberOf _
  32518. * @category String
  32519. * @param {string} [string=''] The string to escape.
  32520. * @returns {string} Returns the escaped string.
  32521. * @example
  32522. *
  32523. * _.escape('fred, barney, & pebbles');
  32524. * // => 'fred, barney, &amp; pebbles'
  32525. */
  32526. function escape(string) {
  32527. string = toString(string);
  32528. return (string && reHasUnescapedHtml.test(string))
  32529. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32530. : string;
  32531. }
  32532. /**
  32533. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32534. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32535. *
  32536. * @static
  32537. * @memberOf _
  32538. * @since 3.0.0
  32539. * @category String
  32540. * @param {string} [string=''] The string to escape.
  32541. * @returns {string} Returns the escaped string.
  32542. * @example
  32543. *
  32544. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32545. * // => '\[lodash\]\(https://lodash\.com/\)'
  32546. */
  32547. function escapeRegExp(string) {
  32548. string = toString(string);
  32549. return (string && reHasRegExpChar.test(string))
  32550. ? string.replace(reRegExpChar, '\\$&')
  32551. : string;
  32552. }
  32553. /**
  32554. * Converts `string` to
  32555. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32556. *
  32557. * @static
  32558. * @memberOf _
  32559. * @since 3.0.0
  32560. * @category String
  32561. * @param {string} [string=''] The string to convert.
  32562. * @returns {string} Returns the kebab cased string.
  32563. * @example
  32564. *
  32565. * _.kebabCase('Foo Bar');
  32566. * // => 'foo-bar'
  32567. *
  32568. * _.kebabCase('fooBar');
  32569. * // => 'foo-bar'
  32570. *
  32571. * _.kebabCase('__FOO_BAR__');
  32572. * // => 'foo-bar'
  32573. */
  32574. var kebabCase = createCompounder(function(result, word, index) {
  32575. return result + (index ? '-' : '') + word.toLowerCase();
  32576. });
  32577. /**
  32578. * Converts `string`, as space separated words, to lower case.
  32579. *
  32580. * @static
  32581. * @memberOf _
  32582. * @since 4.0.0
  32583. * @category String
  32584. * @param {string} [string=''] The string to convert.
  32585. * @returns {string} Returns the lower cased string.
  32586. * @example
  32587. *
  32588. * _.lowerCase('--Foo-Bar--');
  32589. * // => 'foo bar'
  32590. *
  32591. * _.lowerCase('fooBar');
  32592. * // => 'foo bar'
  32593. *
  32594. * _.lowerCase('__FOO_BAR__');
  32595. * // => 'foo bar'
  32596. */
  32597. var lowerCase = createCompounder(function(result, word, index) {
  32598. return result + (index ? ' ' : '') + word.toLowerCase();
  32599. });
  32600. /**
  32601. * Converts the first character of `string` to lower case.
  32602. *
  32603. * @static
  32604. * @memberOf _
  32605. * @since 4.0.0
  32606. * @category String
  32607. * @param {string} [string=''] The string to convert.
  32608. * @returns {string} Returns the converted string.
  32609. * @example
  32610. *
  32611. * _.lowerFirst('Fred');
  32612. * // => 'fred'
  32613. *
  32614. * _.lowerFirst('FRED');
  32615. * // => 'fRED'
  32616. */
  32617. var lowerFirst = createCaseFirst('toLowerCase');
  32618. /**
  32619. * Pads `string` on the left and right sides if it's shorter than `length`.
  32620. * Padding characters are truncated if they can't be evenly divided by `length`.
  32621. *
  32622. * @static
  32623. * @memberOf _
  32624. * @since 3.0.0
  32625. * @category String
  32626. * @param {string} [string=''] The string to pad.
  32627. * @param {number} [length=0] The padding length.
  32628. * @param {string} [chars=' '] The string used as padding.
  32629. * @returns {string} Returns the padded string.
  32630. * @example
  32631. *
  32632. * _.pad('abc', 8);
  32633. * // => ' abc '
  32634. *
  32635. * _.pad('abc', 8, '_-');
  32636. * // => '_-abc_-_'
  32637. *
  32638. * _.pad('abc', 3);
  32639. * // => 'abc'
  32640. */
  32641. function pad(string, length, chars) {
  32642. string = toString(string);
  32643. length = toInteger(length);
  32644. var strLength = length ? stringSize(string) : 0;
  32645. if (!length || strLength >= length) {
  32646. return string;
  32647. }
  32648. var mid = (length - strLength) / 2;
  32649. return (
  32650. createPadding(nativeFloor(mid), chars) +
  32651. string +
  32652. createPadding(nativeCeil(mid), chars)
  32653. );
  32654. }
  32655. /**
  32656. * Pads `string` on the right side if it's shorter than `length`. Padding
  32657. * characters are truncated if they exceed `length`.
  32658. *
  32659. * @static
  32660. * @memberOf _
  32661. * @since 4.0.0
  32662. * @category String
  32663. * @param {string} [string=''] The string to pad.
  32664. * @param {number} [length=0] The padding length.
  32665. * @param {string} [chars=' '] The string used as padding.
  32666. * @returns {string} Returns the padded string.
  32667. * @example
  32668. *
  32669. * _.padEnd('abc', 6);
  32670. * // => 'abc '
  32671. *
  32672. * _.padEnd('abc', 6, '_-');
  32673. * // => 'abc_-_'
  32674. *
  32675. * _.padEnd('abc', 3);
  32676. * // => 'abc'
  32677. */
  32678. function padEnd(string, length, chars) {
  32679. string = toString(string);
  32680. length = toInteger(length);
  32681. var strLength = length ? stringSize(string) : 0;
  32682. return (length && strLength < length)
  32683. ? (string + createPadding(length - strLength, chars))
  32684. : string;
  32685. }
  32686. /**
  32687. * Pads `string` on the left side if it's shorter than `length`. Padding
  32688. * characters are truncated if they exceed `length`.
  32689. *
  32690. * @static
  32691. * @memberOf _
  32692. * @since 4.0.0
  32693. * @category String
  32694. * @param {string} [string=''] The string to pad.
  32695. * @param {number} [length=0] The padding length.
  32696. * @param {string} [chars=' '] The string used as padding.
  32697. * @returns {string} Returns the padded string.
  32698. * @example
  32699. *
  32700. * _.padStart('abc', 6);
  32701. * // => ' abc'
  32702. *
  32703. * _.padStart('abc', 6, '_-');
  32704. * // => '_-_abc'
  32705. *
  32706. * _.padStart('abc', 3);
  32707. * // => 'abc'
  32708. */
  32709. function padStart(string, length, chars) {
  32710. string = toString(string);
  32711. length = toInteger(length);
  32712. var strLength = length ? stringSize(string) : 0;
  32713. return (length && strLength < length)
  32714. ? (createPadding(length - strLength, chars) + string)
  32715. : string;
  32716. }
  32717. /**
  32718. * Converts `string` to an integer of the specified radix. If `radix` is
  32719. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32720. * hexadecimal, in which case a `radix` of `16` is used.
  32721. *
  32722. * **Note:** This method aligns with the
  32723. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32724. *
  32725. * @static
  32726. * @memberOf _
  32727. * @since 1.1.0
  32728. * @category String
  32729. * @param {string} string The string to convert.
  32730. * @param {number} [radix=10] The radix to interpret `value` by.
  32731. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32732. * @returns {number} Returns the converted integer.
  32733. * @example
  32734. *
  32735. * _.parseInt('08');
  32736. * // => 8
  32737. *
  32738. * _.map(['6', '08', '10'], _.parseInt);
  32739. * // => [6, 8, 10]
  32740. */
  32741. function parseInt(string, radix, guard) {
  32742. if (guard || radix == null) {
  32743. radix = 0;
  32744. } else if (radix) {
  32745. radix = +radix;
  32746. }
  32747. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32748. }
  32749. /**
  32750. * Repeats the given string `n` times.
  32751. *
  32752. * @static
  32753. * @memberOf _
  32754. * @since 3.0.0
  32755. * @category String
  32756. * @param {string} [string=''] The string to repeat.
  32757. * @param {number} [n=1] The number of times to repeat the string.
  32758. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32759. * @returns {string} Returns the repeated string.
  32760. * @example
  32761. *
  32762. * _.repeat('*', 3);
  32763. * // => '***'
  32764. *
  32765. * _.repeat('abc', 2);
  32766. * // => 'abcabc'
  32767. *
  32768. * _.repeat('abc', 0);
  32769. * // => ''
  32770. */
  32771. function repeat(string, n, guard) {
  32772. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32773. n = 1;
  32774. } else {
  32775. n = toInteger(n);
  32776. }
  32777. return baseRepeat(toString(string), n);
  32778. }
  32779. /**
  32780. * Replaces matches for `pattern` in `string` with `replacement`.
  32781. *
  32782. * **Note:** This method is based on
  32783. * [`String#replace`](https://mdn.io/String/replace).
  32784. *
  32785. * @static
  32786. * @memberOf _
  32787. * @since 4.0.0
  32788. * @category String
  32789. * @param {string} [string=''] The string to modify.
  32790. * @param {RegExp|string} pattern The pattern to replace.
  32791. * @param {Function|string} replacement The match replacement.
  32792. * @returns {string} Returns the modified string.
  32793. * @example
  32794. *
  32795. * _.replace('Hi Fred', 'Fred', 'Barney');
  32796. * // => 'Hi Barney'
  32797. */
  32798. function replace() {
  32799. var args = arguments,
  32800. string = toString(args[0]);
  32801. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32802. }
  32803. /**
  32804. * Converts `string` to
  32805. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32806. *
  32807. * @static
  32808. * @memberOf _
  32809. * @since 3.0.0
  32810. * @category String
  32811. * @param {string} [string=''] The string to convert.
  32812. * @returns {string} Returns the snake cased string.
  32813. * @example
  32814. *
  32815. * _.snakeCase('Foo Bar');
  32816. * // => 'foo_bar'
  32817. *
  32818. * _.snakeCase('fooBar');
  32819. * // => 'foo_bar'
  32820. *
  32821. * _.snakeCase('--FOO-BAR--');
  32822. * // => 'foo_bar'
  32823. */
  32824. var snakeCase = createCompounder(function(result, word, index) {
  32825. return result + (index ? '_' : '') + word.toLowerCase();
  32826. });
  32827. /**
  32828. * Splits `string` by `separator`.
  32829. *
  32830. * **Note:** This method is based on
  32831. * [`String#split`](https://mdn.io/String/split).
  32832. *
  32833. * @static
  32834. * @memberOf _
  32835. * @since 4.0.0
  32836. * @category String
  32837. * @param {string} [string=''] The string to split.
  32838. * @param {RegExp|string} separator The separator pattern to split by.
  32839. * @param {number} [limit] The length to truncate results to.
  32840. * @returns {Array} Returns the string segments.
  32841. * @example
  32842. *
  32843. * _.split('a-b-c', '-', 2);
  32844. * // => ['a', 'b']
  32845. */
  32846. function split(string, separator, limit) {
  32847. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32848. separator = limit = undefined;
  32849. }
  32850. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32851. if (!limit) {
  32852. return [];
  32853. }
  32854. string = toString(string);
  32855. if (string && (
  32856. typeof separator == 'string' ||
  32857. (separator != null && !isRegExp(separator))
  32858. )) {
  32859. separator = baseToString(separator);
  32860. if (!separator && hasUnicode(string)) {
  32861. return castSlice(stringToArray(string), 0, limit);
  32862. }
  32863. }
  32864. return string.split(separator, limit);
  32865. }
  32866. /**
  32867. * Converts `string` to
  32868. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32869. *
  32870. * @static
  32871. * @memberOf _
  32872. * @since 3.1.0
  32873. * @category String
  32874. * @param {string} [string=''] The string to convert.
  32875. * @returns {string} Returns the start cased string.
  32876. * @example
  32877. *
  32878. * _.startCase('--foo-bar--');
  32879. * // => 'Foo Bar'
  32880. *
  32881. * _.startCase('fooBar');
  32882. * // => 'Foo Bar'
  32883. *
  32884. * _.startCase('__FOO_BAR__');
  32885. * // => 'FOO BAR'
  32886. */
  32887. var startCase = createCompounder(function(result, word, index) {
  32888. return result + (index ? ' ' : '') + upperFirst(word);
  32889. });
  32890. /**
  32891. * Checks if `string` starts with the given target string.
  32892. *
  32893. * @static
  32894. * @memberOf _
  32895. * @since 3.0.0
  32896. * @category String
  32897. * @param {string} [string=''] The string to inspect.
  32898. * @param {string} [target] The string to search for.
  32899. * @param {number} [position=0] The position to search from.
  32900. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32901. * else `false`.
  32902. * @example
  32903. *
  32904. * _.startsWith('abc', 'a');
  32905. * // => true
  32906. *
  32907. * _.startsWith('abc', 'b');
  32908. * // => false
  32909. *
  32910. * _.startsWith('abc', 'b', 1);
  32911. * // => true
  32912. */
  32913. function startsWith(string, target, position) {
  32914. string = toString(string);
  32915. position = position == null
  32916. ? 0
  32917. : baseClamp(toInteger(position), 0, string.length);
  32918. target = baseToString(target);
  32919. return string.slice(position, position + target.length) == target;
  32920. }
  32921. /**
  32922. * Creates a compiled template function that can interpolate data properties
  32923. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32924. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32925. * properties may be accessed as free variables in the template. If a setting
  32926. * object is given, it takes precedence over `_.templateSettings` values.
  32927. *
  32928. * **Note:** In the development build `_.template` utilizes
  32929. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32930. * for easier debugging.
  32931. *
  32932. * For more information on precompiling templates see
  32933. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32934. *
  32935. * For more information on Chrome extension sandboxes see
  32936. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32937. *
  32938. * @static
  32939. * @since 0.1.0
  32940. * @memberOf _
  32941. * @category String
  32942. * @param {string} [string=''] The template string.
  32943. * @param {Object} [options={}] The options object.
  32944. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32945. * The HTML "escape" delimiter.
  32946. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32947. * The "evaluate" delimiter.
  32948. * @param {Object} [options.imports=_.templateSettings.imports]
  32949. * An object to import into the template as free variables.
  32950. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32951. * The "interpolate" delimiter.
  32952. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32953. * The sourceURL of the compiled template.
  32954. * @param {string} [options.variable='obj']
  32955. * The data object variable name.
  32956. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32957. * @returns {Function} Returns the compiled template function.
  32958. * @example
  32959. *
  32960. * // Use the "interpolate" delimiter to create a compiled template.
  32961. * var compiled = _.template('hello <%= user %>!');
  32962. * compiled({ 'user': 'fred' });
  32963. * // => 'hello fred!'
  32964. *
  32965. * // Use the HTML "escape" delimiter to escape data property values.
  32966. * var compiled = _.template('<b><%- value %></b>');
  32967. * compiled({ 'value': '<script>' });
  32968. * // => '<b>&lt;script&gt;</b>'
  32969. *
  32970. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32971. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32972. * compiled({ 'users': ['fred', 'barney'] });
  32973. * // => '<li>fred</li><li>barney</li>'
  32974. *
  32975. * // Use the internal `print` function in "evaluate" delimiters.
  32976. * var compiled = _.template('<% print("hello " + user); %>!');
  32977. * compiled({ 'user': 'barney' });
  32978. * // => 'hello barney!'
  32979. *
  32980. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32981. * // Disable support by replacing the "interpolate" delimiter.
  32982. * var compiled = _.template('hello ${ user }!');
  32983. * compiled({ 'user': 'pebbles' });
  32984. * // => 'hello pebbles!'
  32985. *
  32986. * // Use backslashes to treat delimiters as plain text.
  32987. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32988. * compiled({ 'value': 'ignored' });
  32989. * // => '<%- value %>'
  32990. *
  32991. * // Use the `imports` option to import `jQuery` as `jq`.
  32992. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32993. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32994. * compiled({ 'users': ['fred', 'barney'] });
  32995. * // => '<li>fred</li><li>barney</li>'
  32996. *
  32997. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32998. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32999. * compiled(data);
  33000. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  33001. *
  33002. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  33003. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  33004. * compiled.source;
  33005. * // => function(data) {
  33006. * // var __t, __p = '';
  33007. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  33008. * // return __p;
  33009. * // }
  33010. *
  33011. * // Use custom template delimiters.
  33012. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33013. * var compiled = _.template('hello {{ user }}!');
  33014. * compiled({ 'user': 'mustache' });
  33015. * // => 'hello mustache!'
  33016. *
  33017. * // Use the `source` property to inline compiled templates for meaningful
  33018. * // line numbers in error messages and stack traces.
  33019. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33020. * var JST = {\
  33021. * "main": ' + _.template(mainText).source + '\
  33022. * };\
  33023. * ');
  33024. */
  33025. function template(string, options, guard) {
  33026. // Based on John Resig's `tmpl` implementation
  33027. // (http://ejohn.org/blog/javascript-micro-templating/)
  33028. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33029. var settings = lodash.templateSettings;
  33030. if (guard && isIterateeCall(string, options, guard)) {
  33031. options = undefined;
  33032. }
  33033. string = toString(string);
  33034. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33035. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33036. importsKeys = keys(imports),
  33037. importsValues = baseValues(imports, importsKeys);
  33038. var isEscaping,
  33039. isEvaluating,
  33040. index = 0,
  33041. interpolate = options.interpolate || reNoMatch,
  33042. source = "__p += '";
  33043. // Compile the regexp to match each delimiter.
  33044. var reDelimiters = RegExp(
  33045. (options.escape || reNoMatch).source + '|' +
  33046. interpolate.source + '|' +
  33047. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33048. (options.evaluate || reNoMatch).source + '|$'
  33049. , 'g');
  33050. // Use a sourceURL for easier debugging.
  33051. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33052. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33053. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33054. var sourceURL = '//# sourceURL=' +
  33055. (hasOwnProperty.call(options, 'sourceURL')
  33056. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33057. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33058. ) + '\n';
  33059. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33060. interpolateValue || (interpolateValue = esTemplateValue);
  33061. // Escape characters that can't be included in string literals.
  33062. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33063. // Replace delimiters with snippets.
  33064. if (escapeValue) {
  33065. isEscaping = true;
  33066. source += "' +\n__e(" + escapeValue + ") +\n'";
  33067. }
  33068. if (evaluateValue) {
  33069. isEvaluating = true;
  33070. source += "';\n" + evaluateValue + ";\n__p += '";
  33071. }
  33072. if (interpolateValue) {
  33073. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33074. }
  33075. index = offset + match.length;
  33076. // The JS engine embedded in Adobe products needs `match` returned in
  33077. // order to produce the correct `offset` value.
  33078. return match;
  33079. });
  33080. source += "';\n";
  33081. // If `variable` is not specified wrap a with-statement around the generated
  33082. // code to add the data object to the top of the scope chain.
  33083. // Like with sourceURL, we take care to not check the option's prototype,
  33084. // as this configuration is a code injection vector.
  33085. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33086. if (!variable) {
  33087. source = 'with (obj) {\n' + source + '\n}\n';
  33088. }
  33089. // Cleanup code by stripping empty strings.
  33090. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33091. .replace(reEmptyStringMiddle, '$1')
  33092. .replace(reEmptyStringTrailing, '$1;');
  33093. // Frame code as the function body.
  33094. source = 'function(' + (variable || 'obj') + ') {\n' +
  33095. (variable
  33096. ? ''
  33097. : 'obj || (obj = {});\n'
  33098. ) +
  33099. "var __t, __p = ''" +
  33100. (isEscaping
  33101. ? ', __e = _.escape'
  33102. : ''
  33103. ) +
  33104. (isEvaluating
  33105. ? ', __j = Array.prototype.join;\n' +
  33106. "function print() { __p += __j.call(arguments, '') }\n"
  33107. : ';\n'
  33108. ) +
  33109. source +
  33110. 'return __p\n}';
  33111. var result = attempt(function() {
  33112. return Function(importsKeys, sourceURL + 'return ' + source)
  33113. .apply(undefined, importsValues);
  33114. });
  33115. // Provide the compiled function's source by its `toString` method or
  33116. // the `source` property as a convenience for inlining compiled templates.
  33117. result.source = source;
  33118. if (isError(result)) {
  33119. throw result;
  33120. }
  33121. return result;
  33122. }
  33123. /**
  33124. * Converts `string`, as a whole, to lower case just like
  33125. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33126. *
  33127. * @static
  33128. * @memberOf _
  33129. * @since 4.0.0
  33130. * @category String
  33131. * @param {string} [string=''] The string to convert.
  33132. * @returns {string} Returns the lower cased string.
  33133. * @example
  33134. *
  33135. * _.toLower('--Foo-Bar--');
  33136. * // => '--foo-bar--'
  33137. *
  33138. * _.toLower('fooBar');
  33139. * // => 'foobar'
  33140. *
  33141. * _.toLower('__FOO_BAR__');
  33142. * // => '__foo_bar__'
  33143. */
  33144. function toLower(value) {
  33145. return toString(value).toLowerCase();
  33146. }
  33147. /**
  33148. * Converts `string`, as a whole, to upper case just like
  33149. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33150. *
  33151. * @static
  33152. * @memberOf _
  33153. * @since 4.0.0
  33154. * @category String
  33155. * @param {string} [string=''] The string to convert.
  33156. * @returns {string} Returns the upper cased string.
  33157. * @example
  33158. *
  33159. * _.toUpper('--foo-bar--');
  33160. * // => '--FOO-BAR--'
  33161. *
  33162. * _.toUpper('fooBar');
  33163. * // => 'FOOBAR'
  33164. *
  33165. * _.toUpper('__foo_bar__');
  33166. * // => '__FOO_BAR__'
  33167. */
  33168. function toUpper(value) {
  33169. return toString(value).toUpperCase();
  33170. }
  33171. /**
  33172. * Removes leading and trailing whitespace or specified characters from `string`.
  33173. *
  33174. * @static
  33175. * @memberOf _
  33176. * @since 3.0.0
  33177. * @category String
  33178. * @param {string} [string=''] The string to trim.
  33179. * @param {string} [chars=whitespace] The characters to trim.
  33180. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33181. * @returns {string} Returns the trimmed string.
  33182. * @example
  33183. *
  33184. * _.trim(' abc ');
  33185. * // => 'abc'
  33186. *
  33187. * _.trim('-_-abc-_-', '_-');
  33188. * // => 'abc'
  33189. *
  33190. * _.map([' foo ', ' bar '], _.trim);
  33191. * // => ['foo', 'bar']
  33192. */
  33193. function trim(string, chars, guard) {
  33194. string = toString(string);
  33195. if (string && (guard || chars === undefined)) {
  33196. return string.replace(reTrim, '');
  33197. }
  33198. if (!string || !(chars = baseToString(chars))) {
  33199. return string;
  33200. }
  33201. var strSymbols = stringToArray(string),
  33202. chrSymbols = stringToArray(chars),
  33203. start = charsStartIndex(strSymbols, chrSymbols),
  33204. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33205. return castSlice(strSymbols, start, end).join('');
  33206. }
  33207. /**
  33208. * Removes trailing whitespace or specified characters from `string`.
  33209. *
  33210. * @static
  33211. * @memberOf _
  33212. * @since 4.0.0
  33213. * @category String
  33214. * @param {string} [string=''] The string to trim.
  33215. * @param {string} [chars=whitespace] The characters to trim.
  33216. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33217. * @returns {string} Returns the trimmed string.
  33218. * @example
  33219. *
  33220. * _.trimEnd(' abc ');
  33221. * // => ' abc'
  33222. *
  33223. * _.trimEnd('-_-abc-_-', '_-');
  33224. * // => '-_-abc'
  33225. */
  33226. function trimEnd(string, chars, guard) {
  33227. string = toString(string);
  33228. if (string && (guard || chars === undefined)) {
  33229. return string.replace(reTrimEnd, '');
  33230. }
  33231. if (!string || !(chars = baseToString(chars))) {
  33232. return string;
  33233. }
  33234. var strSymbols = stringToArray(string),
  33235. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33236. return castSlice(strSymbols, 0, end).join('');
  33237. }
  33238. /**
  33239. * Removes leading whitespace or specified characters from `string`.
  33240. *
  33241. * @static
  33242. * @memberOf _
  33243. * @since 4.0.0
  33244. * @category String
  33245. * @param {string} [string=''] The string to trim.
  33246. * @param {string} [chars=whitespace] The characters to trim.
  33247. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33248. * @returns {string} Returns the trimmed string.
  33249. * @example
  33250. *
  33251. * _.trimStart(' abc ');
  33252. * // => 'abc '
  33253. *
  33254. * _.trimStart('-_-abc-_-', '_-');
  33255. * // => 'abc-_-'
  33256. */
  33257. function trimStart(string, chars, guard) {
  33258. string = toString(string);
  33259. if (string && (guard || chars === undefined)) {
  33260. return string.replace(reTrimStart, '');
  33261. }
  33262. if (!string || !(chars = baseToString(chars))) {
  33263. return string;
  33264. }
  33265. var strSymbols = stringToArray(string),
  33266. start = charsStartIndex(strSymbols, stringToArray(chars));
  33267. return castSlice(strSymbols, start).join('');
  33268. }
  33269. /**
  33270. * Truncates `string` if it's longer than the given maximum string length.
  33271. * The last characters of the truncated string are replaced with the omission
  33272. * string which defaults to "...".
  33273. *
  33274. * @static
  33275. * @memberOf _
  33276. * @since 4.0.0
  33277. * @category String
  33278. * @param {string} [string=''] The string to truncate.
  33279. * @param {Object} [options={}] The options object.
  33280. * @param {number} [options.length=30] The maximum string length.
  33281. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33282. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33283. * @returns {string} Returns the truncated string.
  33284. * @example
  33285. *
  33286. * _.truncate('hi-diddly-ho there, neighborino');
  33287. * // => 'hi-diddly-ho there, neighbo...'
  33288. *
  33289. * _.truncate('hi-diddly-ho there, neighborino', {
  33290. * 'length': 24,
  33291. * 'separator': ' '
  33292. * });
  33293. * // => 'hi-diddly-ho there,...'
  33294. *
  33295. * _.truncate('hi-diddly-ho there, neighborino', {
  33296. * 'length': 24,
  33297. * 'separator': /,? +/
  33298. * });
  33299. * // => 'hi-diddly-ho there...'
  33300. *
  33301. * _.truncate('hi-diddly-ho there, neighborino', {
  33302. * 'omission': ' [...]'
  33303. * });
  33304. * // => 'hi-diddly-ho there, neig [...]'
  33305. */
  33306. function truncate(string, options) {
  33307. var length = DEFAULT_TRUNC_LENGTH,
  33308. omission = DEFAULT_TRUNC_OMISSION;
  33309. if (isObject(options)) {
  33310. var separator = 'separator' in options ? options.separator : separator;
  33311. length = 'length' in options ? toInteger(options.length) : length;
  33312. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33313. }
  33314. string = toString(string);
  33315. var strLength = string.length;
  33316. if (hasUnicode(string)) {
  33317. var strSymbols = stringToArray(string);
  33318. strLength = strSymbols.length;
  33319. }
  33320. if (length >= strLength) {
  33321. return string;
  33322. }
  33323. var end = length - stringSize(omission);
  33324. if (end < 1) {
  33325. return omission;
  33326. }
  33327. var result = strSymbols
  33328. ? castSlice(strSymbols, 0, end).join('')
  33329. : string.slice(0, end);
  33330. if (separator === undefined) {
  33331. return result + omission;
  33332. }
  33333. if (strSymbols) {
  33334. end += (result.length - end);
  33335. }
  33336. if (isRegExp(separator)) {
  33337. if (string.slice(end).search(separator)) {
  33338. var match,
  33339. substring = result;
  33340. if (!separator.global) {
  33341. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33342. }
  33343. separator.lastIndex = 0;
  33344. while ((match = separator.exec(substring))) {
  33345. var newEnd = match.index;
  33346. }
  33347. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33348. }
  33349. } else if (string.indexOf(baseToString(separator), end) != end) {
  33350. var index = result.lastIndexOf(separator);
  33351. if (index > -1) {
  33352. result = result.slice(0, index);
  33353. }
  33354. }
  33355. return result + omission;
  33356. }
  33357. /**
  33358. * The inverse of `_.escape`; this method converts the HTML entities
  33359. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33360. * their corresponding characters.
  33361. *
  33362. * **Note:** No other HTML entities are unescaped. To unescape additional
  33363. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33364. *
  33365. * @static
  33366. * @memberOf _
  33367. * @since 0.6.0
  33368. * @category String
  33369. * @param {string} [string=''] The string to unescape.
  33370. * @returns {string} Returns the unescaped string.
  33371. * @example
  33372. *
  33373. * _.unescape('fred, barney, &amp; pebbles');
  33374. * // => 'fred, barney, & pebbles'
  33375. */
  33376. function unescape(string) {
  33377. string = toString(string);
  33378. return (string && reHasEscapedHtml.test(string))
  33379. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33380. : string;
  33381. }
  33382. /**
  33383. * Converts `string`, as space separated words, to upper case.
  33384. *
  33385. * @static
  33386. * @memberOf _
  33387. * @since 4.0.0
  33388. * @category String
  33389. * @param {string} [string=''] The string to convert.
  33390. * @returns {string} Returns the upper cased string.
  33391. * @example
  33392. *
  33393. * _.upperCase('--foo-bar');
  33394. * // => 'FOO BAR'
  33395. *
  33396. * _.upperCase('fooBar');
  33397. * // => 'FOO BAR'
  33398. *
  33399. * _.upperCase('__foo_bar__');
  33400. * // => 'FOO BAR'
  33401. */
  33402. var upperCase = createCompounder(function(result, word, index) {
  33403. return result + (index ? ' ' : '') + word.toUpperCase();
  33404. });
  33405. /**
  33406. * Converts the first character of `string` to upper case.
  33407. *
  33408. * @static
  33409. * @memberOf _
  33410. * @since 4.0.0
  33411. * @category String
  33412. * @param {string} [string=''] The string to convert.
  33413. * @returns {string} Returns the converted string.
  33414. * @example
  33415. *
  33416. * _.upperFirst('fred');
  33417. * // => 'Fred'
  33418. *
  33419. * _.upperFirst('FRED');
  33420. * // => 'FRED'
  33421. */
  33422. var upperFirst = createCaseFirst('toUpperCase');
  33423. /**
  33424. * Splits `string` into an array of its words.
  33425. *
  33426. * @static
  33427. * @memberOf _
  33428. * @since 3.0.0
  33429. * @category String
  33430. * @param {string} [string=''] The string to inspect.
  33431. * @param {RegExp|string} [pattern] The pattern to match words.
  33432. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33433. * @returns {Array} Returns the words of `string`.
  33434. * @example
  33435. *
  33436. * _.words('fred, barney, & pebbles');
  33437. * // => ['fred', 'barney', 'pebbles']
  33438. *
  33439. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33440. * // => ['fred', 'barney', '&', 'pebbles']
  33441. */
  33442. function words(string, pattern, guard) {
  33443. string = toString(string);
  33444. pattern = guard ? undefined : pattern;
  33445. if (pattern === undefined) {
  33446. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33447. }
  33448. return string.match(pattern) || [];
  33449. }
  33450. /*------------------------------------------------------------------------*/
  33451. /**
  33452. * Attempts to invoke `func`, returning either the result or the caught error
  33453. * object. Any additional arguments are provided to `func` when it's invoked.
  33454. *
  33455. * @static
  33456. * @memberOf _
  33457. * @since 3.0.0
  33458. * @category Util
  33459. * @param {Function} func The function to attempt.
  33460. * @param {...*} [args] The arguments to invoke `func` with.
  33461. * @returns {*} Returns the `func` result or error object.
  33462. * @example
  33463. *
  33464. * // Avoid throwing errors for invalid selectors.
  33465. * var elements = _.attempt(function(selector) {
  33466. * return document.querySelectorAll(selector);
  33467. * }, '>_>');
  33468. *
  33469. * if (_.isError(elements)) {
  33470. * elements = [];
  33471. * }
  33472. */
  33473. var attempt = baseRest(function(func, args) {
  33474. try {
  33475. return apply(func, undefined, args);
  33476. } catch (e) {
  33477. return isError(e) ? e : new Error(e);
  33478. }
  33479. });
  33480. /**
  33481. * Binds methods of an object to the object itself, overwriting the existing
  33482. * method.
  33483. *
  33484. * **Note:** This method doesn't set the "length" property of bound functions.
  33485. *
  33486. * @static
  33487. * @since 0.1.0
  33488. * @memberOf _
  33489. * @category Util
  33490. * @param {Object} object The object to bind and assign the bound methods to.
  33491. * @param {...(string|string[])} methodNames The object method names to bind.
  33492. * @returns {Object} Returns `object`.
  33493. * @example
  33494. *
  33495. * var view = {
  33496. * 'label': 'docs',
  33497. * 'click': function() {
  33498. * console.log('clicked ' + this.label);
  33499. * }
  33500. * };
  33501. *
  33502. * _.bindAll(view, ['click']);
  33503. * jQuery(element).on('click', view.click);
  33504. * // => Logs 'clicked docs' when clicked.
  33505. */
  33506. var bindAll = flatRest(function(object, methodNames) {
  33507. arrayEach(methodNames, function(key) {
  33508. key = toKey(key);
  33509. baseAssignValue(object, key, bind(object[key], object));
  33510. });
  33511. return object;
  33512. });
  33513. /**
  33514. * Creates a function that iterates over `pairs` and invokes the corresponding
  33515. * function of the first predicate to return truthy. The predicate-function
  33516. * pairs are invoked with the `this` binding and arguments of the created
  33517. * function.
  33518. *
  33519. * @static
  33520. * @memberOf _
  33521. * @since 4.0.0
  33522. * @category Util
  33523. * @param {Array} pairs The predicate-function pairs.
  33524. * @returns {Function} Returns the new composite function.
  33525. * @example
  33526. *
  33527. * var func = _.cond([
  33528. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33529. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33530. * [_.stubTrue, _.constant('no match')]
  33531. * ]);
  33532. *
  33533. * func({ 'a': 1, 'b': 2 });
  33534. * // => 'matches A'
  33535. *
  33536. * func({ 'a': 0, 'b': 1 });
  33537. * // => 'matches B'
  33538. *
  33539. * func({ 'a': '1', 'b': '2' });
  33540. * // => 'no match'
  33541. */
  33542. function cond(pairs) {
  33543. var length = pairs == null ? 0 : pairs.length,
  33544. toIteratee = getIteratee();
  33545. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33546. if (typeof pair[1] != 'function') {
  33547. throw new TypeError(FUNC_ERROR_TEXT);
  33548. }
  33549. return [toIteratee(pair[0]), pair[1]];
  33550. });
  33551. return baseRest(function(args) {
  33552. var index = -1;
  33553. while (++index < length) {
  33554. var pair = pairs[index];
  33555. if (apply(pair[0], this, args)) {
  33556. return apply(pair[1], this, args);
  33557. }
  33558. }
  33559. });
  33560. }
  33561. /**
  33562. * Creates a function that invokes the predicate properties of `source` with
  33563. * the corresponding property values of a given object, returning `true` if
  33564. * all predicates return truthy, else `false`.
  33565. *
  33566. * **Note:** The created function is equivalent to `_.conformsTo` with
  33567. * `source` partially applied.
  33568. *
  33569. * @static
  33570. * @memberOf _
  33571. * @since 4.0.0
  33572. * @category Util
  33573. * @param {Object} source The object of property predicates to conform to.
  33574. * @returns {Function} Returns the new spec function.
  33575. * @example
  33576. *
  33577. * var objects = [
  33578. * { 'a': 2, 'b': 1 },
  33579. * { 'a': 1, 'b': 2 }
  33580. * ];
  33581. *
  33582. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33583. * // => [{ 'a': 1, 'b': 2 }]
  33584. */
  33585. function conforms(source) {
  33586. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33587. }
  33588. /**
  33589. * Creates a function that returns `value`.
  33590. *
  33591. * @static
  33592. * @memberOf _
  33593. * @since 2.4.0
  33594. * @category Util
  33595. * @param {*} value The value to return from the new function.
  33596. * @returns {Function} Returns the new constant function.
  33597. * @example
  33598. *
  33599. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33600. *
  33601. * console.log(objects);
  33602. * // => [{ 'a': 1 }, { 'a': 1 }]
  33603. *
  33604. * console.log(objects[0] === objects[1]);
  33605. * // => true
  33606. */
  33607. function constant(value) {
  33608. return function() {
  33609. return value;
  33610. };
  33611. }
  33612. /**
  33613. * Checks `value` to determine whether a default value should be returned in
  33614. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33615. * or `undefined`.
  33616. *
  33617. * @static
  33618. * @memberOf _
  33619. * @since 4.14.0
  33620. * @category Util
  33621. * @param {*} value The value to check.
  33622. * @param {*} defaultValue The default value.
  33623. * @returns {*} Returns the resolved value.
  33624. * @example
  33625. *
  33626. * _.defaultTo(1, 10);
  33627. * // => 1
  33628. *
  33629. * _.defaultTo(undefined, 10);
  33630. * // => 10
  33631. */
  33632. function defaultTo(value, defaultValue) {
  33633. return (value == null || value !== value) ? defaultValue : value;
  33634. }
  33635. /**
  33636. * Creates a function that returns the result of invoking the given functions
  33637. * with the `this` binding of the created function, where each successive
  33638. * invocation is supplied the return value of the previous.
  33639. *
  33640. * @static
  33641. * @memberOf _
  33642. * @since 3.0.0
  33643. * @category Util
  33644. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33645. * @returns {Function} Returns the new composite function.
  33646. * @see _.flowRight
  33647. * @example
  33648. *
  33649. * function square(n) {
  33650. * return n * n;
  33651. * }
  33652. *
  33653. * var addSquare = _.flow([_.add, square]);
  33654. * addSquare(1, 2);
  33655. * // => 9
  33656. */
  33657. var flow = createFlow();
  33658. /**
  33659. * This method is like `_.flow` except that it creates a function that
  33660. * invokes the given functions from right to left.
  33661. *
  33662. * @static
  33663. * @since 3.0.0
  33664. * @memberOf _
  33665. * @category Util
  33666. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33667. * @returns {Function} Returns the new composite function.
  33668. * @see _.flow
  33669. * @example
  33670. *
  33671. * function square(n) {
  33672. * return n * n;
  33673. * }
  33674. *
  33675. * var addSquare = _.flowRight([square, _.add]);
  33676. * addSquare(1, 2);
  33677. * // => 9
  33678. */
  33679. var flowRight = createFlow(true);
  33680. /**
  33681. * This method returns the first argument it receives.
  33682. *
  33683. * @static
  33684. * @since 0.1.0
  33685. * @memberOf _
  33686. * @category Util
  33687. * @param {*} value Any value.
  33688. * @returns {*} Returns `value`.
  33689. * @example
  33690. *
  33691. * var object = { 'a': 1 };
  33692. *
  33693. * console.log(_.identity(object) === object);
  33694. * // => true
  33695. */
  33696. function identity(value) {
  33697. return value;
  33698. }
  33699. /**
  33700. * Creates a function that invokes `func` with the arguments of the created
  33701. * function. If `func` is a property name, the created function returns the
  33702. * property value for a given element. If `func` is an array or object, the
  33703. * created function returns `true` for elements that contain the equivalent
  33704. * source properties, otherwise it returns `false`.
  33705. *
  33706. * @static
  33707. * @since 4.0.0
  33708. * @memberOf _
  33709. * @category Util
  33710. * @param {*} [func=_.identity] The value to convert to a callback.
  33711. * @returns {Function} Returns the callback.
  33712. * @example
  33713. *
  33714. * var users = [
  33715. * { 'user': 'barney', 'age': 36, 'active': true },
  33716. * { 'user': 'fred', 'age': 40, 'active': false }
  33717. * ];
  33718. *
  33719. * // The `_.matches` iteratee shorthand.
  33720. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33721. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33722. *
  33723. * // The `_.matchesProperty` iteratee shorthand.
  33724. * _.filter(users, _.iteratee(['user', 'fred']));
  33725. * // => [{ 'user': 'fred', 'age': 40 }]
  33726. *
  33727. * // The `_.property` iteratee shorthand.
  33728. * _.map(users, _.iteratee('user'));
  33729. * // => ['barney', 'fred']
  33730. *
  33731. * // Create custom iteratee shorthands.
  33732. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33733. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33734. * return func.test(string);
  33735. * };
  33736. * });
  33737. *
  33738. * _.filter(['abc', 'def'], /ef/);
  33739. * // => ['def']
  33740. */
  33741. function iteratee(func) {
  33742. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33743. }
  33744. /**
  33745. * Creates a function that performs a partial deep comparison between a given
  33746. * object and `source`, returning `true` if the given object has equivalent
  33747. * property values, else `false`.
  33748. *
  33749. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33750. * partially applied.
  33751. *
  33752. * Partial comparisons will match empty array and empty object `source`
  33753. * values against any array or object value, respectively. See `_.isEqual`
  33754. * for a list of supported value comparisons.
  33755. *
  33756. * @static
  33757. * @memberOf _
  33758. * @since 3.0.0
  33759. * @category Util
  33760. * @param {Object} source The object of property values to match.
  33761. * @returns {Function} Returns the new spec function.
  33762. * @example
  33763. *
  33764. * var objects = [
  33765. * { 'a': 1, 'b': 2, 'c': 3 },
  33766. * { 'a': 4, 'b': 5, 'c': 6 }
  33767. * ];
  33768. *
  33769. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33770. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33771. */
  33772. function matches(source) {
  33773. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33774. }
  33775. /**
  33776. * Creates a function that performs a partial deep comparison between the
  33777. * value at `path` of a given object to `srcValue`, returning `true` if the
  33778. * object value is equivalent, else `false`.
  33779. *
  33780. * **Note:** Partial comparisons will match empty array and empty object
  33781. * `srcValue` values against any array or object value, respectively. See
  33782. * `_.isEqual` for a list of supported value comparisons.
  33783. *
  33784. * @static
  33785. * @memberOf _
  33786. * @since 3.2.0
  33787. * @category Util
  33788. * @param {Array|string} path The path of the property to get.
  33789. * @param {*} srcValue The value to match.
  33790. * @returns {Function} Returns the new spec function.
  33791. * @example
  33792. *
  33793. * var objects = [
  33794. * { 'a': 1, 'b': 2, 'c': 3 },
  33795. * { 'a': 4, 'b': 5, 'c': 6 }
  33796. * ];
  33797. *
  33798. * _.find(objects, _.matchesProperty('a', 4));
  33799. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33800. */
  33801. function matchesProperty(path, srcValue) {
  33802. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33803. }
  33804. /**
  33805. * Creates a function that invokes the method at `path` of a given object.
  33806. * Any additional arguments are provided to the invoked method.
  33807. *
  33808. * @static
  33809. * @memberOf _
  33810. * @since 3.7.0
  33811. * @category Util
  33812. * @param {Array|string} path The path of the method to invoke.
  33813. * @param {...*} [args] The arguments to invoke the method with.
  33814. * @returns {Function} Returns the new invoker function.
  33815. * @example
  33816. *
  33817. * var objects = [
  33818. * { 'a': { 'b': _.constant(2) } },
  33819. * { 'a': { 'b': _.constant(1) } }
  33820. * ];
  33821. *
  33822. * _.map(objects, _.method('a.b'));
  33823. * // => [2, 1]
  33824. *
  33825. * _.map(objects, _.method(['a', 'b']));
  33826. * // => [2, 1]
  33827. */
  33828. var method = baseRest(function(path, args) {
  33829. return function(object) {
  33830. return baseInvoke(object, path, args);
  33831. };
  33832. });
  33833. /**
  33834. * The opposite of `_.method`; this method creates a function that invokes
  33835. * the method at a given path of `object`. Any additional arguments are
  33836. * provided to the invoked method.
  33837. *
  33838. * @static
  33839. * @memberOf _
  33840. * @since 3.7.0
  33841. * @category Util
  33842. * @param {Object} object The object to query.
  33843. * @param {...*} [args] The arguments to invoke the method with.
  33844. * @returns {Function} Returns the new invoker function.
  33845. * @example
  33846. *
  33847. * var array = _.times(3, _.constant),
  33848. * object = { 'a': array, 'b': array, 'c': array };
  33849. *
  33850. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33851. * // => [2, 0]
  33852. *
  33853. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33854. * // => [2, 0]
  33855. */
  33856. var methodOf = baseRest(function(object, args) {
  33857. return function(path) {
  33858. return baseInvoke(object, path, args);
  33859. };
  33860. });
  33861. /**
  33862. * Adds all own enumerable string keyed function properties of a source
  33863. * object to the destination object. If `object` is a function, then methods
  33864. * are added to its prototype as well.
  33865. *
  33866. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33867. * avoid conflicts caused by modifying the original.
  33868. *
  33869. * @static
  33870. * @since 0.1.0
  33871. * @memberOf _
  33872. * @category Util
  33873. * @param {Function|Object} [object=lodash] The destination object.
  33874. * @param {Object} source The object of functions to add.
  33875. * @param {Object} [options={}] The options object.
  33876. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33877. * @returns {Function|Object} Returns `object`.
  33878. * @example
  33879. *
  33880. * function vowels(string) {
  33881. * return _.filter(string, function(v) {
  33882. * return /[aeiou]/i.test(v);
  33883. * });
  33884. * }
  33885. *
  33886. * _.mixin({ 'vowels': vowels });
  33887. * _.vowels('fred');
  33888. * // => ['e']
  33889. *
  33890. * _('fred').vowels().value();
  33891. * // => ['e']
  33892. *
  33893. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33894. * _('fred').vowels();
  33895. * // => ['e']
  33896. */
  33897. function mixin(object, source, options) {
  33898. var props = keys(source),
  33899. methodNames = baseFunctions(source, props);
  33900. if (options == null &&
  33901. !(isObject(source) && (methodNames.length || !props.length))) {
  33902. options = source;
  33903. source = object;
  33904. object = this;
  33905. methodNames = baseFunctions(source, keys(source));
  33906. }
  33907. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33908. isFunc = isFunction(object);
  33909. arrayEach(methodNames, function(methodName) {
  33910. var func = source[methodName];
  33911. object[methodName] = func;
  33912. if (isFunc) {
  33913. object.prototype[methodName] = function() {
  33914. var chainAll = this.__chain__;
  33915. if (chain || chainAll) {
  33916. var result = object(this.__wrapped__),
  33917. actions = result.__actions__ = copyArray(this.__actions__);
  33918. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33919. result.__chain__ = chainAll;
  33920. return result;
  33921. }
  33922. return func.apply(object, arrayPush([this.value()], arguments));
  33923. };
  33924. }
  33925. });
  33926. return object;
  33927. }
  33928. /**
  33929. * Reverts the `_` variable to its previous value and returns a reference to
  33930. * the `lodash` function.
  33931. *
  33932. * @static
  33933. * @since 0.1.0
  33934. * @memberOf _
  33935. * @category Util
  33936. * @returns {Function} Returns the `lodash` function.
  33937. * @example
  33938. *
  33939. * var lodash = _.noConflict();
  33940. */
  33941. function noConflict() {
  33942. if (root._ === this) {
  33943. root._ = oldDash;
  33944. }
  33945. return this;
  33946. }
  33947. /**
  33948. * This method returns `undefined`.
  33949. *
  33950. * @static
  33951. * @memberOf _
  33952. * @since 2.3.0
  33953. * @category Util
  33954. * @example
  33955. *
  33956. * _.times(2, _.noop);
  33957. * // => [undefined, undefined]
  33958. */
  33959. function noop() {
  33960. // No operation performed.
  33961. }
  33962. /**
  33963. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33964. * the nth argument from the end is returned.
  33965. *
  33966. * @static
  33967. * @memberOf _
  33968. * @since 4.0.0
  33969. * @category Util
  33970. * @param {number} [n=0] The index of the argument to return.
  33971. * @returns {Function} Returns the new pass-thru function.
  33972. * @example
  33973. *
  33974. * var func = _.nthArg(1);
  33975. * func('a', 'b', 'c', 'd');
  33976. * // => 'b'
  33977. *
  33978. * var func = _.nthArg(-2);
  33979. * func('a', 'b', 'c', 'd');
  33980. * // => 'c'
  33981. */
  33982. function nthArg(n) {
  33983. n = toInteger(n);
  33984. return baseRest(function(args) {
  33985. return baseNth(args, n);
  33986. });
  33987. }
  33988. /**
  33989. * Creates a function that invokes `iteratees` with the arguments it receives
  33990. * and returns their results.
  33991. *
  33992. * @static
  33993. * @memberOf _
  33994. * @since 4.0.0
  33995. * @category Util
  33996. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33997. * The iteratees to invoke.
  33998. * @returns {Function} Returns the new function.
  33999. * @example
  34000. *
  34001. * var func = _.over([Math.max, Math.min]);
  34002. *
  34003. * func(1, 2, 3, 4);
  34004. * // => [4, 1]
  34005. */
  34006. var over = createOver(arrayMap);
  34007. /**
  34008. * Creates a function that checks if **all** of the `predicates` return
  34009. * truthy when invoked with the arguments it receives.
  34010. *
  34011. * @static
  34012. * @memberOf _
  34013. * @since 4.0.0
  34014. * @category Util
  34015. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34016. * The predicates to check.
  34017. * @returns {Function} Returns the new function.
  34018. * @example
  34019. *
  34020. * var func = _.overEvery([Boolean, isFinite]);
  34021. *
  34022. * func('1');
  34023. * // => true
  34024. *
  34025. * func(null);
  34026. * // => false
  34027. *
  34028. * func(NaN);
  34029. * // => false
  34030. */
  34031. var overEvery = createOver(arrayEvery);
  34032. /**
  34033. * Creates a function that checks if **any** of the `predicates` return
  34034. * truthy when invoked with the arguments it receives.
  34035. *
  34036. * @static
  34037. * @memberOf _
  34038. * @since 4.0.0
  34039. * @category Util
  34040. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34041. * The predicates to check.
  34042. * @returns {Function} Returns the new function.
  34043. * @example
  34044. *
  34045. * var func = _.overSome([Boolean, isFinite]);
  34046. *
  34047. * func('1');
  34048. * // => true
  34049. *
  34050. * func(null);
  34051. * // => true
  34052. *
  34053. * func(NaN);
  34054. * // => false
  34055. */
  34056. var overSome = createOver(arraySome);
  34057. /**
  34058. * Creates a function that returns the value at `path` of a given object.
  34059. *
  34060. * @static
  34061. * @memberOf _
  34062. * @since 2.4.0
  34063. * @category Util
  34064. * @param {Array|string} path The path of the property to get.
  34065. * @returns {Function} Returns the new accessor function.
  34066. * @example
  34067. *
  34068. * var objects = [
  34069. * { 'a': { 'b': 2 } },
  34070. * { 'a': { 'b': 1 } }
  34071. * ];
  34072. *
  34073. * _.map(objects, _.property('a.b'));
  34074. * // => [2, 1]
  34075. *
  34076. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34077. * // => [1, 2]
  34078. */
  34079. function property(path) {
  34080. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34081. }
  34082. /**
  34083. * The opposite of `_.property`; this method creates a function that returns
  34084. * the value at a given path of `object`.
  34085. *
  34086. * @static
  34087. * @memberOf _
  34088. * @since 3.0.0
  34089. * @category Util
  34090. * @param {Object} object The object to query.
  34091. * @returns {Function} Returns the new accessor function.
  34092. * @example
  34093. *
  34094. * var array = [0, 1, 2],
  34095. * object = { 'a': array, 'b': array, 'c': array };
  34096. *
  34097. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34098. * // => [2, 0]
  34099. *
  34100. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34101. * // => [2, 0]
  34102. */
  34103. function propertyOf(object) {
  34104. return function(path) {
  34105. return object == null ? undefined : baseGet(object, path);
  34106. };
  34107. }
  34108. /**
  34109. * Creates an array of numbers (positive and/or negative) progressing from
  34110. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34111. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34112. * it's set to `start` with `start` then set to `0`.
  34113. *
  34114. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34115. * floating-point values which can produce unexpected results.
  34116. *
  34117. * @static
  34118. * @since 0.1.0
  34119. * @memberOf _
  34120. * @category Util
  34121. * @param {number} [start=0] The start of the range.
  34122. * @param {number} end The end of the range.
  34123. * @param {number} [step=1] The value to increment or decrement by.
  34124. * @returns {Array} Returns the range of numbers.
  34125. * @see _.inRange, _.rangeRight
  34126. * @example
  34127. *
  34128. * _.range(4);
  34129. * // => [0, 1, 2, 3]
  34130. *
  34131. * _.range(-4);
  34132. * // => [0, -1, -2, -3]
  34133. *
  34134. * _.range(1, 5);
  34135. * // => [1, 2, 3, 4]
  34136. *
  34137. * _.range(0, 20, 5);
  34138. * // => [0, 5, 10, 15]
  34139. *
  34140. * _.range(0, -4, -1);
  34141. * // => [0, -1, -2, -3]
  34142. *
  34143. * _.range(1, 4, 0);
  34144. * // => [1, 1, 1]
  34145. *
  34146. * _.range(0);
  34147. * // => []
  34148. */
  34149. var range = createRange();
  34150. /**
  34151. * This method is like `_.range` except that it populates values in
  34152. * descending order.
  34153. *
  34154. * @static
  34155. * @memberOf _
  34156. * @since 4.0.0
  34157. * @category Util
  34158. * @param {number} [start=0] The start of the range.
  34159. * @param {number} end The end of the range.
  34160. * @param {number} [step=1] The value to increment or decrement by.
  34161. * @returns {Array} Returns the range of numbers.
  34162. * @see _.inRange, _.range
  34163. * @example
  34164. *
  34165. * _.rangeRight(4);
  34166. * // => [3, 2, 1, 0]
  34167. *
  34168. * _.rangeRight(-4);
  34169. * // => [-3, -2, -1, 0]
  34170. *
  34171. * _.rangeRight(1, 5);
  34172. * // => [4, 3, 2, 1]
  34173. *
  34174. * _.rangeRight(0, 20, 5);
  34175. * // => [15, 10, 5, 0]
  34176. *
  34177. * _.rangeRight(0, -4, -1);
  34178. * // => [-3, -2, -1, 0]
  34179. *
  34180. * _.rangeRight(1, 4, 0);
  34181. * // => [1, 1, 1]
  34182. *
  34183. * _.rangeRight(0);
  34184. * // => []
  34185. */
  34186. var rangeRight = createRange(true);
  34187. /**
  34188. * This method returns a new empty array.
  34189. *
  34190. * @static
  34191. * @memberOf _
  34192. * @since 4.13.0
  34193. * @category Util
  34194. * @returns {Array} Returns the new empty array.
  34195. * @example
  34196. *
  34197. * var arrays = _.times(2, _.stubArray);
  34198. *
  34199. * console.log(arrays);
  34200. * // => [[], []]
  34201. *
  34202. * console.log(arrays[0] === arrays[1]);
  34203. * // => false
  34204. */
  34205. function stubArray() {
  34206. return [];
  34207. }
  34208. /**
  34209. * This method returns `false`.
  34210. *
  34211. * @static
  34212. * @memberOf _
  34213. * @since 4.13.0
  34214. * @category Util
  34215. * @returns {boolean} Returns `false`.
  34216. * @example
  34217. *
  34218. * _.times(2, _.stubFalse);
  34219. * // => [false, false]
  34220. */
  34221. function stubFalse() {
  34222. return false;
  34223. }
  34224. /**
  34225. * This method returns a new empty object.
  34226. *
  34227. * @static
  34228. * @memberOf _
  34229. * @since 4.13.0
  34230. * @category Util
  34231. * @returns {Object} Returns the new empty object.
  34232. * @example
  34233. *
  34234. * var objects = _.times(2, _.stubObject);
  34235. *
  34236. * console.log(objects);
  34237. * // => [{}, {}]
  34238. *
  34239. * console.log(objects[0] === objects[1]);
  34240. * // => false
  34241. */
  34242. function stubObject() {
  34243. return {};
  34244. }
  34245. /**
  34246. * This method returns an empty string.
  34247. *
  34248. * @static
  34249. * @memberOf _
  34250. * @since 4.13.0
  34251. * @category Util
  34252. * @returns {string} Returns the empty string.
  34253. * @example
  34254. *
  34255. * _.times(2, _.stubString);
  34256. * // => ['', '']
  34257. */
  34258. function stubString() {
  34259. return '';
  34260. }
  34261. /**
  34262. * This method returns `true`.
  34263. *
  34264. * @static
  34265. * @memberOf _
  34266. * @since 4.13.0
  34267. * @category Util
  34268. * @returns {boolean} Returns `true`.
  34269. * @example
  34270. *
  34271. * _.times(2, _.stubTrue);
  34272. * // => [true, true]
  34273. */
  34274. function stubTrue() {
  34275. return true;
  34276. }
  34277. /**
  34278. * Invokes the iteratee `n` times, returning an array of the results of
  34279. * each invocation. The iteratee is invoked with one argument; (index).
  34280. *
  34281. * @static
  34282. * @since 0.1.0
  34283. * @memberOf _
  34284. * @category Util
  34285. * @param {number} n The number of times to invoke `iteratee`.
  34286. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34287. * @returns {Array} Returns the array of results.
  34288. * @example
  34289. *
  34290. * _.times(3, String);
  34291. * // => ['0', '1', '2']
  34292. *
  34293. * _.times(4, _.constant(0));
  34294. * // => [0, 0, 0, 0]
  34295. */
  34296. function times(n, iteratee) {
  34297. n = toInteger(n);
  34298. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34299. return [];
  34300. }
  34301. var index = MAX_ARRAY_LENGTH,
  34302. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34303. iteratee = getIteratee(iteratee);
  34304. n -= MAX_ARRAY_LENGTH;
  34305. var result = baseTimes(length, iteratee);
  34306. while (++index < n) {
  34307. iteratee(index);
  34308. }
  34309. return result;
  34310. }
  34311. /**
  34312. * Converts `value` to a property path array.
  34313. *
  34314. * @static
  34315. * @memberOf _
  34316. * @since 4.0.0
  34317. * @category Util
  34318. * @param {*} value The value to convert.
  34319. * @returns {Array} Returns the new property path array.
  34320. * @example
  34321. *
  34322. * _.toPath('a.b.c');
  34323. * // => ['a', 'b', 'c']
  34324. *
  34325. * _.toPath('a[0].b.c');
  34326. * // => ['a', '0', 'b', 'c']
  34327. */
  34328. function toPath(value) {
  34329. if (isArray(value)) {
  34330. return arrayMap(value, toKey);
  34331. }
  34332. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34333. }
  34334. /**
  34335. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34336. *
  34337. * @static
  34338. * @since 0.1.0
  34339. * @memberOf _
  34340. * @category Util
  34341. * @param {string} [prefix=''] The value to prefix the ID with.
  34342. * @returns {string} Returns the unique ID.
  34343. * @example
  34344. *
  34345. * _.uniqueId('contact_');
  34346. * // => 'contact_104'
  34347. *
  34348. * _.uniqueId();
  34349. * // => '105'
  34350. */
  34351. function uniqueId(prefix) {
  34352. var id = ++idCounter;
  34353. return toString(prefix) + id;
  34354. }
  34355. /*------------------------------------------------------------------------*/
  34356. /**
  34357. * Adds two numbers.
  34358. *
  34359. * @static
  34360. * @memberOf _
  34361. * @since 3.4.0
  34362. * @category Math
  34363. * @param {number} augend The first number in an addition.
  34364. * @param {number} addend The second number in an addition.
  34365. * @returns {number} Returns the total.
  34366. * @example
  34367. *
  34368. * _.add(6, 4);
  34369. * // => 10
  34370. */
  34371. var add = createMathOperation(function(augend, addend) {
  34372. return augend + addend;
  34373. }, 0);
  34374. /**
  34375. * Computes `number` rounded up to `precision`.
  34376. *
  34377. * @static
  34378. * @memberOf _
  34379. * @since 3.10.0
  34380. * @category Math
  34381. * @param {number} number The number to round up.
  34382. * @param {number} [precision=0] The precision to round up to.
  34383. * @returns {number} Returns the rounded up number.
  34384. * @example
  34385. *
  34386. * _.ceil(4.006);
  34387. * // => 5
  34388. *
  34389. * _.ceil(6.004, 2);
  34390. * // => 6.01
  34391. *
  34392. * _.ceil(6040, -2);
  34393. * // => 6100
  34394. */
  34395. var ceil = createRound('ceil');
  34396. /**
  34397. * Divide two numbers.
  34398. *
  34399. * @static
  34400. * @memberOf _
  34401. * @since 4.7.0
  34402. * @category Math
  34403. * @param {number} dividend The first number in a division.
  34404. * @param {number} divisor The second number in a division.
  34405. * @returns {number} Returns the quotient.
  34406. * @example
  34407. *
  34408. * _.divide(6, 4);
  34409. * // => 1.5
  34410. */
  34411. var divide = createMathOperation(function(dividend, divisor) {
  34412. return dividend / divisor;
  34413. }, 1);
  34414. /**
  34415. * Computes `number` rounded down to `precision`.
  34416. *
  34417. * @static
  34418. * @memberOf _
  34419. * @since 3.10.0
  34420. * @category Math
  34421. * @param {number} number The number to round down.
  34422. * @param {number} [precision=0] The precision to round down to.
  34423. * @returns {number} Returns the rounded down number.
  34424. * @example
  34425. *
  34426. * _.floor(4.006);
  34427. * // => 4
  34428. *
  34429. * _.floor(0.046, 2);
  34430. * // => 0.04
  34431. *
  34432. * _.floor(4060, -2);
  34433. * // => 4000
  34434. */
  34435. var floor = createRound('floor');
  34436. /**
  34437. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34438. * `undefined` is returned.
  34439. *
  34440. * @static
  34441. * @since 0.1.0
  34442. * @memberOf _
  34443. * @category Math
  34444. * @param {Array} array The array to iterate over.
  34445. * @returns {*} Returns the maximum value.
  34446. * @example
  34447. *
  34448. * _.max([4, 2, 8, 6]);
  34449. * // => 8
  34450. *
  34451. * _.max([]);
  34452. * // => undefined
  34453. */
  34454. function max(array) {
  34455. return (array && array.length)
  34456. ? baseExtremum(array, identity, baseGt)
  34457. : undefined;
  34458. }
  34459. /**
  34460. * This method is like `_.max` except that it accepts `iteratee` which is
  34461. * invoked for each element in `array` to generate the criterion by which
  34462. * the value is ranked. The iteratee is invoked with one argument: (value).
  34463. *
  34464. * @static
  34465. * @memberOf _
  34466. * @since 4.0.0
  34467. * @category Math
  34468. * @param {Array} array The array to iterate over.
  34469. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34470. * @returns {*} Returns the maximum value.
  34471. * @example
  34472. *
  34473. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34474. *
  34475. * _.maxBy(objects, function(o) { return o.n; });
  34476. * // => { 'n': 2 }
  34477. *
  34478. * // The `_.property` iteratee shorthand.
  34479. * _.maxBy(objects, 'n');
  34480. * // => { 'n': 2 }
  34481. */
  34482. function maxBy(array, iteratee) {
  34483. return (array && array.length)
  34484. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34485. : undefined;
  34486. }
  34487. /**
  34488. * Computes the mean of the values in `array`.
  34489. *
  34490. * @static
  34491. * @memberOf _
  34492. * @since 4.0.0
  34493. * @category Math
  34494. * @param {Array} array The array to iterate over.
  34495. * @returns {number} Returns the mean.
  34496. * @example
  34497. *
  34498. * _.mean([4, 2, 8, 6]);
  34499. * // => 5
  34500. */
  34501. function mean(array) {
  34502. return baseMean(array, identity);
  34503. }
  34504. /**
  34505. * This method is like `_.mean` except that it accepts `iteratee` which is
  34506. * invoked for each element in `array` to generate the value to be averaged.
  34507. * The iteratee is invoked with one argument: (value).
  34508. *
  34509. * @static
  34510. * @memberOf _
  34511. * @since 4.7.0
  34512. * @category Math
  34513. * @param {Array} array The array to iterate over.
  34514. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34515. * @returns {number} Returns the mean.
  34516. * @example
  34517. *
  34518. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34519. *
  34520. * _.meanBy(objects, function(o) { return o.n; });
  34521. * // => 5
  34522. *
  34523. * // The `_.property` iteratee shorthand.
  34524. * _.meanBy(objects, 'n');
  34525. * // => 5
  34526. */
  34527. function meanBy(array, iteratee) {
  34528. return baseMean(array, getIteratee(iteratee, 2));
  34529. }
  34530. /**
  34531. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34532. * `undefined` is returned.
  34533. *
  34534. * @static
  34535. * @since 0.1.0
  34536. * @memberOf _
  34537. * @category Math
  34538. * @param {Array} array The array to iterate over.
  34539. * @returns {*} Returns the minimum value.
  34540. * @example
  34541. *
  34542. * _.min([4, 2, 8, 6]);
  34543. * // => 2
  34544. *
  34545. * _.min([]);
  34546. * // => undefined
  34547. */
  34548. function min(array) {
  34549. return (array && array.length)
  34550. ? baseExtremum(array, identity, baseLt)
  34551. : undefined;
  34552. }
  34553. /**
  34554. * This method is like `_.min` except that it accepts `iteratee` which is
  34555. * invoked for each element in `array` to generate the criterion by which
  34556. * the value is ranked. The iteratee is invoked with one argument: (value).
  34557. *
  34558. * @static
  34559. * @memberOf _
  34560. * @since 4.0.0
  34561. * @category Math
  34562. * @param {Array} array The array to iterate over.
  34563. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34564. * @returns {*} Returns the minimum value.
  34565. * @example
  34566. *
  34567. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34568. *
  34569. * _.minBy(objects, function(o) { return o.n; });
  34570. * // => { 'n': 1 }
  34571. *
  34572. * // The `_.property` iteratee shorthand.
  34573. * _.minBy(objects, 'n');
  34574. * // => { 'n': 1 }
  34575. */
  34576. function minBy(array, iteratee) {
  34577. return (array && array.length)
  34578. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34579. : undefined;
  34580. }
  34581. /**
  34582. * Multiply two numbers.
  34583. *
  34584. * @static
  34585. * @memberOf _
  34586. * @since 4.7.0
  34587. * @category Math
  34588. * @param {number} multiplier The first number in a multiplication.
  34589. * @param {number} multiplicand The second number in a multiplication.
  34590. * @returns {number} Returns the product.
  34591. * @example
  34592. *
  34593. * _.multiply(6, 4);
  34594. * // => 24
  34595. */
  34596. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34597. return multiplier * multiplicand;
  34598. }, 1);
  34599. /**
  34600. * Computes `number` rounded to `precision`.
  34601. *
  34602. * @static
  34603. * @memberOf _
  34604. * @since 3.10.0
  34605. * @category Math
  34606. * @param {number} number The number to round.
  34607. * @param {number} [precision=0] The precision to round to.
  34608. * @returns {number} Returns the rounded number.
  34609. * @example
  34610. *
  34611. * _.round(4.006);
  34612. * // => 4
  34613. *
  34614. * _.round(4.006, 2);
  34615. * // => 4.01
  34616. *
  34617. * _.round(4060, -2);
  34618. * // => 4100
  34619. */
  34620. var round = createRound('round');
  34621. /**
  34622. * Subtract two numbers.
  34623. *
  34624. * @static
  34625. * @memberOf _
  34626. * @since 4.0.0
  34627. * @category Math
  34628. * @param {number} minuend The first number in a subtraction.
  34629. * @param {number} subtrahend The second number in a subtraction.
  34630. * @returns {number} Returns the difference.
  34631. * @example
  34632. *
  34633. * _.subtract(6, 4);
  34634. * // => 2
  34635. */
  34636. var subtract = createMathOperation(function(minuend, subtrahend) {
  34637. return minuend - subtrahend;
  34638. }, 0);
  34639. /**
  34640. * Computes the sum of the values in `array`.
  34641. *
  34642. * @static
  34643. * @memberOf _
  34644. * @since 3.4.0
  34645. * @category Math
  34646. * @param {Array} array The array to iterate over.
  34647. * @returns {number} Returns the sum.
  34648. * @example
  34649. *
  34650. * _.sum([4, 2, 8, 6]);
  34651. * // => 20
  34652. */
  34653. function sum(array) {
  34654. return (array && array.length)
  34655. ? baseSum(array, identity)
  34656. : 0;
  34657. }
  34658. /**
  34659. * This method is like `_.sum` except that it accepts `iteratee` which is
  34660. * invoked for each element in `array` to generate the value to be summed.
  34661. * The iteratee is invoked with one argument: (value).
  34662. *
  34663. * @static
  34664. * @memberOf _
  34665. * @since 4.0.0
  34666. * @category Math
  34667. * @param {Array} array The array to iterate over.
  34668. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34669. * @returns {number} Returns the sum.
  34670. * @example
  34671. *
  34672. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34673. *
  34674. * _.sumBy(objects, function(o) { return o.n; });
  34675. * // => 20
  34676. *
  34677. * // The `_.property` iteratee shorthand.
  34678. * _.sumBy(objects, 'n');
  34679. * // => 20
  34680. */
  34681. function sumBy(array, iteratee) {
  34682. return (array && array.length)
  34683. ? baseSum(array, getIteratee(iteratee, 2))
  34684. : 0;
  34685. }
  34686. /*------------------------------------------------------------------------*/
  34687. // Add methods that return wrapped values in chain sequences.
  34688. lodash.after = after;
  34689. lodash.ary = ary;
  34690. lodash.assign = assign;
  34691. lodash.assignIn = assignIn;
  34692. lodash.assignInWith = assignInWith;
  34693. lodash.assignWith = assignWith;
  34694. lodash.at = at;
  34695. lodash.before = before;
  34696. lodash.bind = bind;
  34697. lodash.bindAll = bindAll;
  34698. lodash.bindKey = bindKey;
  34699. lodash.castArray = castArray;
  34700. lodash.chain = chain;
  34701. lodash.chunk = chunk;
  34702. lodash.compact = compact;
  34703. lodash.concat = concat;
  34704. lodash.cond = cond;
  34705. lodash.conforms = conforms;
  34706. lodash.constant = constant;
  34707. lodash.countBy = countBy;
  34708. lodash.create = create;
  34709. lodash.curry = curry;
  34710. lodash.curryRight = curryRight;
  34711. lodash.debounce = debounce;
  34712. lodash.defaults = defaults;
  34713. lodash.defaultsDeep = defaultsDeep;
  34714. lodash.defer = defer;
  34715. lodash.delay = delay;
  34716. lodash.difference = difference;
  34717. lodash.differenceBy = differenceBy;
  34718. lodash.differenceWith = differenceWith;
  34719. lodash.drop = drop;
  34720. lodash.dropRight = dropRight;
  34721. lodash.dropRightWhile = dropRightWhile;
  34722. lodash.dropWhile = dropWhile;
  34723. lodash.fill = fill;
  34724. lodash.filter = filter;
  34725. lodash.flatMap = flatMap;
  34726. lodash.flatMapDeep = flatMapDeep;
  34727. lodash.flatMapDepth = flatMapDepth;
  34728. lodash.flatten = flatten;
  34729. lodash.flattenDeep = flattenDeep;
  34730. lodash.flattenDepth = flattenDepth;
  34731. lodash.flip = flip;
  34732. lodash.flow = flow;
  34733. lodash.flowRight = flowRight;
  34734. lodash.fromPairs = fromPairs;
  34735. lodash.functions = functions;
  34736. lodash.functionsIn = functionsIn;
  34737. lodash.groupBy = groupBy;
  34738. lodash.initial = initial;
  34739. lodash.intersection = intersection;
  34740. lodash.intersectionBy = intersectionBy;
  34741. lodash.intersectionWith = intersectionWith;
  34742. lodash.invert = invert;
  34743. lodash.invertBy = invertBy;
  34744. lodash.invokeMap = invokeMap;
  34745. lodash.iteratee = iteratee;
  34746. lodash.keyBy = keyBy;
  34747. lodash.keys = keys;
  34748. lodash.keysIn = keysIn;
  34749. lodash.map = map;
  34750. lodash.mapKeys = mapKeys;
  34751. lodash.mapValues = mapValues;
  34752. lodash.matches = matches;
  34753. lodash.matchesProperty = matchesProperty;
  34754. lodash.memoize = memoize;
  34755. lodash.merge = merge;
  34756. lodash.mergeWith = mergeWith;
  34757. lodash.method = method;
  34758. lodash.methodOf = methodOf;
  34759. lodash.mixin = mixin;
  34760. lodash.negate = negate;
  34761. lodash.nthArg = nthArg;
  34762. lodash.omit = omit;
  34763. lodash.omitBy = omitBy;
  34764. lodash.once = once;
  34765. lodash.orderBy = orderBy;
  34766. lodash.over = over;
  34767. lodash.overArgs = overArgs;
  34768. lodash.overEvery = overEvery;
  34769. lodash.overSome = overSome;
  34770. lodash.partial = partial;
  34771. lodash.partialRight = partialRight;
  34772. lodash.partition = partition;
  34773. lodash.pick = pick;
  34774. lodash.pickBy = pickBy;
  34775. lodash.property = property;
  34776. lodash.propertyOf = propertyOf;
  34777. lodash.pull = pull;
  34778. lodash.pullAll = pullAll;
  34779. lodash.pullAllBy = pullAllBy;
  34780. lodash.pullAllWith = pullAllWith;
  34781. lodash.pullAt = pullAt;
  34782. lodash.range = range;
  34783. lodash.rangeRight = rangeRight;
  34784. lodash.rearg = rearg;
  34785. lodash.reject = reject;
  34786. lodash.remove = remove;
  34787. lodash.rest = rest;
  34788. lodash.reverse = reverse;
  34789. lodash.sampleSize = sampleSize;
  34790. lodash.set = set;
  34791. lodash.setWith = setWith;
  34792. lodash.shuffle = shuffle;
  34793. lodash.slice = slice;
  34794. lodash.sortBy = sortBy;
  34795. lodash.sortedUniq = sortedUniq;
  34796. lodash.sortedUniqBy = sortedUniqBy;
  34797. lodash.split = split;
  34798. lodash.spread = spread;
  34799. lodash.tail = tail;
  34800. lodash.take = take;
  34801. lodash.takeRight = takeRight;
  34802. lodash.takeRightWhile = takeRightWhile;
  34803. lodash.takeWhile = takeWhile;
  34804. lodash.tap = tap;
  34805. lodash.throttle = throttle;
  34806. lodash.thru = thru;
  34807. lodash.toArray = toArray;
  34808. lodash.toPairs = toPairs;
  34809. lodash.toPairsIn = toPairsIn;
  34810. lodash.toPath = toPath;
  34811. lodash.toPlainObject = toPlainObject;
  34812. lodash.transform = transform;
  34813. lodash.unary = unary;
  34814. lodash.union = union;
  34815. lodash.unionBy = unionBy;
  34816. lodash.unionWith = unionWith;
  34817. lodash.uniq = uniq;
  34818. lodash.uniqBy = uniqBy;
  34819. lodash.uniqWith = uniqWith;
  34820. lodash.unset = unset;
  34821. lodash.unzip = unzip;
  34822. lodash.unzipWith = unzipWith;
  34823. lodash.update = update;
  34824. lodash.updateWith = updateWith;
  34825. lodash.values = values;
  34826. lodash.valuesIn = valuesIn;
  34827. lodash.without = without;
  34828. lodash.words = words;
  34829. lodash.wrap = wrap;
  34830. lodash.xor = xor;
  34831. lodash.xorBy = xorBy;
  34832. lodash.xorWith = xorWith;
  34833. lodash.zip = zip;
  34834. lodash.zipObject = zipObject;
  34835. lodash.zipObjectDeep = zipObjectDeep;
  34836. lodash.zipWith = zipWith;
  34837. // Add aliases.
  34838. lodash.entries = toPairs;
  34839. lodash.entriesIn = toPairsIn;
  34840. lodash.extend = assignIn;
  34841. lodash.extendWith = assignInWith;
  34842. // Add methods to `lodash.prototype`.
  34843. mixin(lodash, lodash);
  34844. /*------------------------------------------------------------------------*/
  34845. // Add methods that return unwrapped values in chain sequences.
  34846. lodash.add = add;
  34847. lodash.attempt = attempt;
  34848. lodash.camelCase = camelCase;
  34849. lodash.capitalize = capitalize;
  34850. lodash.ceil = ceil;
  34851. lodash.clamp = clamp;
  34852. lodash.clone = clone;
  34853. lodash.cloneDeep = cloneDeep;
  34854. lodash.cloneDeepWith = cloneDeepWith;
  34855. lodash.cloneWith = cloneWith;
  34856. lodash.conformsTo = conformsTo;
  34857. lodash.deburr = deburr;
  34858. lodash.defaultTo = defaultTo;
  34859. lodash.divide = divide;
  34860. lodash.endsWith = endsWith;
  34861. lodash.eq = eq;
  34862. lodash.escape = escape;
  34863. lodash.escapeRegExp = escapeRegExp;
  34864. lodash.every = every;
  34865. lodash.find = find;
  34866. lodash.findIndex = findIndex;
  34867. lodash.findKey = findKey;
  34868. lodash.findLast = findLast;
  34869. lodash.findLastIndex = findLastIndex;
  34870. lodash.findLastKey = findLastKey;
  34871. lodash.floor = floor;
  34872. lodash.forEach = forEach;
  34873. lodash.forEachRight = forEachRight;
  34874. lodash.forIn = forIn;
  34875. lodash.forInRight = forInRight;
  34876. lodash.forOwn = forOwn;
  34877. lodash.forOwnRight = forOwnRight;
  34878. lodash.get = get;
  34879. lodash.gt = gt;
  34880. lodash.gte = gte;
  34881. lodash.has = has;
  34882. lodash.hasIn = hasIn;
  34883. lodash.head = head;
  34884. lodash.identity = identity;
  34885. lodash.includes = includes;
  34886. lodash.indexOf = indexOf;
  34887. lodash.inRange = inRange;
  34888. lodash.invoke = invoke;
  34889. lodash.isArguments = isArguments;
  34890. lodash.isArray = isArray;
  34891. lodash.isArrayBuffer = isArrayBuffer;
  34892. lodash.isArrayLike = isArrayLike;
  34893. lodash.isArrayLikeObject = isArrayLikeObject;
  34894. lodash.isBoolean = isBoolean;
  34895. lodash.isBuffer = isBuffer;
  34896. lodash.isDate = isDate;
  34897. lodash.isElement = isElement;
  34898. lodash.isEmpty = isEmpty;
  34899. lodash.isEqual = isEqual;
  34900. lodash.isEqualWith = isEqualWith;
  34901. lodash.isError = isError;
  34902. lodash.isFinite = isFinite;
  34903. lodash.isFunction = isFunction;
  34904. lodash.isInteger = isInteger;
  34905. lodash.isLength = isLength;
  34906. lodash.isMap = isMap;
  34907. lodash.isMatch = isMatch;
  34908. lodash.isMatchWith = isMatchWith;
  34909. lodash.isNaN = isNaN;
  34910. lodash.isNative = isNative;
  34911. lodash.isNil = isNil;
  34912. lodash.isNull = isNull;
  34913. lodash.isNumber = isNumber;
  34914. lodash.isObject = isObject;
  34915. lodash.isObjectLike = isObjectLike;
  34916. lodash.isPlainObject = isPlainObject;
  34917. lodash.isRegExp = isRegExp;
  34918. lodash.isSafeInteger = isSafeInteger;
  34919. lodash.isSet = isSet;
  34920. lodash.isString = isString;
  34921. lodash.isSymbol = isSymbol;
  34922. lodash.isTypedArray = isTypedArray;
  34923. lodash.isUndefined = isUndefined;
  34924. lodash.isWeakMap = isWeakMap;
  34925. lodash.isWeakSet = isWeakSet;
  34926. lodash.join = join;
  34927. lodash.kebabCase = kebabCase;
  34928. lodash.last = last;
  34929. lodash.lastIndexOf = lastIndexOf;
  34930. lodash.lowerCase = lowerCase;
  34931. lodash.lowerFirst = lowerFirst;
  34932. lodash.lt = lt;
  34933. lodash.lte = lte;
  34934. lodash.max = max;
  34935. lodash.maxBy = maxBy;
  34936. lodash.mean = mean;
  34937. lodash.meanBy = meanBy;
  34938. lodash.min = min;
  34939. lodash.minBy = minBy;
  34940. lodash.stubArray = stubArray;
  34941. lodash.stubFalse = stubFalse;
  34942. lodash.stubObject = stubObject;
  34943. lodash.stubString = stubString;
  34944. lodash.stubTrue = stubTrue;
  34945. lodash.multiply = multiply;
  34946. lodash.nth = nth;
  34947. lodash.noConflict = noConflict;
  34948. lodash.noop = noop;
  34949. lodash.now = now;
  34950. lodash.pad = pad;
  34951. lodash.padEnd = padEnd;
  34952. lodash.padStart = padStart;
  34953. lodash.parseInt = parseInt;
  34954. lodash.random = random;
  34955. lodash.reduce = reduce;
  34956. lodash.reduceRight = reduceRight;
  34957. lodash.repeat = repeat;
  34958. lodash.replace = replace;
  34959. lodash.result = result;
  34960. lodash.round = round;
  34961. lodash.runInContext = runInContext;
  34962. lodash.sample = sample;
  34963. lodash.size = size;
  34964. lodash.snakeCase = snakeCase;
  34965. lodash.some = some;
  34966. lodash.sortedIndex = sortedIndex;
  34967. lodash.sortedIndexBy = sortedIndexBy;
  34968. lodash.sortedIndexOf = sortedIndexOf;
  34969. lodash.sortedLastIndex = sortedLastIndex;
  34970. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34971. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34972. lodash.startCase = startCase;
  34973. lodash.startsWith = startsWith;
  34974. lodash.subtract = subtract;
  34975. lodash.sum = sum;
  34976. lodash.sumBy = sumBy;
  34977. lodash.template = template;
  34978. lodash.times = times;
  34979. lodash.toFinite = toFinite;
  34980. lodash.toInteger = toInteger;
  34981. lodash.toLength = toLength;
  34982. lodash.toLower = toLower;
  34983. lodash.toNumber = toNumber;
  34984. lodash.toSafeInteger = toSafeInteger;
  34985. lodash.toString = toString;
  34986. lodash.toUpper = toUpper;
  34987. lodash.trim = trim;
  34988. lodash.trimEnd = trimEnd;
  34989. lodash.trimStart = trimStart;
  34990. lodash.truncate = truncate;
  34991. lodash.unescape = unescape;
  34992. lodash.uniqueId = uniqueId;
  34993. lodash.upperCase = upperCase;
  34994. lodash.upperFirst = upperFirst;
  34995. // Add aliases.
  34996. lodash.each = forEach;
  34997. lodash.eachRight = forEachRight;
  34998. lodash.first = head;
  34999. mixin(lodash, (function() {
  35000. var source = {};
  35001. baseForOwn(lodash, function(func, methodName) {
  35002. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  35003. source[methodName] = func;
  35004. }
  35005. });
  35006. return source;
  35007. }()), { 'chain': false });
  35008. /*------------------------------------------------------------------------*/
  35009. /**
  35010. * The semantic version number.
  35011. *
  35012. * @static
  35013. * @memberOf _
  35014. * @type {string}
  35015. */
  35016. lodash.VERSION = VERSION;
  35017. // Assign default placeholders.
  35018. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35019. lodash[methodName].placeholder = lodash;
  35020. });
  35021. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35022. arrayEach(['drop', 'take'], function(methodName, index) {
  35023. LazyWrapper.prototype[methodName] = function(n) {
  35024. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35025. var result = (this.__filtered__ && !index)
  35026. ? new LazyWrapper(this)
  35027. : this.clone();
  35028. if (result.__filtered__) {
  35029. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35030. } else {
  35031. result.__views__.push({
  35032. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35033. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35034. });
  35035. }
  35036. return result;
  35037. };
  35038. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35039. return this.reverse()[methodName](n).reverse();
  35040. };
  35041. });
  35042. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35043. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35044. var type = index + 1,
  35045. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35046. LazyWrapper.prototype[methodName] = function(iteratee) {
  35047. var result = this.clone();
  35048. result.__iteratees__.push({
  35049. 'iteratee': getIteratee(iteratee, 3),
  35050. 'type': type
  35051. });
  35052. result.__filtered__ = result.__filtered__ || isFilter;
  35053. return result;
  35054. };
  35055. });
  35056. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35057. arrayEach(['head', 'last'], function(methodName, index) {
  35058. var takeName = 'take' + (index ? 'Right' : '');
  35059. LazyWrapper.prototype[methodName] = function() {
  35060. return this[takeName](1).value()[0];
  35061. };
  35062. });
  35063. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35064. arrayEach(['initial', 'tail'], function(methodName, index) {
  35065. var dropName = 'drop' + (index ? '' : 'Right');
  35066. LazyWrapper.prototype[methodName] = function() {
  35067. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35068. };
  35069. });
  35070. LazyWrapper.prototype.compact = function() {
  35071. return this.filter(identity);
  35072. };
  35073. LazyWrapper.prototype.find = function(predicate) {
  35074. return this.filter(predicate).head();
  35075. };
  35076. LazyWrapper.prototype.findLast = function(predicate) {
  35077. return this.reverse().find(predicate);
  35078. };
  35079. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35080. if (typeof path == 'function') {
  35081. return new LazyWrapper(this);
  35082. }
  35083. return this.map(function(value) {
  35084. return baseInvoke(value, path, args);
  35085. });
  35086. });
  35087. LazyWrapper.prototype.reject = function(predicate) {
  35088. return this.filter(negate(getIteratee(predicate)));
  35089. };
  35090. LazyWrapper.prototype.slice = function(start, end) {
  35091. start = toInteger(start);
  35092. var result = this;
  35093. if (result.__filtered__ && (start > 0 || end < 0)) {
  35094. return new LazyWrapper(result);
  35095. }
  35096. if (start < 0) {
  35097. result = result.takeRight(-start);
  35098. } else if (start) {
  35099. result = result.drop(start);
  35100. }
  35101. if (end !== undefined) {
  35102. end = toInteger(end);
  35103. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35104. }
  35105. return result;
  35106. };
  35107. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35108. return this.reverse().takeWhile(predicate).reverse();
  35109. };
  35110. LazyWrapper.prototype.toArray = function() {
  35111. return this.take(MAX_ARRAY_LENGTH);
  35112. };
  35113. // Add `LazyWrapper` methods to `lodash.prototype`.
  35114. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35115. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35116. isTaker = /^(?:head|last)$/.test(methodName),
  35117. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35118. retUnwrapped = isTaker || /^find/.test(methodName);
  35119. if (!lodashFunc) {
  35120. return;
  35121. }
  35122. lodash.prototype[methodName] = function() {
  35123. var value = this.__wrapped__,
  35124. args = isTaker ? [1] : arguments,
  35125. isLazy = value instanceof LazyWrapper,
  35126. iteratee = args[0],
  35127. useLazy = isLazy || isArray(value);
  35128. var interceptor = function(value) {
  35129. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35130. return (isTaker && chainAll) ? result[0] : result;
  35131. };
  35132. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35133. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35134. isLazy = useLazy = false;
  35135. }
  35136. var chainAll = this.__chain__,
  35137. isHybrid = !!this.__actions__.length,
  35138. isUnwrapped = retUnwrapped && !chainAll,
  35139. onlyLazy = isLazy && !isHybrid;
  35140. if (!retUnwrapped && useLazy) {
  35141. value = onlyLazy ? value : new LazyWrapper(this);
  35142. var result = func.apply(value, args);
  35143. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35144. return new LodashWrapper(result, chainAll);
  35145. }
  35146. if (isUnwrapped && onlyLazy) {
  35147. return func.apply(this, args);
  35148. }
  35149. result = this.thru(interceptor);
  35150. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35151. };
  35152. });
  35153. // Add `Array` methods to `lodash.prototype`.
  35154. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35155. var func = arrayProto[methodName],
  35156. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35157. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35158. lodash.prototype[methodName] = function() {
  35159. var args = arguments;
  35160. if (retUnwrapped && !this.__chain__) {
  35161. var value = this.value();
  35162. return func.apply(isArray(value) ? value : [], args);
  35163. }
  35164. return this[chainName](function(value) {
  35165. return func.apply(isArray(value) ? value : [], args);
  35166. });
  35167. };
  35168. });
  35169. // Map minified method names to their real names.
  35170. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35171. var lodashFunc = lodash[methodName];
  35172. if (lodashFunc) {
  35173. var key = lodashFunc.name + '';
  35174. if (!hasOwnProperty.call(realNames, key)) {
  35175. realNames[key] = [];
  35176. }
  35177. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35178. }
  35179. });
  35180. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35181. 'name': 'wrapper',
  35182. 'func': undefined
  35183. }];
  35184. // Add methods to `LazyWrapper`.
  35185. LazyWrapper.prototype.clone = lazyClone;
  35186. LazyWrapper.prototype.reverse = lazyReverse;
  35187. LazyWrapper.prototype.value = lazyValue;
  35188. // Add chain sequence methods to the `lodash` wrapper.
  35189. lodash.prototype.at = wrapperAt;
  35190. lodash.prototype.chain = wrapperChain;
  35191. lodash.prototype.commit = wrapperCommit;
  35192. lodash.prototype.next = wrapperNext;
  35193. lodash.prototype.plant = wrapperPlant;
  35194. lodash.prototype.reverse = wrapperReverse;
  35195. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35196. // Add lazy aliases.
  35197. lodash.prototype.first = lodash.prototype.head;
  35198. if (symIterator) {
  35199. lodash.prototype[symIterator] = wrapperToIterator;
  35200. }
  35201. return lodash;
  35202. });
  35203. /*--------------------------------------------------------------------------*/
  35204. // Export lodash.
  35205. var _ = runInContext();
  35206. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35207. if (true) {
  35208. // Expose Lodash on the global object to prevent errors when Lodash is
  35209. // loaded by a script tag in the presence of an AMD loader.
  35210. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35211. // Use `_.noConflict` to remove Lodash from the global object.
  35212. root._ = _;
  35213. // Define as an anonymous module so, through path mapping, it can be
  35214. // referenced as the "underscore" module.
  35215. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35216. return _;
  35217. }).call(exports, __webpack_require__, exports, module),
  35218. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35219. }
  35220. // Check for `exports` after `define` in case a build optimizer adds it.
  35221. else {}
  35222. }.call(this));
  35223. /* 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)))
  35224. /***/ }),
  35225. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35226. /*!***************************************************!*\
  35227. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35228. \***************************************************/
  35229. /*! exports provided: default */
  35230. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35231. "use strict";
  35232. __webpack_require__.r(__webpack_exports__);
  35233. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35234. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35235. * @version 1.16.1
  35236. * @license
  35237. * Copyright (c) 2016 Federico Zivolo and contributors
  35238. *
  35239. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35240. * of this software and associated documentation files (the "Software"), to deal
  35241. * in the Software without restriction, including without limitation the rights
  35242. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35243. * copies of the Software, and to permit persons to whom the Software is
  35244. * furnished to do so, subject to the following conditions:
  35245. *
  35246. * The above copyright notice and this permission notice shall be included in all
  35247. * copies or substantial portions of the Software.
  35248. *
  35249. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35250. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35251. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35252. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35253. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35254. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35255. * SOFTWARE.
  35256. */
  35257. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35258. var timeoutDuration = function () {
  35259. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35260. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35261. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35262. return 1;
  35263. }
  35264. }
  35265. return 0;
  35266. }();
  35267. function microtaskDebounce(fn) {
  35268. var called = false;
  35269. return function () {
  35270. if (called) {
  35271. return;
  35272. }
  35273. called = true;
  35274. window.Promise.resolve().then(function () {
  35275. called = false;
  35276. fn();
  35277. });
  35278. };
  35279. }
  35280. function taskDebounce(fn) {
  35281. var scheduled = false;
  35282. return function () {
  35283. if (!scheduled) {
  35284. scheduled = true;
  35285. setTimeout(function () {
  35286. scheduled = false;
  35287. fn();
  35288. }, timeoutDuration);
  35289. }
  35290. };
  35291. }
  35292. var supportsMicroTasks = isBrowser && window.Promise;
  35293. /**
  35294. * Create a debounced version of a method, that's asynchronously deferred
  35295. * but called in the minimum time possible.
  35296. *
  35297. * @method
  35298. * @memberof Popper.Utils
  35299. * @argument {Function} fn
  35300. * @returns {Function}
  35301. */
  35302. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35303. /**
  35304. * Check if the given variable is a function
  35305. * @method
  35306. * @memberof Popper.Utils
  35307. * @argument {Any} functionToCheck - variable to check
  35308. * @returns {Boolean} answer to: is a function?
  35309. */
  35310. function isFunction(functionToCheck) {
  35311. var getType = {};
  35312. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35313. }
  35314. /**
  35315. * Get CSS computed property of the given element
  35316. * @method
  35317. * @memberof Popper.Utils
  35318. * @argument {Eement} element
  35319. * @argument {String} property
  35320. */
  35321. function getStyleComputedProperty(element, property) {
  35322. if (element.nodeType !== 1) {
  35323. return [];
  35324. }
  35325. // NOTE: 1 DOM access here
  35326. var window = element.ownerDocument.defaultView;
  35327. var css = window.getComputedStyle(element, null);
  35328. return property ? css[property] : css;
  35329. }
  35330. /**
  35331. * Returns the parentNode or the host of the element
  35332. * @method
  35333. * @memberof Popper.Utils
  35334. * @argument {Element} element
  35335. * @returns {Element} parent
  35336. */
  35337. function getParentNode(element) {
  35338. if (element.nodeName === 'HTML') {
  35339. return element;
  35340. }
  35341. return element.parentNode || element.host;
  35342. }
  35343. /**
  35344. * Returns the scrolling parent of the given element
  35345. * @method
  35346. * @memberof Popper.Utils
  35347. * @argument {Element} element
  35348. * @returns {Element} scroll parent
  35349. */
  35350. function getScrollParent(element) {
  35351. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35352. if (!element) {
  35353. return document.body;
  35354. }
  35355. switch (element.nodeName) {
  35356. case 'HTML':
  35357. case 'BODY':
  35358. return element.ownerDocument.body;
  35359. case '#document':
  35360. return element.body;
  35361. }
  35362. // Firefox want us to check `-x` and `-y` variations as well
  35363. var _getStyleComputedProp = getStyleComputedProperty(element),
  35364. overflow = _getStyleComputedProp.overflow,
  35365. overflowX = _getStyleComputedProp.overflowX,
  35366. overflowY = _getStyleComputedProp.overflowY;
  35367. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35368. return element;
  35369. }
  35370. return getScrollParent(getParentNode(element));
  35371. }
  35372. /**
  35373. * Returns the reference node of the reference object, or the reference object itself.
  35374. * @method
  35375. * @memberof Popper.Utils
  35376. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35377. * @returns {Element} parent
  35378. */
  35379. function getReferenceNode(reference) {
  35380. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35381. }
  35382. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35383. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35384. /**
  35385. * Determines if the browser is Internet Explorer
  35386. * @method
  35387. * @memberof Popper.Utils
  35388. * @param {Number} version to check
  35389. * @returns {Boolean} isIE
  35390. */
  35391. function isIE(version) {
  35392. if (version === 11) {
  35393. return isIE11;
  35394. }
  35395. if (version === 10) {
  35396. return isIE10;
  35397. }
  35398. return isIE11 || isIE10;
  35399. }
  35400. /**
  35401. * Returns the offset parent of the given element
  35402. * @method
  35403. * @memberof Popper.Utils
  35404. * @argument {Element} element
  35405. * @returns {Element} offset parent
  35406. */
  35407. function getOffsetParent(element) {
  35408. if (!element) {
  35409. return document.documentElement;
  35410. }
  35411. var noOffsetParent = isIE(10) ? document.body : null;
  35412. // NOTE: 1 DOM access here
  35413. var offsetParent = element.offsetParent || null;
  35414. // Skip hidden elements which don't have an offsetParent
  35415. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35416. offsetParent = (element = element.nextElementSibling).offsetParent;
  35417. }
  35418. var nodeName = offsetParent && offsetParent.nodeName;
  35419. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35420. return element ? element.ownerDocument.documentElement : document.documentElement;
  35421. }
  35422. // .offsetParent will return the closest TH, TD or TABLE in case
  35423. // no offsetParent is present, I hate this job...
  35424. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35425. return getOffsetParent(offsetParent);
  35426. }
  35427. return offsetParent;
  35428. }
  35429. function isOffsetContainer(element) {
  35430. var nodeName = element.nodeName;
  35431. if (nodeName === 'BODY') {
  35432. return false;
  35433. }
  35434. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35435. }
  35436. /**
  35437. * Finds the root node (document, shadowDOM root) of the given element
  35438. * @method
  35439. * @memberof Popper.Utils
  35440. * @argument {Element} node
  35441. * @returns {Element} root node
  35442. */
  35443. function getRoot(node) {
  35444. if (node.parentNode !== null) {
  35445. return getRoot(node.parentNode);
  35446. }
  35447. return node;
  35448. }
  35449. /**
  35450. * Finds the offset parent common to the two provided nodes
  35451. * @method
  35452. * @memberof Popper.Utils
  35453. * @argument {Element} element1
  35454. * @argument {Element} element2
  35455. * @returns {Element} common offset parent
  35456. */
  35457. function findCommonOffsetParent(element1, element2) {
  35458. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35459. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35460. return document.documentElement;
  35461. }
  35462. // Here we make sure to give as "start" the element that comes first in the DOM
  35463. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35464. var start = order ? element1 : element2;
  35465. var end = order ? element2 : element1;
  35466. // Get common ancestor container
  35467. var range = document.createRange();
  35468. range.setStart(start, 0);
  35469. range.setEnd(end, 0);
  35470. var commonAncestorContainer = range.commonAncestorContainer;
  35471. // Both nodes are inside #document
  35472. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35473. if (isOffsetContainer(commonAncestorContainer)) {
  35474. return commonAncestorContainer;
  35475. }
  35476. return getOffsetParent(commonAncestorContainer);
  35477. }
  35478. // one of the nodes is inside shadowDOM, find which one
  35479. var element1root = getRoot(element1);
  35480. if (element1root.host) {
  35481. return findCommonOffsetParent(element1root.host, element2);
  35482. } else {
  35483. return findCommonOffsetParent(element1, getRoot(element2).host);
  35484. }
  35485. }
  35486. /**
  35487. * Gets the scroll value of the given element in the given side (top and left)
  35488. * @method
  35489. * @memberof Popper.Utils
  35490. * @argument {Element} element
  35491. * @argument {String} side `top` or `left`
  35492. * @returns {number} amount of scrolled pixels
  35493. */
  35494. function getScroll(element) {
  35495. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35496. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35497. var nodeName = element.nodeName;
  35498. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35499. var html = element.ownerDocument.documentElement;
  35500. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35501. return scrollingElement[upperSide];
  35502. }
  35503. return element[upperSide];
  35504. }
  35505. /*
  35506. * Sum or subtract the element scroll values (left and top) from a given rect object
  35507. * @method
  35508. * @memberof Popper.Utils
  35509. * @param {Object} rect - Rect object you want to change
  35510. * @param {HTMLElement} element - The element from the function reads the scroll values
  35511. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35512. * @return {Object} rect - The modifier rect object
  35513. */
  35514. function includeScroll(rect, element) {
  35515. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35516. var scrollTop = getScroll(element, 'top');
  35517. var scrollLeft = getScroll(element, 'left');
  35518. var modifier = subtract ? -1 : 1;
  35519. rect.top += scrollTop * modifier;
  35520. rect.bottom += scrollTop * modifier;
  35521. rect.left += scrollLeft * modifier;
  35522. rect.right += scrollLeft * modifier;
  35523. return rect;
  35524. }
  35525. /*
  35526. * Helper to detect borders of a given element
  35527. * @method
  35528. * @memberof Popper.Utils
  35529. * @param {CSSStyleDeclaration} styles
  35530. * Result of `getStyleComputedProperty` on the given element
  35531. * @param {String} axis - `x` or `y`
  35532. * @return {number} borders - The borders size of the given axis
  35533. */
  35534. function getBordersSize(styles, axis) {
  35535. var sideA = axis === 'x' ? 'Left' : 'Top';
  35536. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35537. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35538. }
  35539. function getSize(axis, body, html, computedStyle) {
  35540. 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);
  35541. }
  35542. function getWindowSizes(document) {
  35543. var body = document.body;
  35544. var html = document.documentElement;
  35545. var computedStyle = isIE(10) && getComputedStyle(html);
  35546. return {
  35547. height: getSize('Height', body, html, computedStyle),
  35548. width: getSize('Width', body, html, computedStyle)
  35549. };
  35550. }
  35551. var classCallCheck = function (instance, Constructor) {
  35552. if (!(instance instanceof Constructor)) {
  35553. throw new TypeError("Cannot call a class as a function");
  35554. }
  35555. };
  35556. var createClass = function () {
  35557. function defineProperties(target, props) {
  35558. for (var i = 0; i < props.length; i++) {
  35559. var descriptor = props[i];
  35560. descriptor.enumerable = descriptor.enumerable || false;
  35561. descriptor.configurable = true;
  35562. if ("value" in descriptor) descriptor.writable = true;
  35563. Object.defineProperty(target, descriptor.key, descriptor);
  35564. }
  35565. }
  35566. return function (Constructor, protoProps, staticProps) {
  35567. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35568. if (staticProps) defineProperties(Constructor, staticProps);
  35569. return Constructor;
  35570. };
  35571. }();
  35572. var defineProperty = function (obj, key, value) {
  35573. if (key in obj) {
  35574. Object.defineProperty(obj, key, {
  35575. value: value,
  35576. enumerable: true,
  35577. configurable: true,
  35578. writable: true
  35579. });
  35580. } else {
  35581. obj[key] = value;
  35582. }
  35583. return obj;
  35584. };
  35585. var _extends = Object.assign || function (target) {
  35586. for (var i = 1; i < arguments.length; i++) {
  35587. var source = arguments[i];
  35588. for (var key in source) {
  35589. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35590. target[key] = source[key];
  35591. }
  35592. }
  35593. }
  35594. return target;
  35595. };
  35596. /**
  35597. * Given element offsets, generate an output similar to getBoundingClientRect
  35598. * @method
  35599. * @memberof Popper.Utils
  35600. * @argument {Object} offsets
  35601. * @returns {Object} ClientRect like output
  35602. */
  35603. function getClientRect(offsets) {
  35604. return _extends({}, offsets, {
  35605. right: offsets.left + offsets.width,
  35606. bottom: offsets.top + offsets.height
  35607. });
  35608. }
  35609. /**
  35610. * Get bounding client rect of given element
  35611. * @method
  35612. * @memberof Popper.Utils
  35613. * @param {HTMLElement} element
  35614. * @return {Object} client rect
  35615. */
  35616. function getBoundingClientRect(element) {
  35617. var rect = {};
  35618. // IE10 10 FIX: Please, don't ask, the element isn't
  35619. // considered in DOM in some circumstances...
  35620. // This isn't reproducible in IE10 compatibility mode of IE11
  35621. try {
  35622. if (isIE(10)) {
  35623. rect = element.getBoundingClientRect();
  35624. var scrollTop = getScroll(element, 'top');
  35625. var scrollLeft = getScroll(element, 'left');
  35626. rect.top += scrollTop;
  35627. rect.left += scrollLeft;
  35628. rect.bottom += scrollTop;
  35629. rect.right += scrollLeft;
  35630. } else {
  35631. rect = element.getBoundingClientRect();
  35632. }
  35633. } catch (e) {}
  35634. var result = {
  35635. left: rect.left,
  35636. top: rect.top,
  35637. width: rect.right - rect.left,
  35638. height: rect.bottom - rect.top
  35639. };
  35640. // subtract scrollbar size from sizes
  35641. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35642. var width = sizes.width || element.clientWidth || result.width;
  35643. var height = sizes.height || element.clientHeight || result.height;
  35644. var horizScrollbar = element.offsetWidth - width;
  35645. var vertScrollbar = element.offsetHeight - height;
  35646. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35647. // we make this check conditional for performance reasons
  35648. if (horizScrollbar || vertScrollbar) {
  35649. var styles = getStyleComputedProperty(element);
  35650. horizScrollbar -= getBordersSize(styles, 'x');
  35651. vertScrollbar -= getBordersSize(styles, 'y');
  35652. result.width -= horizScrollbar;
  35653. result.height -= vertScrollbar;
  35654. }
  35655. return getClientRect(result);
  35656. }
  35657. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35658. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35659. var isIE10 = isIE(10);
  35660. var isHTML = parent.nodeName === 'HTML';
  35661. var childrenRect = getBoundingClientRect(children);
  35662. var parentRect = getBoundingClientRect(parent);
  35663. var scrollParent = getScrollParent(children);
  35664. var styles = getStyleComputedProperty(parent);
  35665. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35666. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35667. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35668. if (fixedPosition && isHTML) {
  35669. parentRect.top = Math.max(parentRect.top, 0);
  35670. parentRect.left = Math.max(parentRect.left, 0);
  35671. }
  35672. var offsets = getClientRect({
  35673. top: childrenRect.top - parentRect.top - borderTopWidth,
  35674. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35675. width: childrenRect.width,
  35676. height: childrenRect.height
  35677. });
  35678. offsets.marginTop = 0;
  35679. offsets.marginLeft = 0;
  35680. // Subtract margins of documentElement in case it's being used as parent
  35681. // we do this only on HTML because it's the only element that behaves
  35682. // differently when margins are applied to it. The margins are included in
  35683. // the box of the documentElement, in the other cases not.
  35684. if (!isIE10 && isHTML) {
  35685. var marginTop = parseFloat(styles.marginTop);
  35686. var marginLeft = parseFloat(styles.marginLeft);
  35687. offsets.top -= borderTopWidth - marginTop;
  35688. offsets.bottom -= borderTopWidth - marginTop;
  35689. offsets.left -= borderLeftWidth - marginLeft;
  35690. offsets.right -= borderLeftWidth - marginLeft;
  35691. // Attach marginTop and marginLeft because in some circumstances we may need them
  35692. offsets.marginTop = marginTop;
  35693. offsets.marginLeft = marginLeft;
  35694. }
  35695. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35696. offsets = includeScroll(offsets, parent);
  35697. }
  35698. return offsets;
  35699. }
  35700. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35701. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35702. var html = element.ownerDocument.documentElement;
  35703. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35704. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35705. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35706. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35707. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35708. var offset = {
  35709. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35710. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35711. width: width,
  35712. height: height
  35713. };
  35714. return getClientRect(offset);
  35715. }
  35716. /**
  35717. * Check if the given element is fixed or is inside a fixed parent
  35718. * @method
  35719. * @memberof Popper.Utils
  35720. * @argument {Element} element
  35721. * @argument {Element} customContainer
  35722. * @returns {Boolean} answer to "isFixed?"
  35723. */
  35724. function isFixed(element) {
  35725. var nodeName = element.nodeName;
  35726. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35727. return false;
  35728. }
  35729. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35730. return true;
  35731. }
  35732. var parentNode = getParentNode(element);
  35733. if (!parentNode) {
  35734. return false;
  35735. }
  35736. return isFixed(parentNode);
  35737. }
  35738. /**
  35739. * Finds the first parent of an element that has a transformed property defined
  35740. * @method
  35741. * @memberof Popper.Utils
  35742. * @argument {Element} element
  35743. * @returns {Element} first transformed parent or documentElement
  35744. */
  35745. function getFixedPositionOffsetParent(element) {
  35746. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35747. if (!element || !element.parentElement || isIE()) {
  35748. return document.documentElement;
  35749. }
  35750. var el = element.parentElement;
  35751. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35752. el = el.parentElement;
  35753. }
  35754. return el || document.documentElement;
  35755. }
  35756. /**
  35757. * Computed the boundaries limits and return them
  35758. * @method
  35759. * @memberof Popper.Utils
  35760. * @param {HTMLElement} popper
  35761. * @param {HTMLElement} reference
  35762. * @param {number} padding
  35763. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35764. * @param {Boolean} fixedPosition - Is in fixed position mode
  35765. * @returns {Object} Coordinates of the boundaries
  35766. */
  35767. function getBoundaries(popper, reference, padding, boundariesElement) {
  35768. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35769. // NOTE: 1 DOM access here
  35770. var boundaries = { top: 0, left: 0 };
  35771. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35772. // Handle viewport case
  35773. if (boundariesElement === 'viewport') {
  35774. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35775. } else {
  35776. // Handle other cases based on DOM element used as boundaries
  35777. var boundariesNode = void 0;
  35778. if (boundariesElement === 'scrollParent') {
  35779. boundariesNode = getScrollParent(getParentNode(reference));
  35780. if (boundariesNode.nodeName === 'BODY') {
  35781. boundariesNode = popper.ownerDocument.documentElement;
  35782. }
  35783. } else if (boundariesElement === 'window') {
  35784. boundariesNode = popper.ownerDocument.documentElement;
  35785. } else {
  35786. boundariesNode = boundariesElement;
  35787. }
  35788. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35789. // In case of HTML, we need a different computation
  35790. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35791. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35792. height = _getWindowSizes.height,
  35793. width = _getWindowSizes.width;
  35794. boundaries.top += offsets.top - offsets.marginTop;
  35795. boundaries.bottom = height + offsets.top;
  35796. boundaries.left += offsets.left - offsets.marginLeft;
  35797. boundaries.right = width + offsets.left;
  35798. } else {
  35799. // for all the other DOM elements, this one is good
  35800. boundaries = offsets;
  35801. }
  35802. }
  35803. // Add paddings
  35804. padding = padding || 0;
  35805. var isPaddingNumber = typeof padding === 'number';
  35806. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35807. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35808. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35809. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35810. return boundaries;
  35811. }
  35812. function getArea(_ref) {
  35813. var width = _ref.width,
  35814. height = _ref.height;
  35815. return width * height;
  35816. }
  35817. /**
  35818. * Utility used to transform the `auto` placement to the placement with more
  35819. * available space.
  35820. * @method
  35821. * @memberof Popper.Utils
  35822. * @argument {Object} data - The data object generated by update method
  35823. * @argument {Object} options - Modifiers configuration and options
  35824. * @returns {Object} The data object, properly modified
  35825. */
  35826. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35827. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35828. if (placement.indexOf('auto') === -1) {
  35829. return placement;
  35830. }
  35831. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35832. var rects = {
  35833. top: {
  35834. width: boundaries.width,
  35835. height: refRect.top - boundaries.top
  35836. },
  35837. right: {
  35838. width: boundaries.right - refRect.right,
  35839. height: boundaries.height
  35840. },
  35841. bottom: {
  35842. width: boundaries.width,
  35843. height: boundaries.bottom - refRect.bottom
  35844. },
  35845. left: {
  35846. width: refRect.left - boundaries.left,
  35847. height: boundaries.height
  35848. }
  35849. };
  35850. var sortedAreas = Object.keys(rects).map(function (key) {
  35851. return _extends({
  35852. key: key
  35853. }, rects[key], {
  35854. area: getArea(rects[key])
  35855. });
  35856. }).sort(function (a, b) {
  35857. return b.area - a.area;
  35858. });
  35859. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35860. var width = _ref2.width,
  35861. height = _ref2.height;
  35862. return width >= popper.clientWidth && height >= popper.clientHeight;
  35863. });
  35864. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35865. var variation = placement.split('-')[1];
  35866. return computedPlacement + (variation ? '-' + variation : '');
  35867. }
  35868. /**
  35869. * Get offsets to the reference element
  35870. * @method
  35871. * @memberof Popper.Utils
  35872. * @param {Object} state
  35873. * @param {Element} popper - the popper element
  35874. * @param {Element} reference - the reference element (the popper will be relative to this)
  35875. * @param {Element} fixedPosition - is in fixed position mode
  35876. * @returns {Object} An object containing the offsets which will be applied to the popper
  35877. */
  35878. function getReferenceOffsets(state, popper, reference) {
  35879. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35880. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35881. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35882. }
  35883. /**
  35884. * Get the outer sizes of the given element (offset size + margins)
  35885. * @method
  35886. * @memberof Popper.Utils
  35887. * @argument {Element} element
  35888. * @returns {Object} object containing width and height properties
  35889. */
  35890. function getOuterSizes(element) {
  35891. var window = element.ownerDocument.defaultView;
  35892. var styles = window.getComputedStyle(element);
  35893. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35894. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35895. var result = {
  35896. width: element.offsetWidth + y,
  35897. height: element.offsetHeight + x
  35898. };
  35899. return result;
  35900. }
  35901. /**
  35902. * Get the opposite placement of the given one
  35903. * @method
  35904. * @memberof Popper.Utils
  35905. * @argument {String} placement
  35906. * @returns {String} flipped placement
  35907. */
  35908. function getOppositePlacement(placement) {
  35909. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35910. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35911. return hash[matched];
  35912. });
  35913. }
  35914. /**
  35915. * Get offsets to the popper
  35916. * @method
  35917. * @memberof Popper.Utils
  35918. * @param {Object} position - CSS position the Popper will get applied
  35919. * @param {HTMLElement} popper - the popper element
  35920. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35921. * @param {String} placement - one of the valid placement options
  35922. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35923. */
  35924. function getPopperOffsets(popper, referenceOffsets, placement) {
  35925. placement = placement.split('-')[0];
  35926. // Get popper node sizes
  35927. var popperRect = getOuterSizes(popper);
  35928. // Add position, width and height to our offsets object
  35929. var popperOffsets = {
  35930. width: popperRect.width,
  35931. height: popperRect.height
  35932. };
  35933. // depending by the popper placement we have to compute its offsets slightly differently
  35934. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35935. var mainSide = isHoriz ? 'top' : 'left';
  35936. var secondarySide = isHoriz ? 'left' : 'top';
  35937. var measurement = isHoriz ? 'height' : 'width';
  35938. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35939. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35940. if (placement === secondarySide) {
  35941. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35942. } else {
  35943. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35944. }
  35945. return popperOffsets;
  35946. }
  35947. /**
  35948. * Mimics the `find` method of Array
  35949. * @method
  35950. * @memberof Popper.Utils
  35951. * @argument {Array} arr
  35952. * @argument prop
  35953. * @argument value
  35954. * @returns index or -1
  35955. */
  35956. function find(arr, check) {
  35957. // use native find if supported
  35958. if (Array.prototype.find) {
  35959. return arr.find(check);
  35960. }
  35961. // use `filter` to obtain the same behavior of `find`
  35962. return arr.filter(check)[0];
  35963. }
  35964. /**
  35965. * Return the index of the matching object
  35966. * @method
  35967. * @memberof Popper.Utils
  35968. * @argument {Array} arr
  35969. * @argument prop
  35970. * @argument value
  35971. * @returns index or -1
  35972. */
  35973. function findIndex(arr, prop, value) {
  35974. // use native findIndex if supported
  35975. if (Array.prototype.findIndex) {
  35976. return arr.findIndex(function (cur) {
  35977. return cur[prop] === value;
  35978. });
  35979. }
  35980. // use `find` + `indexOf` if `findIndex` isn't supported
  35981. var match = find(arr, function (obj) {
  35982. return obj[prop] === value;
  35983. });
  35984. return arr.indexOf(match);
  35985. }
  35986. /**
  35987. * Loop trough the list of modifiers and run them in order,
  35988. * each of them will then edit the data object.
  35989. * @method
  35990. * @memberof Popper.Utils
  35991. * @param {dataObject} data
  35992. * @param {Array} modifiers
  35993. * @param {String} ends - Optional modifier name used as stopper
  35994. * @returns {dataObject}
  35995. */
  35996. function runModifiers(modifiers, data, ends) {
  35997. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35998. modifiersToRun.forEach(function (modifier) {
  35999. if (modifier['function']) {
  36000. // eslint-disable-line dot-notation
  36001. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  36002. }
  36003. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  36004. if (modifier.enabled && isFunction(fn)) {
  36005. // Add properties to offsets to make them a complete clientRect object
  36006. // we do this before each modifier to make sure the previous one doesn't
  36007. // mess with these values
  36008. data.offsets.popper = getClientRect(data.offsets.popper);
  36009. data.offsets.reference = getClientRect(data.offsets.reference);
  36010. data = fn(data, modifier);
  36011. }
  36012. });
  36013. return data;
  36014. }
  36015. /**
  36016. * Updates the position of the popper, computing the new offsets and applying
  36017. * the new style.<br />
  36018. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36019. * @method
  36020. * @memberof Popper
  36021. */
  36022. function update() {
  36023. // if popper is destroyed, don't perform any further update
  36024. if (this.state.isDestroyed) {
  36025. return;
  36026. }
  36027. var data = {
  36028. instance: this,
  36029. styles: {},
  36030. arrowStyles: {},
  36031. attributes: {},
  36032. flipped: false,
  36033. offsets: {}
  36034. };
  36035. // compute reference element offsets
  36036. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36037. // compute auto placement, store placement inside the data object,
  36038. // modifiers will be able to edit `placement` if needed
  36039. // and refer to originalPlacement to know the original value
  36040. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36041. // store the computed placement inside `originalPlacement`
  36042. data.originalPlacement = data.placement;
  36043. data.positionFixed = this.options.positionFixed;
  36044. // compute the popper offsets
  36045. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36046. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36047. // run the modifiers
  36048. data = runModifiers(this.modifiers, data);
  36049. // the first `update` will call `onCreate` callback
  36050. // the other ones will call `onUpdate` callback
  36051. if (!this.state.isCreated) {
  36052. this.state.isCreated = true;
  36053. this.options.onCreate(data);
  36054. } else {
  36055. this.options.onUpdate(data);
  36056. }
  36057. }
  36058. /**
  36059. * Helper used to know if the given modifier is enabled.
  36060. * @method
  36061. * @memberof Popper.Utils
  36062. * @returns {Boolean}
  36063. */
  36064. function isModifierEnabled(modifiers, modifierName) {
  36065. return modifiers.some(function (_ref) {
  36066. var name = _ref.name,
  36067. enabled = _ref.enabled;
  36068. return enabled && name === modifierName;
  36069. });
  36070. }
  36071. /**
  36072. * Get the prefixed supported property name
  36073. * @method
  36074. * @memberof Popper.Utils
  36075. * @argument {String} property (camelCase)
  36076. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36077. */
  36078. function getSupportedPropertyName(property) {
  36079. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36080. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36081. for (var i = 0; i < prefixes.length; i++) {
  36082. var prefix = prefixes[i];
  36083. var toCheck = prefix ? '' + prefix + upperProp : property;
  36084. if (typeof document.body.style[toCheck] !== 'undefined') {
  36085. return toCheck;
  36086. }
  36087. }
  36088. return null;
  36089. }
  36090. /**
  36091. * Destroys the popper.
  36092. * @method
  36093. * @memberof Popper
  36094. */
  36095. function destroy() {
  36096. this.state.isDestroyed = true;
  36097. // touch DOM only if `applyStyle` modifier is enabled
  36098. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36099. this.popper.removeAttribute('x-placement');
  36100. this.popper.style.position = '';
  36101. this.popper.style.top = '';
  36102. this.popper.style.left = '';
  36103. this.popper.style.right = '';
  36104. this.popper.style.bottom = '';
  36105. this.popper.style.willChange = '';
  36106. this.popper.style[getSupportedPropertyName('transform')] = '';
  36107. }
  36108. this.disableEventListeners();
  36109. // remove the popper if user explicitly asked for the deletion on destroy
  36110. // do not use `remove` because IE11 doesn't support it
  36111. if (this.options.removeOnDestroy) {
  36112. this.popper.parentNode.removeChild(this.popper);
  36113. }
  36114. return this;
  36115. }
  36116. /**
  36117. * Get the window associated with the element
  36118. * @argument {Element} element
  36119. * @returns {Window}
  36120. */
  36121. function getWindow(element) {
  36122. var ownerDocument = element.ownerDocument;
  36123. return ownerDocument ? ownerDocument.defaultView : window;
  36124. }
  36125. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36126. var isBody = scrollParent.nodeName === 'BODY';
  36127. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36128. target.addEventListener(event, callback, { passive: true });
  36129. if (!isBody) {
  36130. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36131. }
  36132. scrollParents.push(target);
  36133. }
  36134. /**
  36135. * Setup needed event listeners used to update the popper position
  36136. * @method
  36137. * @memberof Popper.Utils
  36138. * @private
  36139. */
  36140. function setupEventListeners(reference, options, state, updateBound) {
  36141. // Resize event listener on window
  36142. state.updateBound = updateBound;
  36143. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36144. // Scroll event listener on scroll parents
  36145. var scrollElement = getScrollParent(reference);
  36146. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36147. state.scrollElement = scrollElement;
  36148. state.eventsEnabled = true;
  36149. return state;
  36150. }
  36151. /**
  36152. * It will add resize/scroll events and start recalculating
  36153. * position of the popper element when they are triggered.
  36154. * @method
  36155. * @memberof Popper
  36156. */
  36157. function enableEventListeners() {
  36158. if (!this.state.eventsEnabled) {
  36159. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36160. }
  36161. }
  36162. /**
  36163. * Remove event listeners used to update the popper position
  36164. * @method
  36165. * @memberof Popper.Utils
  36166. * @private
  36167. */
  36168. function removeEventListeners(reference, state) {
  36169. // Remove resize event listener on window
  36170. getWindow(reference).removeEventListener('resize', state.updateBound);
  36171. // Remove scroll event listener on scroll parents
  36172. state.scrollParents.forEach(function (target) {
  36173. target.removeEventListener('scroll', state.updateBound);
  36174. });
  36175. // Reset state
  36176. state.updateBound = null;
  36177. state.scrollParents = [];
  36178. state.scrollElement = null;
  36179. state.eventsEnabled = false;
  36180. return state;
  36181. }
  36182. /**
  36183. * It will remove resize/scroll events and won't recalculate popper position
  36184. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36185. * unless you call `update` method manually.
  36186. * @method
  36187. * @memberof Popper
  36188. */
  36189. function disableEventListeners() {
  36190. if (this.state.eventsEnabled) {
  36191. cancelAnimationFrame(this.scheduleUpdate);
  36192. this.state = removeEventListeners(this.reference, this.state);
  36193. }
  36194. }
  36195. /**
  36196. * Tells if a given input is a number
  36197. * @method
  36198. * @memberof Popper.Utils
  36199. * @param {*} input to check
  36200. * @return {Boolean}
  36201. */
  36202. function isNumeric(n) {
  36203. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36204. }
  36205. /**
  36206. * Set the style to the given popper
  36207. * @method
  36208. * @memberof Popper.Utils
  36209. * @argument {Element} element - Element to apply the style to
  36210. * @argument {Object} styles
  36211. * Object with a list of properties and values which will be applied to the element
  36212. */
  36213. function setStyles(element, styles) {
  36214. Object.keys(styles).forEach(function (prop) {
  36215. var unit = '';
  36216. // add unit if the value is numeric and is one of the following
  36217. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36218. unit = 'px';
  36219. }
  36220. element.style[prop] = styles[prop] + unit;
  36221. });
  36222. }
  36223. /**
  36224. * Set the attributes to the given popper
  36225. * @method
  36226. * @memberof Popper.Utils
  36227. * @argument {Element} element - Element to apply the attributes to
  36228. * @argument {Object} styles
  36229. * Object with a list of properties and values which will be applied to the element
  36230. */
  36231. function setAttributes(element, attributes) {
  36232. Object.keys(attributes).forEach(function (prop) {
  36233. var value = attributes[prop];
  36234. if (value !== false) {
  36235. element.setAttribute(prop, attributes[prop]);
  36236. } else {
  36237. element.removeAttribute(prop);
  36238. }
  36239. });
  36240. }
  36241. /**
  36242. * @function
  36243. * @memberof Modifiers
  36244. * @argument {Object} data - The data object generated by `update` method
  36245. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36246. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36247. * @argument {Object} options - Modifiers configuration and options
  36248. * @returns {Object} The same data object
  36249. */
  36250. function applyStyle(data) {
  36251. // any property present in `data.styles` will be applied to the popper,
  36252. // in this way we can make the 3rd party modifiers add custom styles to it
  36253. // Be aware, modifiers could override the properties defined in the previous
  36254. // lines of this modifier!
  36255. setStyles(data.instance.popper, data.styles);
  36256. // any property present in `data.attributes` will be applied to the popper,
  36257. // they will be set as HTML attributes of the element
  36258. setAttributes(data.instance.popper, data.attributes);
  36259. // if arrowElement is defined and arrowStyles has some properties
  36260. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36261. setStyles(data.arrowElement, data.arrowStyles);
  36262. }
  36263. return data;
  36264. }
  36265. /**
  36266. * Set the x-placement attribute before everything else because it could be used
  36267. * to add margins to the popper margins needs to be calculated to get the
  36268. * correct popper offsets.
  36269. * @method
  36270. * @memberof Popper.modifiers
  36271. * @param {HTMLElement} reference - The reference element used to position the popper
  36272. * @param {HTMLElement} popper - The HTML element used as popper
  36273. * @param {Object} options - Popper.js options
  36274. */
  36275. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36276. // compute reference element offsets
  36277. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36278. // compute auto placement, store placement inside the data object,
  36279. // modifiers will be able to edit `placement` if needed
  36280. // and refer to originalPlacement to know the original value
  36281. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36282. popper.setAttribute('x-placement', placement);
  36283. // Apply `position` to popper before anything else because
  36284. // without the position applied we can't guarantee correct computations
  36285. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36286. return options;
  36287. }
  36288. /**
  36289. * @function
  36290. * @memberof Popper.Utils
  36291. * @argument {Object} data - The data object generated by `update` method
  36292. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36293. * @returns {Object} The popper's position offsets rounded
  36294. *
  36295. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36296. * good as it can be within reason.
  36297. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36298. *
  36299. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36300. * as well on High DPI screens).
  36301. *
  36302. * Firefox prefers no rounding for positioning and does not have blurriness on
  36303. * high DPI screens.
  36304. *
  36305. * Only horizontal placement and left/right values need to be considered.
  36306. */
  36307. function getRoundedOffsets(data, shouldRound) {
  36308. var _data$offsets = data.offsets,
  36309. popper = _data$offsets.popper,
  36310. reference = _data$offsets.reference;
  36311. var round = Math.round,
  36312. floor = Math.floor;
  36313. var noRound = function noRound(v) {
  36314. return v;
  36315. };
  36316. var referenceWidth = round(reference.width);
  36317. var popperWidth = round(popper.width);
  36318. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36319. var isVariation = data.placement.indexOf('-') !== -1;
  36320. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36321. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36322. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36323. var verticalToInteger = !shouldRound ? noRound : round;
  36324. return {
  36325. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36326. top: verticalToInteger(popper.top),
  36327. bottom: verticalToInteger(popper.bottom),
  36328. right: horizontalToInteger(popper.right)
  36329. };
  36330. }
  36331. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36332. /**
  36333. * @function
  36334. * @memberof Modifiers
  36335. * @argument {Object} data - The data object generated by `update` method
  36336. * @argument {Object} options - Modifiers configuration and options
  36337. * @returns {Object} The data object, properly modified
  36338. */
  36339. function computeStyle(data, options) {
  36340. var x = options.x,
  36341. y = options.y;
  36342. var popper = data.offsets.popper;
  36343. // Remove this legacy support in Popper.js v2
  36344. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36345. return modifier.name === 'applyStyle';
  36346. }).gpuAcceleration;
  36347. if (legacyGpuAccelerationOption !== undefined) {
  36348. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36349. }
  36350. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36351. var offsetParent = getOffsetParent(data.instance.popper);
  36352. var offsetParentRect = getBoundingClientRect(offsetParent);
  36353. // Styles
  36354. var styles = {
  36355. position: popper.position
  36356. };
  36357. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36358. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36359. var sideB = y === 'right' ? 'left' : 'right';
  36360. // if gpuAcceleration is set to `true` and transform is supported,
  36361. // we use `translate3d` to apply the position to the popper we
  36362. // automatically use the supported prefixed version if needed
  36363. var prefixedProperty = getSupportedPropertyName('transform');
  36364. // now, let's make a step back and look at this code closely (wtf?)
  36365. // If the content of the popper grows once it's been positioned, it
  36366. // may happen that the popper gets misplaced because of the new content
  36367. // overflowing its reference element
  36368. // To avoid this problem, we provide two options (x and y), which allow
  36369. // the consumer to define the offset origin.
  36370. // If we position a popper on top of a reference element, we can set
  36371. // `x` to `top` to make the popper grow towards its top instead of
  36372. // its bottom.
  36373. var left = void 0,
  36374. top = void 0;
  36375. if (sideA === 'bottom') {
  36376. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36377. // and not the bottom of the html element
  36378. if (offsetParent.nodeName === 'HTML') {
  36379. top = -offsetParent.clientHeight + offsets.bottom;
  36380. } else {
  36381. top = -offsetParentRect.height + offsets.bottom;
  36382. }
  36383. } else {
  36384. top = offsets.top;
  36385. }
  36386. if (sideB === 'right') {
  36387. if (offsetParent.nodeName === 'HTML') {
  36388. left = -offsetParent.clientWidth + offsets.right;
  36389. } else {
  36390. left = -offsetParentRect.width + offsets.right;
  36391. }
  36392. } else {
  36393. left = offsets.left;
  36394. }
  36395. if (gpuAcceleration && prefixedProperty) {
  36396. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36397. styles[sideA] = 0;
  36398. styles[sideB] = 0;
  36399. styles.willChange = 'transform';
  36400. } else {
  36401. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36402. var invertTop = sideA === 'bottom' ? -1 : 1;
  36403. var invertLeft = sideB === 'right' ? -1 : 1;
  36404. styles[sideA] = top * invertTop;
  36405. styles[sideB] = left * invertLeft;
  36406. styles.willChange = sideA + ', ' + sideB;
  36407. }
  36408. // Attributes
  36409. var attributes = {
  36410. 'x-placement': data.placement
  36411. };
  36412. // Update `data` attributes, styles and arrowStyles
  36413. data.attributes = _extends({}, attributes, data.attributes);
  36414. data.styles = _extends({}, styles, data.styles);
  36415. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36416. return data;
  36417. }
  36418. /**
  36419. * Helper used to know if the given modifier depends from another one.<br />
  36420. * It checks if the needed modifier is listed and enabled.
  36421. * @method
  36422. * @memberof Popper.Utils
  36423. * @param {Array} modifiers - list of modifiers
  36424. * @param {String} requestingName - name of requesting modifier
  36425. * @param {String} requestedName - name of requested modifier
  36426. * @returns {Boolean}
  36427. */
  36428. function isModifierRequired(modifiers, requestingName, requestedName) {
  36429. var requesting = find(modifiers, function (_ref) {
  36430. var name = _ref.name;
  36431. return name === requestingName;
  36432. });
  36433. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36434. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36435. });
  36436. if (!isRequired) {
  36437. var _requesting = '`' + requestingName + '`';
  36438. var requested = '`' + requestedName + '`';
  36439. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36440. }
  36441. return isRequired;
  36442. }
  36443. /**
  36444. * @function
  36445. * @memberof Modifiers
  36446. * @argument {Object} data - The data object generated by update method
  36447. * @argument {Object} options - Modifiers configuration and options
  36448. * @returns {Object} The data object, properly modified
  36449. */
  36450. function arrow(data, options) {
  36451. var _data$offsets$arrow;
  36452. // arrow depends on keepTogether in order to work
  36453. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36454. return data;
  36455. }
  36456. var arrowElement = options.element;
  36457. // if arrowElement is a string, suppose it's a CSS selector
  36458. if (typeof arrowElement === 'string') {
  36459. arrowElement = data.instance.popper.querySelector(arrowElement);
  36460. // if arrowElement is not found, don't run the modifier
  36461. if (!arrowElement) {
  36462. return data;
  36463. }
  36464. } else {
  36465. // if the arrowElement isn't a query selector we must check that the
  36466. // provided DOM node is child of its popper node
  36467. if (!data.instance.popper.contains(arrowElement)) {
  36468. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36469. return data;
  36470. }
  36471. }
  36472. var placement = data.placement.split('-')[0];
  36473. var _data$offsets = data.offsets,
  36474. popper = _data$offsets.popper,
  36475. reference = _data$offsets.reference;
  36476. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36477. var len = isVertical ? 'height' : 'width';
  36478. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36479. var side = sideCapitalized.toLowerCase();
  36480. var altSide = isVertical ? 'left' : 'top';
  36481. var opSide = isVertical ? 'bottom' : 'right';
  36482. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36483. //
  36484. // extends keepTogether behavior making sure the popper and its
  36485. // reference have enough pixels in conjunction
  36486. //
  36487. // top/left side
  36488. if (reference[opSide] - arrowElementSize < popper[side]) {
  36489. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36490. }
  36491. // bottom/right side
  36492. if (reference[side] + arrowElementSize > popper[opSide]) {
  36493. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36494. }
  36495. data.offsets.popper = getClientRect(data.offsets.popper);
  36496. // compute center of the popper
  36497. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36498. // Compute the sideValue using the updated popper offsets
  36499. // take popper margin in account because we don't have this info available
  36500. var css = getStyleComputedProperty(data.instance.popper);
  36501. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36502. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36503. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36504. // prevent arrowElement from being placed not contiguously to its popper
  36505. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36506. data.arrowElement = arrowElement;
  36507. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36508. return data;
  36509. }
  36510. /**
  36511. * Get the opposite placement variation of the given one
  36512. * @method
  36513. * @memberof Popper.Utils
  36514. * @argument {String} placement variation
  36515. * @returns {String} flipped placement variation
  36516. */
  36517. function getOppositeVariation(variation) {
  36518. if (variation === 'end') {
  36519. return 'start';
  36520. } else if (variation === 'start') {
  36521. return 'end';
  36522. }
  36523. return variation;
  36524. }
  36525. /**
  36526. * List of accepted placements to use as values of the `placement` option.<br />
  36527. * Valid placements are:
  36528. * - `auto`
  36529. * - `top`
  36530. * - `right`
  36531. * - `bottom`
  36532. * - `left`
  36533. *
  36534. * Each placement can have a variation from this list:
  36535. * - `-start`
  36536. * - `-end`
  36537. *
  36538. * Variations are interpreted easily if you think of them as the left to right
  36539. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36540. * is right.<br />
  36541. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36542. *
  36543. * Some valid examples are:
  36544. * - `top-end` (on top of reference, right aligned)
  36545. * - `right-start` (on right of reference, top aligned)
  36546. * - `bottom` (on bottom, centered)
  36547. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36548. *
  36549. * @static
  36550. * @type {Array}
  36551. * @enum {String}
  36552. * @readonly
  36553. * @method placements
  36554. * @memberof Popper
  36555. */
  36556. 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'];
  36557. // Get rid of `auto` `auto-start` and `auto-end`
  36558. var validPlacements = placements.slice(3);
  36559. /**
  36560. * Given an initial placement, returns all the subsequent placements
  36561. * clockwise (or counter-clockwise).
  36562. *
  36563. * @method
  36564. * @memberof Popper.Utils
  36565. * @argument {String} placement - A valid placement (it accepts variations)
  36566. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36567. * @returns {Array} placements including their variations
  36568. */
  36569. function clockwise(placement) {
  36570. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36571. var index = validPlacements.indexOf(placement);
  36572. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36573. return counter ? arr.reverse() : arr;
  36574. }
  36575. var BEHAVIORS = {
  36576. FLIP: 'flip',
  36577. CLOCKWISE: 'clockwise',
  36578. COUNTERCLOCKWISE: 'counterclockwise'
  36579. };
  36580. /**
  36581. * @function
  36582. * @memberof Modifiers
  36583. * @argument {Object} data - The data object generated by update method
  36584. * @argument {Object} options - Modifiers configuration and options
  36585. * @returns {Object} The data object, properly modified
  36586. */
  36587. function flip(data, options) {
  36588. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36589. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36590. return data;
  36591. }
  36592. if (data.flipped && data.placement === data.originalPlacement) {
  36593. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36594. return data;
  36595. }
  36596. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36597. var placement = data.placement.split('-')[0];
  36598. var placementOpposite = getOppositePlacement(placement);
  36599. var variation = data.placement.split('-')[1] || '';
  36600. var flipOrder = [];
  36601. switch (options.behavior) {
  36602. case BEHAVIORS.FLIP:
  36603. flipOrder = [placement, placementOpposite];
  36604. break;
  36605. case BEHAVIORS.CLOCKWISE:
  36606. flipOrder = clockwise(placement);
  36607. break;
  36608. case BEHAVIORS.COUNTERCLOCKWISE:
  36609. flipOrder = clockwise(placement, true);
  36610. break;
  36611. default:
  36612. flipOrder = options.behavior;
  36613. }
  36614. flipOrder.forEach(function (step, index) {
  36615. if (placement !== step || flipOrder.length === index + 1) {
  36616. return data;
  36617. }
  36618. placement = data.placement.split('-')[0];
  36619. placementOpposite = getOppositePlacement(placement);
  36620. var popperOffsets = data.offsets.popper;
  36621. var refOffsets = data.offsets.reference;
  36622. // using floor because the reference offsets may contain decimals we are not going to consider here
  36623. var floor = Math.floor;
  36624. 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);
  36625. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36626. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36627. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36628. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36629. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36630. // flip the variation if required
  36631. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36632. // flips variation if reference element overflows boundaries
  36633. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36634. // flips variation if popper content overflows boundaries
  36635. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36636. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36637. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36638. // this boolean to detect any flip loop
  36639. data.flipped = true;
  36640. if (overlapsRef || overflowsBoundaries) {
  36641. placement = flipOrder[index + 1];
  36642. }
  36643. if (flippedVariation) {
  36644. variation = getOppositeVariation(variation);
  36645. }
  36646. data.placement = placement + (variation ? '-' + variation : '');
  36647. // this object contains `position`, we want to preserve it along with
  36648. // any additional property we may add in the future
  36649. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36650. data = runModifiers(data.instance.modifiers, data, 'flip');
  36651. }
  36652. });
  36653. return data;
  36654. }
  36655. /**
  36656. * @function
  36657. * @memberof Modifiers
  36658. * @argument {Object} data - The data object generated by update method
  36659. * @argument {Object} options - Modifiers configuration and options
  36660. * @returns {Object} The data object, properly modified
  36661. */
  36662. function keepTogether(data) {
  36663. var _data$offsets = data.offsets,
  36664. popper = _data$offsets.popper,
  36665. reference = _data$offsets.reference;
  36666. var placement = data.placement.split('-')[0];
  36667. var floor = Math.floor;
  36668. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36669. var side = isVertical ? 'right' : 'bottom';
  36670. var opSide = isVertical ? 'left' : 'top';
  36671. var measurement = isVertical ? 'width' : 'height';
  36672. if (popper[side] < floor(reference[opSide])) {
  36673. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36674. }
  36675. if (popper[opSide] > floor(reference[side])) {
  36676. data.offsets.popper[opSide] = floor(reference[side]);
  36677. }
  36678. return data;
  36679. }
  36680. /**
  36681. * Converts a string containing value + unit into a px value number
  36682. * @function
  36683. * @memberof {modifiers~offset}
  36684. * @private
  36685. * @argument {String} str - Value + unit string
  36686. * @argument {String} measurement - `height` or `width`
  36687. * @argument {Object} popperOffsets
  36688. * @argument {Object} referenceOffsets
  36689. * @returns {Number|String}
  36690. * Value in pixels, or original string if no values were extracted
  36691. */
  36692. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36693. // separate value from unit
  36694. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36695. var value = +split[1];
  36696. var unit = split[2];
  36697. // If it's not a number it's an operator, I guess
  36698. if (!value) {
  36699. return str;
  36700. }
  36701. if (unit.indexOf('%') === 0) {
  36702. var element = void 0;
  36703. switch (unit) {
  36704. case '%p':
  36705. element = popperOffsets;
  36706. break;
  36707. case '%':
  36708. case '%r':
  36709. default:
  36710. element = referenceOffsets;
  36711. }
  36712. var rect = getClientRect(element);
  36713. return rect[measurement] / 100 * value;
  36714. } else if (unit === 'vh' || unit === 'vw') {
  36715. // if is a vh or vw, we calculate the size based on the viewport
  36716. var size = void 0;
  36717. if (unit === 'vh') {
  36718. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36719. } else {
  36720. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36721. }
  36722. return size / 100 * value;
  36723. } else {
  36724. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36725. // if is an implicit unit, it's px, and we return just the value
  36726. return value;
  36727. }
  36728. }
  36729. /**
  36730. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36731. * @function
  36732. * @memberof {modifiers~offset}
  36733. * @private
  36734. * @argument {String} offset
  36735. * @argument {Object} popperOffsets
  36736. * @argument {Object} referenceOffsets
  36737. * @argument {String} basePlacement
  36738. * @returns {Array} a two cells array with x and y offsets in numbers
  36739. */
  36740. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36741. var offsets = [0, 0];
  36742. // Use height if placement is left or right and index is 0 otherwise use width
  36743. // in this way the first offset will use an axis and the second one
  36744. // will use the other one
  36745. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36746. // Split the offset string to obtain a list of values and operands
  36747. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36748. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36749. return frag.trim();
  36750. });
  36751. // Detect if the offset string contains a pair of values or a single one
  36752. // they could be separated by comma or space
  36753. var divider = fragments.indexOf(find(fragments, function (frag) {
  36754. return frag.search(/,|\s/) !== -1;
  36755. }));
  36756. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36757. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36758. }
  36759. // If divider is found, we divide the list of values and operands to divide
  36760. // them by ofset X and Y.
  36761. var splitRegex = /\s*,\s*|\s+/;
  36762. 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];
  36763. // Convert the values with units to absolute pixels to allow our computations
  36764. ops = ops.map(function (op, index) {
  36765. // Most of the units rely on the orientation of the popper
  36766. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36767. var mergeWithPrevious = false;
  36768. return op
  36769. // This aggregates any `+` or `-` sign that aren't considered operators
  36770. // e.g.: 10 + +5 => [10, +, +5]
  36771. .reduce(function (a, b) {
  36772. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36773. a[a.length - 1] = b;
  36774. mergeWithPrevious = true;
  36775. return a;
  36776. } else if (mergeWithPrevious) {
  36777. a[a.length - 1] += b;
  36778. mergeWithPrevious = false;
  36779. return a;
  36780. } else {
  36781. return a.concat(b);
  36782. }
  36783. }, [])
  36784. // Here we convert the string values into number values (in px)
  36785. .map(function (str) {
  36786. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36787. });
  36788. });
  36789. // Loop trough the offsets arrays and execute the operations
  36790. ops.forEach(function (op, index) {
  36791. op.forEach(function (frag, index2) {
  36792. if (isNumeric(frag)) {
  36793. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36794. }
  36795. });
  36796. });
  36797. return offsets;
  36798. }
  36799. /**
  36800. * @function
  36801. * @memberof Modifiers
  36802. * @argument {Object} data - The data object generated by update method
  36803. * @argument {Object} options - Modifiers configuration and options
  36804. * @argument {Number|String} options.offset=0
  36805. * The offset value as described in the modifier description
  36806. * @returns {Object} The data object, properly modified
  36807. */
  36808. function offset(data, _ref) {
  36809. var offset = _ref.offset;
  36810. var placement = data.placement,
  36811. _data$offsets = data.offsets,
  36812. popper = _data$offsets.popper,
  36813. reference = _data$offsets.reference;
  36814. var basePlacement = placement.split('-')[0];
  36815. var offsets = void 0;
  36816. if (isNumeric(+offset)) {
  36817. offsets = [+offset, 0];
  36818. } else {
  36819. offsets = parseOffset(offset, popper, reference, basePlacement);
  36820. }
  36821. if (basePlacement === 'left') {
  36822. popper.top += offsets[0];
  36823. popper.left -= offsets[1];
  36824. } else if (basePlacement === 'right') {
  36825. popper.top += offsets[0];
  36826. popper.left += offsets[1];
  36827. } else if (basePlacement === 'top') {
  36828. popper.left += offsets[0];
  36829. popper.top -= offsets[1];
  36830. } else if (basePlacement === 'bottom') {
  36831. popper.left += offsets[0];
  36832. popper.top += offsets[1];
  36833. }
  36834. data.popper = popper;
  36835. return data;
  36836. }
  36837. /**
  36838. * @function
  36839. * @memberof Modifiers
  36840. * @argument {Object} data - The data object generated by `update` method
  36841. * @argument {Object} options - Modifiers configuration and options
  36842. * @returns {Object} The data object, properly modified
  36843. */
  36844. function preventOverflow(data, options) {
  36845. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36846. // If offsetParent is the reference element, we really want to
  36847. // go one step up and use the next offsetParent as reference to
  36848. // avoid to make this modifier completely useless and look like broken
  36849. if (data.instance.reference === boundariesElement) {
  36850. boundariesElement = getOffsetParent(boundariesElement);
  36851. }
  36852. // NOTE: DOM access here
  36853. // resets the popper's position so that the document size can be calculated excluding
  36854. // the size of the popper element itself
  36855. var transformProp = getSupportedPropertyName('transform');
  36856. var popperStyles = data.instance.popper.style; // assignment to help minification
  36857. var top = popperStyles.top,
  36858. left = popperStyles.left,
  36859. transform = popperStyles[transformProp];
  36860. popperStyles.top = '';
  36861. popperStyles.left = '';
  36862. popperStyles[transformProp] = '';
  36863. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36864. // NOTE: DOM access here
  36865. // restores the original style properties after the offsets have been computed
  36866. popperStyles.top = top;
  36867. popperStyles.left = left;
  36868. popperStyles[transformProp] = transform;
  36869. options.boundaries = boundaries;
  36870. var order = options.priority;
  36871. var popper = data.offsets.popper;
  36872. var check = {
  36873. primary: function primary(placement) {
  36874. var value = popper[placement];
  36875. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36876. value = Math.max(popper[placement], boundaries[placement]);
  36877. }
  36878. return defineProperty({}, placement, value);
  36879. },
  36880. secondary: function secondary(placement) {
  36881. var mainSide = placement === 'right' ? 'left' : 'top';
  36882. var value = popper[mainSide];
  36883. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36884. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36885. }
  36886. return defineProperty({}, mainSide, value);
  36887. }
  36888. };
  36889. order.forEach(function (placement) {
  36890. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36891. popper = _extends({}, popper, check[side](placement));
  36892. });
  36893. data.offsets.popper = popper;
  36894. return data;
  36895. }
  36896. /**
  36897. * @function
  36898. * @memberof Modifiers
  36899. * @argument {Object} data - The data object generated by `update` method
  36900. * @argument {Object} options - Modifiers configuration and options
  36901. * @returns {Object} The data object, properly modified
  36902. */
  36903. function shift(data) {
  36904. var placement = data.placement;
  36905. var basePlacement = placement.split('-')[0];
  36906. var shiftvariation = placement.split('-')[1];
  36907. // if shift shiftvariation is specified, run the modifier
  36908. if (shiftvariation) {
  36909. var _data$offsets = data.offsets,
  36910. reference = _data$offsets.reference,
  36911. popper = _data$offsets.popper;
  36912. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36913. var side = isVertical ? 'left' : 'top';
  36914. var measurement = isVertical ? 'width' : 'height';
  36915. var shiftOffsets = {
  36916. start: defineProperty({}, side, reference[side]),
  36917. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36918. };
  36919. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36920. }
  36921. return data;
  36922. }
  36923. /**
  36924. * @function
  36925. * @memberof Modifiers
  36926. * @argument {Object} data - The data object generated by update method
  36927. * @argument {Object} options - Modifiers configuration and options
  36928. * @returns {Object} The data object, properly modified
  36929. */
  36930. function hide(data) {
  36931. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36932. return data;
  36933. }
  36934. var refRect = data.offsets.reference;
  36935. var bound = find(data.instance.modifiers, function (modifier) {
  36936. return modifier.name === 'preventOverflow';
  36937. }).boundaries;
  36938. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36939. // Avoid unnecessary DOM access if visibility hasn't changed
  36940. if (data.hide === true) {
  36941. return data;
  36942. }
  36943. data.hide = true;
  36944. data.attributes['x-out-of-boundaries'] = '';
  36945. } else {
  36946. // Avoid unnecessary DOM access if visibility hasn't changed
  36947. if (data.hide === false) {
  36948. return data;
  36949. }
  36950. data.hide = false;
  36951. data.attributes['x-out-of-boundaries'] = false;
  36952. }
  36953. return data;
  36954. }
  36955. /**
  36956. * @function
  36957. * @memberof Modifiers
  36958. * @argument {Object} data - The data object generated by `update` method
  36959. * @argument {Object} options - Modifiers configuration and options
  36960. * @returns {Object} The data object, properly modified
  36961. */
  36962. function inner(data) {
  36963. var placement = data.placement;
  36964. var basePlacement = placement.split('-')[0];
  36965. var _data$offsets = data.offsets,
  36966. popper = _data$offsets.popper,
  36967. reference = _data$offsets.reference;
  36968. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36969. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36970. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36971. data.placement = getOppositePlacement(placement);
  36972. data.offsets.popper = getClientRect(popper);
  36973. return data;
  36974. }
  36975. /**
  36976. * Modifier function, each modifier can have a function of this type assigned
  36977. * to its `fn` property.<br />
  36978. * These functions will be called on each update, this means that you must
  36979. * make sure they are performant enough to avoid performance bottlenecks.
  36980. *
  36981. * @function ModifierFn
  36982. * @argument {dataObject} data - The data object generated by `update` method
  36983. * @argument {Object} options - Modifiers configuration and options
  36984. * @returns {dataObject} The data object, properly modified
  36985. */
  36986. /**
  36987. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36988. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36989. * needed by the library.
  36990. *
  36991. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36992. * All the other properties are configurations that could be tweaked.
  36993. * @namespace modifiers
  36994. */
  36995. var modifiers = {
  36996. /**
  36997. * Modifier used to shift the popper on the start or end of its reference
  36998. * element.<br />
  36999. * It will read the variation of the `placement` property.<br />
  37000. * It can be one either `-end` or `-start`.
  37001. * @memberof modifiers
  37002. * @inner
  37003. */
  37004. shift: {
  37005. /** @prop {number} order=100 - Index used to define the order of execution */
  37006. order: 100,
  37007. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37008. enabled: true,
  37009. /** @prop {ModifierFn} */
  37010. fn: shift
  37011. },
  37012. /**
  37013. * The `offset` modifier can shift your popper on both its axis.
  37014. *
  37015. * It accepts the following units:
  37016. * - `px` or unit-less, interpreted as pixels
  37017. * - `%` or `%r`, percentage relative to the length of the reference element
  37018. * - `%p`, percentage relative to the length of the popper element
  37019. * - `vw`, CSS viewport width unit
  37020. * - `vh`, CSS viewport height unit
  37021. *
  37022. * For length is intended the main axis relative to the placement of the popper.<br />
  37023. * This means that if the placement is `top` or `bottom`, the length will be the
  37024. * `width`. In case of `left` or `right`, it will be the `height`.
  37025. *
  37026. * You can provide a single value (as `Number` or `String`), or a pair of values
  37027. * as `String` divided by a comma or one (or more) white spaces.<br />
  37028. * The latter is a deprecated method because it leads to confusion and will be
  37029. * removed in v2.<br />
  37030. * Additionally, it accepts additions and subtractions between different units.
  37031. * Note that multiplications and divisions aren't supported.
  37032. *
  37033. * Valid examples are:
  37034. * ```
  37035. * 10
  37036. * '10%'
  37037. * '10, 10'
  37038. * '10%, 10'
  37039. * '10 + 10%'
  37040. * '10 - 5vh + 3%'
  37041. * '-10px + 5vh, 5px - 6%'
  37042. * ```
  37043. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37044. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37045. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37046. *
  37047. * @memberof modifiers
  37048. * @inner
  37049. */
  37050. offset: {
  37051. /** @prop {number} order=200 - Index used to define the order of execution */
  37052. order: 200,
  37053. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37054. enabled: true,
  37055. /** @prop {ModifierFn} */
  37056. fn: offset,
  37057. /** @prop {Number|String} offset=0
  37058. * The offset value as described in the modifier description
  37059. */
  37060. offset: 0
  37061. },
  37062. /**
  37063. * Modifier used to prevent the popper from being positioned outside the boundary.
  37064. *
  37065. * A scenario exists where the reference itself is not within the boundaries.<br />
  37066. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37067. * In this case we need to decide whether the popper should either:
  37068. *
  37069. * - detach from the reference and remain "trapped" in the boundaries, or
  37070. * - if it should ignore the boundary and "escape with its reference"
  37071. *
  37072. * When `escapeWithReference` is set to`true` and reference is completely
  37073. * outside its boundaries, the popper will overflow (or completely leave)
  37074. * the boundaries in order to remain attached to the edge of the reference.
  37075. *
  37076. * @memberof modifiers
  37077. * @inner
  37078. */
  37079. preventOverflow: {
  37080. /** @prop {number} order=300 - Index used to define the order of execution */
  37081. order: 300,
  37082. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37083. enabled: true,
  37084. /** @prop {ModifierFn} */
  37085. fn: preventOverflow,
  37086. /**
  37087. * @prop {Array} [priority=['left','right','top','bottom']]
  37088. * Popper will try to prevent overflow following these priorities by default,
  37089. * then, it could overflow on the left and on top of the `boundariesElement`
  37090. */
  37091. priority: ['left', 'right', 'top', 'bottom'],
  37092. /**
  37093. * @prop {number} padding=5
  37094. * Amount of pixel used to define a minimum distance between the boundaries
  37095. * and the popper. This makes sure the popper always has a little padding
  37096. * between the edges of its container
  37097. */
  37098. padding: 5,
  37099. /**
  37100. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37101. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37102. * `viewport` or any DOM element.
  37103. */
  37104. boundariesElement: 'scrollParent'
  37105. },
  37106. /**
  37107. * Modifier used to make sure the reference and its popper stay near each other
  37108. * without leaving any gap between the two. Especially useful when the arrow is
  37109. * enabled and you want to ensure that it points to its reference element.
  37110. * It cares only about the first axis. You can still have poppers with margin
  37111. * between the popper and its reference element.
  37112. * @memberof modifiers
  37113. * @inner
  37114. */
  37115. keepTogether: {
  37116. /** @prop {number} order=400 - Index used to define the order of execution */
  37117. order: 400,
  37118. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37119. enabled: true,
  37120. /** @prop {ModifierFn} */
  37121. fn: keepTogether
  37122. },
  37123. /**
  37124. * This modifier is used to move the `arrowElement` of the popper to make
  37125. * sure it is positioned between the reference element and its popper element.
  37126. * It will read the outer size of the `arrowElement` node to detect how many
  37127. * pixels of conjunction are needed.
  37128. *
  37129. * It has no effect if no `arrowElement` is provided.
  37130. * @memberof modifiers
  37131. * @inner
  37132. */
  37133. arrow: {
  37134. /** @prop {number} order=500 - Index used to define the order of execution */
  37135. order: 500,
  37136. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37137. enabled: true,
  37138. /** @prop {ModifierFn} */
  37139. fn: arrow,
  37140. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37141. element: '[x-arrow]'
  37142. },
  37143. /**
  37144. * Modifier used to flip the popper's placement when it starts to overlap its
  37145. * reference element.
  37146. *
  37147. * Requires the `preventOverflow` modifier before it in order to work.
  37148. *
  37149. * **NOTE:** this modifier will interrupt the current update cycle and will
  37150. * restart it if it detects the need to flip the placement.
  37151. * @memberof modifiers
  37152. * @inner
  37153. */
  37154. flip: {
  37155. /** @prop {number} order=600 - Index used to define the order of execution */
  37156. order: 600,
  37157. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37158. enabled: true,
  37159. /** @prop {ModifierFn} */
  37160. fn: flip,
  37161. /**
  37162. * @prop {String|Array} behavior='flip'
  37163. * The behavior used to change the popper's placement. It can be one of
  37164. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37165. * placements (with optional variations)
  37166. */
  37167. behavior: 'flip',
  37168. /**
  37169. * @prop {number} padding=5
  37170. * The popper will flip if it hits the edges of the `boundariesElement`
  37171. */
  37172. padding: 5,
  37173. /**
  37174. * @prop {String|HTMLElement} boundariesElement='viewport'
  37175. * The element which will define the boundaries of the popper position.
  37176. * The popper will never be placed outside of the defined boundaries
  37177. * (except if `keepTogether` is enabled)
  37178. */
  37179. boundariesElement: 'viewport',
  37180. /**
  37181. * @prop {Boolean} flipVariations=false
  37182. * The popper will switch placement variation between `-start` and `-end` when
  37183. * the reference element overlaps its boundaries.
  37184. *
  37185. * The original placement should have a set variation.
  37186. */
  37187. flipVariations: false,
  37188. /**
  37189. * @prop {Boolean} flipVariationsByContent=false
  37190. * The popper will switch placement variation between `-start` and `-end` when
  37191. * the popper element overlaps its reference boundaries.
  37192. *
  37193. * The original placement should have a set variation.
  37194. */
  37195. flipVariationsByContent: false
  37196. },
  37197. /**
  37198. * Modifier used to make the popper flow toward the inner of the reference element.
  37199. * By default, when this modifier is disabled, the popper will be placed outside
  37200. * the reference element.
  37201. * @memberof modifiers
  37202. * @inner
  37203. */
  37204. inner: {
  37205. /** @prop {number} order=700 - Index used to define the order of execution */
  37206. order: 700,
  37207. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37208. enabled: false,
  37209. /** @prop {ModifierFn} */
  37210. fn: inner
  37211. },
  37212. /**
  37213. * Modifier used to hide the popper when its reference element is outside of the
  37214. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37215. * be used to hide with a CSS selector the popper when its reference is
  37216. * out of boundaries.
  37217. *
  37218. * Requires the `preventOverflow` modifier before it in order to work.
  37219. * @memberof modifiers
  37220. * @inner
  37221. */
  37222. hide: {
  37223. /** @prop {number} order=800 - Index used to define the order of execution */
  37224. order: 800,
  37225. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37226. enabled: true,
  37227. /** @prop {ModifierFn} */
  37228. fn: hide
  37229. },
  37230. /**
  37231. * Computes the style that will be applied to the popper element to gets
  37232. * properly positioned.
  37233. *
  37234. * Note that this modifier will not touch the DOM, it just prepares the styles
  37235. * so that `applyStyle` modifier can apply it. This separation is useful
  37236. * in case you need to replace `applyStyle` with a custom implementation.
  37237. *
  37238. * This modifier has `850` as `order` value to maintain backward compatibility
  37239. * with previous versions of Popper.js. Expect the modifiers ordering method
  37240. * to change in future major versions of the library.
  37241. *
  37242. * @memberof modifiers
  37243. * @inner
  37244. */
  37245. computeStyle: {
  37246. /** @prop {number} order=850 - Index used to define the order of execution */
  37247. order: 850,
  37248. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37249. enabled: true,
  37250. /** @prop {ModifierFn} */
  37251. fn: computeStyle,
  37252. /**
  37253. * @prop {Boolean} gpuAcceleration=true
  37254. * If true, it uses the CSS 3D transformation to position the popper.
  37255. * Otherwise, it will use the `top` and `left` properties
  37256. */
  37257. gpuAcceleration: true,
  37258. /**
  37259. * @prop {string} [x='bottom']
  37260. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37261. * Change this if your popper should grow in a direction different from `bottom`
  37262. */
  37263. x: 'bottom',
  37264. /**
  37265. * @prop {string} [x='left']
  37266. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37267. * Change this if your popper should grow in a direction different from `right`
  37268. */
  37269. y: 'right'
  37270. },
  37271. /**
  37272. * Applies the computed styles to the popper element.
  37273. *
  37274. * All the DOM manipulations are limited to this modifier. This is useful in case
  37275. * you want to integrate Popper.js inside a framework or view library and you
  37276. * want to delegate all the DOM manipulations to it.
  37277. *
  37278. * Note that if you disable this modifier, you must make sure the popper element
  37279. * has its position set to `absolute` before Popper.js can do its work!
  37280. *
  37281. * Just disable this modifier and define your own to achieve the desired effect.
  37282. *
  37283. * @memberof modifiers
  37284. * @inner
  37285. */
  37286. applyStyle: {
  37287. /** @prop {number} order=900 - Index used to define the order of execution */
  37288. order: 900,
  37289. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37290. enabled: true,
  37291. /** @prop {ModifierFn} */
  37292. fn: applyStyle,
  37293. /** @prop {Function} */
  37294. onLoad: applyStyleOnLoad,
  37295. /**
  37296. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37297. * @prop {Boolean} gpuAcceleration=true
  37298. * If true, it uses the CSS 3D transformation to position the popper.
  37299. * Otherwise, it will use the `top` and `left` properties
  37300. */
  37301. gpuAcceleration: undefined
  37302. }
  37303. };
  37304. /**
  37305. * The `dataObject` is an object containing all the information used by Popper.js.
  37306. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37307. * @name dataObject
  37308. * @property {Object} data.instance The Popper.js instance
  37309. * @property {String} data.placement Placement applied to popper
  37310. * @property {String} data.originalPlacement Placement originally defined on init
  37311. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37312. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37313. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37314. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37315. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37316. * @property {Object} data.boundaries Offsets of the popper boundaries
  37317. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37318. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37319. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37320. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37321. */
  37322. /**
  37323. * Default options provided to Popper.js constructor.<br />
  37324. * These can be overridden using the `options` argument of Popper.js.<br />
  37325. * To override an option, simply pass an object with the same
  37326. * structure of the `options` object, as the 3rd argument. For example:
  37327. * ```
  37328. * new Popper(ref, pop, {
  37329. * modifiers: {
  37330. * preventOverflow: { enabled: false }
  37331. * }
  37332. * })
  37333. * ```
  37334. * @type {Object}
  37335. * @static
  37336. * @memberof Popper
  37337. */
  37338. var Defaults = {
  37339. /**
  37340. * Popper's placement.
  37341. * @prop {Popper.placements} placement='bottom'
  37342. */
  37343. placement: 'bottom',
  37344. /**
  37345. * Set this to true if you want popper to position it self in 'fixed' mode
  37346. * @prop {Boolean} positionFixed=false
  37347. */
  37348. positionFixed: false,
  37349. /**
  37350. * Whether events (resize, scroll) are initially enabled.
  37351. * @prop {Boolean} eventsEnabled=true
  37352. */
  37353. eventsEnabled: true,
  37354. /**
  37355. * Set to true if you want to automatically remove the popper when
  37356. * you call the `destroy` method.
  37357. * @prop {Boolean} removeOnDestroy=false
  37358. */
  37359. removeOnDestroy: false,
  37360. /**
  37361. * Callback called when the popper is created.<br />
  37362. * By default, it is set to no-op.<br />
  37363. * Access Popper.js instance with `data.instance`.
  37364. * @prop {onCreate}
  37365. */
  37366. onCreate: function onCreate() {},
  37367. /**
  37368. * Callback called when the popper is updated. This callback is not called
  37369. * on the initialization/creation of the popper, but only on subsequent
  37370. * updates.<br />
  37371. * By default, it is set to no-op.<br />
  37372. * Access Popper.js instance with `data.instance`.
  37373. * @prop {onUpdate}
  37374. */
  37375. onUpdate: function onUpdate() {},
  37376. /**
  37377. * List of modifiers used to modify the offsets before they are applied to the popper.
  37378. * They provide most of the functionalities of Popper.js.
  37379. * @prop {modifiers}
  37380. */
  37381. modifiers: modifiers
  37382. };
  37383. /**
  37384. * @callback onCreate
  37385. * @param {dataObject} data
  37386. */
  37387. /**
  37388. * @callback onUpdate
  37389. * @param {dataObject} data
  37390. */
  37391. // Utils
  37392. // Methods
  37393. var Popper = function () {
  37394. /**
  37395. * Creates a new Popper.js instance.
  37396. * @class Popper
  37397. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37398. * @param {Element} popper - The HTML / XML element used as the popper
  37399. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37400. * @return {Object} instance - The generated Popper.js instance
  37401. */
  37402. function Popper(reference, popper) {
  37403. var _this = this;
  37404. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37405. classCallCheck(this, Popper);
  37406. this.scheduleUpdate = function () {
  37407. return requestAnimationFrame(_this.update);
  37408. };
  37409. // make update() debounced, so that it only runs at most once-per-tick
  37410. this.update = debounce(this.update.bind(this));
  37411. // with {} we create a new object with the options inside it
  37412. this.options = _extends({}, Popper.Defaults, options);
  37413. // init state
  37414. this.state = {
  37415. isDestroyed: false,
  37416. isCreated: false,
  37417. scrollParents: []
  37418. };
  37419. // get reference and popper elements (allow jQuery wrappers)
  37420. this.reference = reference && reference.jquery ? reference[0] : reference;
  37421. this.popper = popper && popper.jquery ? popper[0] : popper;
  37422. // Deep merge modifiers options
  37423. this.options.modifiers = {};
  37424. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37425. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37426. });
  37427. // Refactoring modifiers' list (Object => Array)
  37428. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37429. return _extends({
  37430. name: name
  37431. }, _this.options.modifiers[name]);
  37432. })
  37433. // sort the modifiers by order
  37434. .sort(function (a, b) {
  37435. return a.order - b.order;
  37436. });
  37437. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37438. // such code is executed in the same order of its modifier
  37439. // they could add new properties to their options configuration
  37440. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37441. this.modifiers.forEach(function (modifierOptions) {
  37442. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37443. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37444. }
  37445. });
  37446. // fire the first update to position the popper in the right place
  37447. this.update();
  37448. var eventsEnabled = this.options.eventsEnabled;
  37449. if (eventsEnabled) {
  37450. // setup event listeners, they will take care of update the position in specific situations
  37451. this.enableEventListeners();
  37452. }
  37453. this.state.eventsEnabled = eventsEnabled;
  37454. }
  37455. // We can't use class properties because they don't get listed in the
  37456. // class prototype and break stuff like Sinon stubs
  37457. createClass(Popper, [{
  37458. key: 'update',
  37459. value: function update$$1() {
  37460. return update.call(this);
  37461. }
  37462. }, {
  37463. key: 'destroy',
  37464. value: function destroy$$1() {
  37465. return destroy.call(this);
  37466. }
  37467. }, {
  37468. key: 'enableEventListeners',
  37469. value: function enableEventListeners$$1() {
  37470. return enableEventListeners.call(this);
  37471. }
  37472. }, {
  37473. key: 'disableEventListeners',
  37474. value: function disableEventListeners$$1() {
  37475. return disableEventListeners.call(this);
  37476. }
  37477. /**
  37478. * Schedules an update. It will run on the next UI update available.
  37479. * @method scheduleUpdate
  37480. * @memberof Popper
  37481. */
  37482. /**
  37483. * Collection of utilities useful when writing custom modifiers.
  37484. * Starting from version 1.7, this method is available only if you
  37485. * include `popper-utils.js` before `popper.js`.
  37486. *
  37487. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37488. * and will be removed in v2! Use the PopperUtils module directly instead.
  37489. * Due to the high instability of the methods contained in Utils, we can't
  37490. * guarantee them to follow semver. Use them at your own risk!
  37491. * @static
  37492. * @private
  37493. * @type {Object}
  37494. * @deprecated since version 1.8
  37495. * @member Utils
  37496. * @memberof Popper
  37497. */
  37498. }]);
  37499. return Popper;
  37500. }();
  37501. /**
  37502. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37503. * and lets you use it as replacement of a real DOM node.<br />
  37504. * You can use this method to position a popper relatively to a set of coordinates
  37505. * in case you don't have a DOM node to use as reference.
  37506. *
  37507. * ```
  37508. * new Popper(referenceObject, popperNode);
  37509. * ```
  37510. *
  37511. * NB: This feature isn't supported in Internet Explorer 10.
  37512. * @name referenceObject
  37513. * @property {Function} data.getBoundingClientRect
  37514. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37515. * @property {number} data.clientWidth
  37516. * An ES6 getter that will return the width of the virtual reference element.
  37517. * @property {number} data.clientHeight
  37518. * An ES6 getter that will return the height of the virtual reference element.
  37519. */
  37520. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37521. Popper.placements = placements;
  37522. Popper.Defaults = Defaults;
  37523. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37524. //# sourceMappingURL=popper.js.map
  37525. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37526. /***/ }),
  37527. /***/ "./node_modules/process/browser.js":
  37528. /*!*****************************************!*\
  37529. !*** ./node_modules/process/browser.js ***!
  37530. \*****************************************/
  37531. /*! no static exports found */
  37532. /***/ (function(module, exports) {
  37533. // shim for using process in browser
  37534. var process = module.exports = {};
  37535. // cached from whatever global is present so that test runners that stub it
  37536. // don't break things. But we need to wrap it in a try catch in case it is
  37537. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37538. // function because try/catches deoptimize in certain engines.
  37539. var cachedSetTimeout;
  37540. var cachedClearTimeout;
  37541. function defaultSetTimout() {
  37542. throw new Error('setTimeout has not been defined');
  37543. }
  37544. function defaultClearTimeout () {
  37545. throw new Error('clearTimeout has not been defined');
  37546. }
  37547. (function () {
  37548. try {
  37549. if (typeof setTimeout === 'function') {
  37550. cachedSetTimeout = setTimeout;
  37551. } else {
  37552. cachedSetTimeout = defaultSetTimout;
  37553. }
  37554. } catch (e) {
  37555. cachedSetTimeout = defaultSetTimout;
  37556. }
  37557. try {
  37558. if (typeof clearTimeout === 'function') {
  37559. cachedClearTimeout = clearTimeout;
  37560. } else {
  37561. cachedClearTimeout = defaultClearTimeout;
  37562. }
  37563. } catch (e) {
  37564. cachedClearTimeout = defaultClearTimeout;
  37565. }
  37566. } ())
  37567. function runTimeout(fun) {
  37568. if (cachedSetTimeout === setTimeout) {
  37569. //normal enviroments in sane situations
  37570. return setTimeout(fun, 0);
  37571. }
  37572. // if setTimeout wasn't available but was latter defined
  37573. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37574. cachedSetTimeout = setTimeout;
  37575. return setTimeout(fun, 0);
  37576. }
  37577. try {
  37578. // when when somebody has screwed with setTimeout but no I.E. maddness
  37579. return cachedSetTimeout(fun, 0);
  37580. } catch(e){
  37581. try {
  37582. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37583. return cachedSetTimeout.call(null, fun, 0);
  37584. } catch(e){
  37585. // 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
  37586. return cachedSetTimeout.call(this, fun, 0);
  37587. }
  37588. }
  37589. }
  37590. function runClearTimeout(marker) {
  37591. if (cachedClearTimeout === clearTimeout) {
  37592. //normal enviroments in sane situations
  37593. return clearTimeout(marker);
  37594. }
  37595. // if clearTimeout wasn't available but was latter defined
  37596. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37597. cachedClearTimeout = clearTimeout;
  37598. return clearTimeout(marker);
  37599. }
  37600. try {
  37601. // when when somebody has screwed with setTimeout but no I.E. maddness
  37602. return cachedClearTimeout(marker);
  37603. } catch (e){
  37604. try {
  37605. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37606. return cachedClearTimeout.call(null, marker);
  37607. } catch (e){
  37608. // 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.
  37609. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37610. return cachedClearTimeout.call(this, marker);
  37611. }
  37612. }
  37613. }
  37614. var queue = [];
  37615. var draining = false;
  37616. var currentQueue;
  37617. var queueIndex = -1;
  37618. function cleanUpNextTick() {
  37619. if (!draining || !currentQueue) {
  37620. return;
  37621. }
  37622. draining = false;
  37623. if (currentQueue.length) {
  37624. queue = currentQueue.concat(queue);
  37625. } else {
  37626. queueIndex = -1;
  37627. }
  37628. if (queue.length) {
  37629. drainQueue();
  37630. }
  37631. }
  37632. function drainQueue() {
  37633. if (draining) {
  37634. return;
  37635. }
  37636. var timeout = runTimeout(cleanUpNextTick);
  37637. draining = true;
  37638. var len = queue.length;
  37639. while(len) {
  37640. currentQueue = queue;
  37641. queue = [];
  37642. while (++queueIndex < len) {
  37643. if (currentQueue) {
  37644. currentQueue[queueIndex].run();
  37645. }
  37646. }
  37647. queueIndex = -1;
  37648. len = queue.length;
  37649. }
  37650. currentQueue = null;
  37651. draining = false;
  37652. runClearTimeout(timeout);
  37653. }
  37654. process.nextTick = function (fun) {
  37655. var args = new Array(arguments.length - 1);
  37656. if (arguments.length > 1) {
  37657. for (var i = 1; i < arguments.length; i++) {
  37658. args[i - 1] = arguments[i];
  37659. }
  37660. }
  37661. queue.push(new Item(fun, args));
  37662. if (queue.length === 1 && !draining) {
  37663. runTimeout(drainQueue);
  37664. }
  37665. };
  37666. // v8 likes predictible objects
  37667. function Item(fun, array) {
  37668. this.fun = fun;
  37669. this.array = array;
  37670. }
  37671. Item.prototype.run = function () {
  37672. this.fun.apply(null, this.array);
  37673. };
  37674. process.title = 'browser';
  37675. process.browser = true;
  37676. process.env = {};
  37677. process.argv = [];
  37678. process.version = ''; // empty string to avoid regexp issues
  37679. process.versions = {};
  37680. function noop() {}
  37681. process.on = noop;
  37682. process.addListener = noop;
  37683. process.once = noop;
  37684. process.off = noop;
  37685. process.removeListener = noop;
  37686. process.removeAllListeners = noop;
  37687. process.emit = noop;
  37688. process.prependListener = noop;
  37689. process.prependOnceListener = noop;
  37690. process.listeners = function (name) { return [] }
  37691. process.binding = function (name) {
  37692. throw new Error('process.binding is not supported');
  37693. };
  37694. process.cwd = function () { return '/' };
  37695. process.chdir = function (dir) {
  37696. throw new Error('process.chdir is not supported');
  37697. };
  37698. process.umask = function() { return 0; };
  37699. /***/ }),
  37700. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37701. /*!***************************************************!*\
  37702. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37703. \***************************************************/
  37704. /*! no static exports found */
  37705. /***/ (function(module, exports, __webpack_require__) {
  37706. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37707. * Pusher JavaScript Library v5.0.3
  37708. * https://pusher.com/
  37709. *
  37710. * Copyright 2017, Pusher
  37711. * Released under the MIT licence.
  37712. */
  37713. (function webpackUniversalModuleDefinition(root, factory) {
  37714. if(true)
  37715. module.exports = factory();
  37716. else {}
  37717. })(window, function() {
  37718. return /******/ (function(modules) { // webpackBootstrap
  37719. /******/ // The module cache
  37720. /******/ var installedModules = {};
  37721. /******/
  37722. /******/ // The require function
  37723. /******/ function __webpack_require__(moduleId) {
  37724. /******/
  37725. /******/ // Check if module is in cache
  37726. /******/ if(installedModules[moduleId]) {
  37727. /******/ return installedModules[moduleId].exports;
  37728. /******/ }
  37729. /******/ // Create a new module (and put it into the cache)
  37730. /******/ var module = installedModules[moduleId] = {
  37731. /******/ i: moduleId,
  37732. /******/ l: false,
  37733. /******/ exports: {}
  37734. /******/ };
  37735. /******/
  37736. /******/ // Execute the module function
  37737. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37738. /******/
  37739. /******/ // Flag the module as loaded
  37740. /******/ module.l = true;
  37741. /******/
  37742. /******/ // Return the exports of the module
  37743. /******/ return module.exports;
  37744. /******/ }
  37745. /******/
  37746. /******/
  37747. /******/ // expose the modules object (__webpack_modules__)
  37748. /******/ __webpack_require__.m = modules;
  37749. /******/
  37750. /******/ // expose the module cache
  37751. /******/ __webpack_require__.c = installedModules;
  37752. /******/
  37753. /******/ // define getter function for harmony exports
  37754. /******/ __webpack_require__.d = function(exports, name, getter) {
  37755. /******/ if(!__webpack_require__.o(exports, name)) {
  37756. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37757. /******/ }
  37758. /******/ };
  37759. /******/
  37760. /******/ // define __esModule on exports
  37761. /******/ __webpack_require__.r = function(exports) {
  37762. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37763. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37764. /******/ }
  37765. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37766. /******/ };
  37767. /******/
  37768. /******/ // create a fake namespace object
  37769. /******/ // mode & 1: value is a module id, require it
  37770. /******/ // mode & 2: merge all properties of value into the ns
  37771. /******/ // mode & 4: return value when already ns object
  37772. /******/ // mode & 8|1: behave like require
  37773. /******/ __webpack_require__.t = function(value, mode) {
  37774. /******/ if(mode & 1) value = __webpack_require__(value);
  37775. /******/ if(mode & 8) return value;
  37776. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37777. /******/ var ns = Object.create(null);
  37778. /******/ __webpack_require__.r(ns);
  37779. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37780. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37781. /******/ return ns;
  37782. /******/ };
  37783. /******/
  37784. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37785. /******/ __webpack_require__.n = function(module) {
  37786. /******/ var getter = module && module.__esModule ?
  37787. /******/ function getDefault() { return module['default']; } :
  37788. /******/ function getModuleExports() { return module; };
  37789. /******/ __webpack_require__.d(getter, 'a', getter);
  37790. /******/ return getter;
  37791. /******/ };
  37792. /******/
  37793. /******/ // Object.prototype.hasOwnProperty.call
  37794. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37795. /******/
  37796. /******/ // __webpack_public_path__
  37797. /******/ __webpack_require__.p = "";
  37798. /******/
  37799. /******/
  37800. /******/ // Load entry module and return exports
  37801. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37802. /******/ })
  37803. /************************************************************************/
  37804. /******/ ([
  37805. /* 0 */
  37806. /***/ (function(module, exports, __webpack_require__) {
  37807. (function(nacl) {
  37808. 'use strict';
  37809. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37810. // Public domain.
  37811. //
  37812. // Implementation derived from TweetNaCl version 20140427.
  37813. // See for details: http://tweetnacl.cr.yp.to/
  37814. var gf = function(init) {
  37815. var i, r = new Float64Array(16);
  37816. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37817. return r;
  37818. };
  37819. // Pluggable, initialized in high-level API below.
  37820. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37821. var _0 = new Uint8Array(16);
  37822. var _9 = new Uint8Array(32); _9[0] = 9;
  37823. var gf0 = gf(),
  37824. gf1 = gf([1]),
  37825. _121665 = gf([0xdb41, 1]),
  37826. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37827. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37828. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37829. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37830. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37831. function ts64(x, i, h, l) {
  37832. x[i] = (h >> 24) & 0xff;
  37833. x[i+1] = (h >> 16) & 0xff;
  37834. x[i+2] = (h >> 8) & 0xff;
  37835. x[i+3] = h & 0xff;
  37836. x[i+4] = (l >> 24) & 0xff;
  37837. x[i+5] = (l >> 16) & 0xff;
  37838. x[i+6] = (l >> 8) & 0xff;
  37839. x[i+7] = l & 0xff;
  37840. }
  37841. function vn(x, xi, y, yi, n) {
  37842. var i,d = 0;
  37843. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37844. return (1 & ((d - 1) >>> 8)) - 1;
  37845. }
  37846. function crypto_verify_16(x, xi, y, yi) {
  37847. return vn(x,xi,y,yi,16);
  37848. }
  37849. function crypto_verify_32(x, xi, y, yi) {
  37850. return vn(x,xi,y,yi,32);
  37851. }
  37852. function core_salsa20(o, p, k, c) {
  37853. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37854. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37855. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37856. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37857. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37858. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37859. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37860. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37861. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37862. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37863. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37864. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37865. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37866. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37867. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37868. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37869. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37870. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37871. x15 = j15, u;
  37872. for (var i = 0; i < 20; i += 2) {
  37873. u = x0 + x12 | 0;
  37874. x4 ^= u<<7 | u>>>(32-7);
  37875. u = x4 + x0 | 0;
  37876. x8 ^= u<<9 | u>>>(32-9);
  37877. u = x8 + x4 | 0;
  37878. x12 ^= u<<13 | u>>>(32-13);
  37879. u = x12 + x8 | 0;
  37880. x0 ^= u<<18 | u>>>(32-18);
  37881. u = x5 + x1 | 0;
  37882. x9 ^= u<<7 | u>>>(32-7);
  37883. u = x9 + x5 | 0;
  37884. x13 ^= u<<9 | u>>>(32-9);
  37885. u = x13 + x9 | 0;
  37886. x1 ^= u<<13 | u>>>(32-13);
  37887. u = x1 + x13 | 0;
  37888. x5 ^= u<<18 | u>>>(32-18);
  37889. u = x10 + x6 | 0;
  37890. x14 ^= u<<7 | u>>>(32-7);
  37891. u = x14 + x10 | 0;
  37892. x2 ^= u<<9 | u>>>(32-9);
  37893. u = x2 + x14 | 0;
  37894. x6 ^= u<<13 | u>>>(32-13);
  37895. u = x6 + x2 | 0;
  37896. x10 ^= u<<18 | u>>>(32-18);
  37897. u = x15 + x11 | 0;
  37898. x3 ^= u<<7 | u>>>(32-7);
  37899. u = x3 + x15 | 0;
  37900. x7 ^= u<<9 | u>>>(32-9);
  37901. u = x7 + x3 | 0;
  37902. x11 ^= u<<13 | u>>>(32-13);
  37903. u = x11 + x7 | 0;
  37904. x15 ^= u<<18 | u>>>(32-18);
  37905. u = x0 + x3 | 0;
  37906. x1 ^= u<<7 | u>>>(32-7);
  37907. u = x1 + x0 | 0;
  37908. x2 ^= u<<9 | u>>>(32-9);
  37909. u = x2 + x1 | 0;
  37910. x3 ^= u<<13 | u>>>(32-13);
  37911. u = x3 + x2 | 0;
  37912. x0 ^= u<<18 | u>>>(32-18);
  37913. u = x5 + x4 | 0;
  37914. x6 ^= u<<7 | u>>>(32-7);
  37915. u = x6 + x5 | 0;
  37916. x7 ^= u<<9 | u>>>(32-9);
  37917. u = x7 + x6 | 0;
  37918. x4 ^= u<<13 | u>>>(32-13);
  37919. u = x4 + x7 | 0;
  37920. x5 ^= u<<18 | u>>>(32-18);
  37921. u = x10 + x9 | 0;
  37922. x11 ^= u<<7 | u>>>(32-7);
  37923. u = x11 + x10 | 0;
  37924. x8 ^= u<<9 | u>>>(32-9);
  37925. u = x8 + x11 | 0;
  37926. x9 ^= u<<13 | u>>>(32-13);
  37927. u = x9 + x8 | 0;
  37928. x10 ^= u<<18 | u>>>(32-18);
  37929. u = x15 + x14 | 0;
  37930. x12 ^= u<<7 | u>>>(32-7);
  37931. u = x12 + x15 | 0;
  37932. x13 ^= u<<9 | u>>>(32-9);
  37933. u = x13 + x12 | 0;
  37934. x14 ^= u<<13 | u>>>(32-13);
  37935. u = x14 + x13 | 0;
  37936. x15 ^= u<<18 | u>>>(32-18);
  37937. }
  37938. x0 = x0 + j0 | 0;
  37939. x1 = x1 + j1 | 0;
  37940. x2 = x2 + j2 | 0;
  37941. x3 = x3 + j3 | 0;
  37942. x4 = x4 + j4 | 0;
  37943. x5 = x5 + j5 | 0;
  37944. x6 = x6 + j6 | 0;
  37945. x7 = x7 + j7 | 0;
  37946. x8 = x8 + j8 | 0;
  37947. x9 = x9 + j9 | 0;
  37948. x10 = x10 + j10 | 0;
  37949. x11 = x11 + j11 | 0;
  37950. x12 = x12 + j12 | 0;
  37951. x13 = x13 + j13 | 0;
  37952. x14 = x14 + j14 | 0;
  37953. x15 = x15 + j15 | 0;
  37954. o[ 0] = x0 >>> 0 & 0xff;
  37955. o[ 1] = x0 >>> 8 & 0xff;
  37956. o[ 2] = x0 >>> 16 & 0xff;
  37957. o[ 3] = x0 >>> 24 & 0xff;
  37958. o[ 4] = x1 >>> 0 & 0xff;
  37959. o[ 5] = x1 >>> 8 & 0xff;
  37960. o[ 6] = x1 >>> 16 & 0xff;
  37961. o[ 7] = x1 >>> 24 & 0xff;
  37962. o[ 8] = x2 >>> 0 & 0xff;
  37963. o[ 9] = x2 >>> 8 & 0xff;
  37964. o[10] = x2 >>> 16 & 0xff;
  37965. o[11] = x2 >>> 24 & 0xff;
  37966. o[12] = x3 >>> 0 & 0xff;
  37967. o[13] = x3 >>> 8 & 0xff;
  37968. o[14] = x3 >>> 16 & 0xff;
  37969. o[15] = x3 >>> 24 & 0xff;
  37970. o[16] = x4 >>> 0 & 0xff;
  37971. o[17] = x4 >>> 8 & 0xff;
  37972. o[18] = x4 >>> 16 & 0xff;
  37973. o[19] = x4 >>> 24 & 0xff;
  37974. o[20] = x5 >>> 0 & 0xff;
  37975. o[21] = x5 >>> 8 & 0xff;
  37976. o[22] = x5 >>> 16 & 0xff;
  37977. o[23] = x5 >>> 24 & 0xff;
  37978. o[24] = x6 >>> 0 & 0xff;
  37979. o[25] = x6 >>> 8 & 0xff;
  37980. o[26] = x6 >>> 16 & 0xff;
  37981. o[27] = x6 >>> 24 & 0xff;
  37982. o[28] = x7 >>> 0 & 0xff;
  37983. o[29] = x7 >>> 8 & 0xff;
  37984. o[30] = x7 >>> 16 & 0xff;
  37985. o[31] = x7 >>> 24 & 0xff;
  37986. o[32] = x8 >>> 0 & 0xff;
  37987. o[33] = x8 >>> 8 & 0xff;
  37988. o[34] = x8 >>> 16 & 0xff;
  37989. o[35] = x8 >>> 24 & 0xff;
  37990. o[36] = x9 >>> 0 & 0xff;
  37991. o[37] = x9 >>> 8 & 0xff;
  37992. o[38] = x9 >>> 16 & 0xff;
  37993. o[39] = x9 >>> 24 & 0xff;
  37994. o[40] = x10 >>> 0 & 0xff;
  37995. o[41] = x10 >>> 8 & 0xff;
  37996. o[42] = x10 >>> 16 & 0xff;
  37997. o[43] = x10 >>> 24 & 0xff;
  37998. o[44] = x11 >>> 0 & 0xff;
  37999. o[45] = x11 >>> 8 & 0xff;
  38000. o[46] = x11 >>> 16 & 0xff;
  38001. o[47] = x11 >>> 24 & 0xff;
  38002. o[48] = x12 >>> 0 & 0xff;
  38003. o[49] = x12 >>> 8 & 0xff;
  38004. o[50] = x12 >>> 16 & 0xff;
  38005. o[51] = x12 >>> 24 & 0xff;
  38006. o[52] = x13 >>> 0 & 0xff;
  38007. o[53] = x13 >>> 8 & 0xff;
  38008. o[54] = x13 >>> 16 & 0xff;
  38009. o[55] = x13 >>> 24 & 0xff;
  38010. o[56] = x14 >>> 0 & 0xff;
  38011. o[57] = x14 >>> 8 & 0xff;
  38012. o[58] = x14 >>> 16 & 0xff;
  38013. o[59] = x14 >>> 24 & 0xff;
  38014. o[60] = x15 >>> 0 & 0xff;
  38015. o[61] = x15 >>> 8 & 0xff;
  38016. o[62] = x15 >>> 16 & 0xff;
  38017. o[63] = x15 >>> 24 & 0xff;
  38018. }
  38019. function core_hsalsa20(o,p,k,c) {
  38020. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38021. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38022. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38023. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38024. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38025. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38026. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38027. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38028. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38029. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38030. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38031. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38032. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38033. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38034. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38035. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38036. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38037. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38038. x15 = j15, u;
  38039. for (var i = 0; i < 20; i += 2) {
  38040. u = x0 + x12 | 0;
  38041. x4 ^= u<<7 | u>>>(32-7);
  38042. u = x4 + x0 | 0;
  38043. x8 ^= u<<9 | u>>>(32-9);
  38044. u = x8 + x4 | 0;
  38045. x12 ^= u<<13 | u>>>(32-13);
  38046. u = x12 + x8 | 0;
  38047. x0 ^= u<<18 | u>>>(32-18);
  38048. u = x5 + x1 | 0;
  38049. x9 ^= u<<7 | u>>>(32-7);
  38050. u = x9 + x5 | 0;
  38051. x13 ^= u<<9 | u>>>(32-9);
  38052. u = x13 + x9 | 0;
  38053. x1 ^= u<<13 | u>>>(32-13);
  38054. u = x1 + x13 | 0;
  38055. x5 ^= u<<18 | u>>>(32-18);
  38056. u = x10 + x6 | 0;
  38057. x14 ^= u<<7 | u>>>(32-7);
  38058. u = x14 + x10 | 0;
  38059. x2 ^= u<<9 | u>>>(32-9);
  38060. u = x2 + x14 | 0;
  38061. x6 ^= u<<13 | u>>>(32-13);
  38062. u = x6 + x2 | 0;
  38063. x10 ^= u<<18 | u>>>(32-18);
  38064. u = x15 + x11 | 0;
  38065. x3 ^= u<<7 | u>>>(32-7);
  38066. u = x3 + x15 | 0;
  38067. x7 ^= u<<9 | u>>>(32-9);
  38068. u = x7 + x3 | 0;
  38069. x11 ^= u<<13 | u>>>(32-13);
  38070. u = x11 + x7 | 0;
  38071. x15 ^= u<<18 | u>>>(32-18);
  38072. u = x0 + x3 | 0;
  38073. x1 ^= u<<7 | u>>>(32-7);
  38074. u = x1 + x0 | 0;
  38075. x2 ^= u<<9 | u>>>(32-9);
  38076. u = x2 + x1 | 0;
  38077. x3 ^= u<<13 | u>>>(32-13);
  38078. u = x3 + x2 | 0;
  38079. x0 ^= u<<18 | u>>>(32-18);
  38080. u = x5 + x4 | 0;
  38081. x6 ^= u<<7 | u>>>(32-7);
  38082. u = x6 + x5 | 0;
  38083. x7 ^= u<<9 | u>>>(32-9);
  38084. u = x7 + x6 | 0;
  38085. x4 ^= u<<13 | u>>>(32-13);
  38086. u = x4 + x7 | 0;
  38087. x5 ^= u<<18 | u>>>(32-18);
  38088. u = x10 + x9 | 0;
  38089. x11 ^= u<<7 | u>>>(32-7);
  38090. u = x11 + x10 | 0;
  38091. x8 ^= u<<9 | u>>>(32-9);
  38092. u = x8 + x11 | 0;
  38093. x9 ^= u<<13 | u>>>(32-13);
  38094. u = x9 + x8 | 0;
  38095. x10 ^= u<<18 | u>>>(32-18);
  38096. u = x15 + x14 | 0;
  38097. x12 ^= u<<7 | u>>>(32-7);
  38098. u = x12 + x15 | 0;
  38099. x13 ^= u<<9 | u>>>(32-9);
  38100. u = x13 + x12 | 0;
  38101. x14 ^= u<<13 | u>>>(32-13);
  38102. u = x14 + x13 | 0;
  38103. x15 ^= u<<18 | u>>>(32-18);
  38104. }
  38105. o[ 0] = x0 >>> 0 & 0xff;
  38106. o[ 1] = x0 >>> 8 & 0xff;
  38107. o[ 2] = x0 >>> 16 & 0xff;
  38108. o[ 3] = x0 >>> 24 & 0xff;
  38109. o[ 4] = x5 >>> 0 & 0xff;
  38110. o[ 5] = x5 >>> 8 & 0xff;
  38111. o[ 6] = x5 >>> 16 & 0xff;
  38112. o[ 7] = x5 >>> 24 & 0xff;
  38113. o[ 8] = x10 >>> 0 & 0xff;
  38114. o[ 9] = x10 >>> 8 & 0xff;
  38115. o[10] = x10 >>> 16 & 0xff;
  38116. o[11] = x10 >>> 24 & 0xff;
  38117. o[12] = x15 >>> 0 & 0xff;
  38118. o[13] = x15 >>> 8 & 0xff;
  38119. o[14] = x15 >>> 16 & 0xff;
  38120. o[15] = x15 >>> 24 & 0xff;
  38121. o[16] = x6 >>> 0 & 0xff;
  38122. o[17] = x6 >>> 8 & 0xff;
  38123. o[18] = x6 >>> 16 & 0xff;
  38124. o[19] = x6 >>> 24 & 0xff;
  38125. o[20] = x7 >>> 0 & 0xff;
  38126. o[21] = x7 >>> 8 & 0xff;
  38127. o[22] = x7 >>> 16 & 0xff;
  38128. o[23] = x7 >>> 24 & 0xff;
  38129. o[24] = x8 >>> 0 & 0xff;
  38130. o[25] = x8 >>> 8 & 0xff;
  38131. o[26] = x8 >>> 16 & 0xff;
  38132. o[27] = x8 >>> 24 & 0xff;
  38133. o[28] = x9 >>> 0 & 0xff;
  38134. o[29] = x9 >>> 8 & 0xff;
  38135. o[30] = x9 >>> 16 & 0xff;
  38136. o[31] = x9 >>> 24 & 0xff;
  38137. }
  38138. function crypto_core_salsa20(out,inp,k,c) {
  38139. core_salsa20(out,inp,k,c);
  38140. }
  38141. function crypto_core_hsalsa20(out,inp,k,c) {
  38142. core_hsalsa20(out,inp,k,c);
  38143. }
  38144. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38145. // "expand 32-byte k"
  38146. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38147. var z = new Uint8Array(16), x = new Uint8Array(64);
  38148. var u, i;
  38149. for (i = 0; i < 16; i++) z[i] = 0;
  38150. for (i = 0; i < 8; i++) z[i] = n[i];
  38151. while (b >= 64) {
  38152. crypto_core_salsa20(x,z,k,sigma);
  38153. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38154. u = 1;
  38155. for (i = 8; i < 16; i++) {
  38156. u = u + (z[i] & 0xff) | 0;
  38157. z[i] = u & 0xff;
  38158. u >>>= 8;
  38159. }
  38160. b -= 64;
  38161. cpos += 64;
  38162. mpos += 64;
  38163. }
  38164. if (b > 0) {
  38165. crypto_core_salsa20(x,z,k,sigma);
  38166. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38167. }
  38168. return 0;
  38169. }
  38170. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38171. var z = new Uint8Array(16), x = new Uint8Array(64);
  38172. var u, i;
  38173. for (i = 0; i < 16; i++) z[i] = 0;
  38174. for (i = 0; i < 8; i++) z[i] = n[i];
  38175. while (b >= 64) {
  38176. crypto_core_salsa20(x,z,k,sigma);
  38177. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38178. u = 1;
  38179. for (i = 8; i < 16; i++) {
  38180. u = u + (z[i] & 0xff) | 0;
  38181. z[i] = u & 0xff;
  38182. u >>>= 8;
  38183. }
  38184. b -= 64;
  38185. cpos += 64;
  38186. }
  38187. if (b > 0) {
  38188. crypto_core_salsa20(x,z,k,sigma);
  38189. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38190. }
  38191. return 0;
  38192. }
  38193. function crypto_stream(c,cpos,d,n,k) {
  38194. var s = new Uint8Array(32);
  38195. crypto_core_hsalsa20(s,n,k,sigma);
  38196. var sn = new Uint8Array(8);
  38197. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38198. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38199. }
  38200. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38201. var s = new Uint8Array(32);
  38202. crypto_core_hsalsa20(s,n,k,sigma);
  38203. var sn = new Uint8Array(8);
  38204. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38205. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38206. }
  38207. /*
  38208. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38209. * https://github.com/floodyberry/poly1305-donna
  38210. */
  38211. var poly1305 = function(key) {
  38212. this.buffer = new Uint8Array(16);
  38213. this.r = new Uint16Array(10);
  38214. this.h = new Uint16Array(10);
  38215. this.pad = new Uint16Array(8);
  38216. this.leftover = 0;
  38217. this.fin = 0;
  38218. var t0, t1, t2, t3, t4, t5, t6, t7;
  38219. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38220. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38221. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38222. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38223. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38224. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38225. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38226. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38227. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38228. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38229. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38230. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38231. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38232. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38233. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38234. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38235. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38236. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38237. };
  38238. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38239. var hibit = this.fin ? 0 : (1 << 11);
  38240. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38241. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38242. var h0 = this.h[0],
  38243. h1 = this.h[1],
  38244. h2 = this.h[2],
  38245. h3 = this.h[3],
  38246. h4 = this.h[4],
  38247. h5 = this.h[5],
  38248. h6 = this.h[6],
  38249. h7 = this.h[7],
  38250. h8 = this.h[8],
  38251. h9 = this.h[9];
  38252. var r0 = this.r[0],
  38253. r1 = this.r[1],
  38254. r2 = this.r[2],
  38255. r3 = this.r[3],
  38256. r4 = this.r[4],
  38257. r5 = this.r[5],
  38258. r6 = this.r[6],
  38259. r7 = this.r[7],
  38260. r8 = this.r[8],
  38261. r9 = this.r[9];
  38262. while (bytes >= 16) {
  38263. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38264. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38265. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38266. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38267. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38268. h5 += ((t4 >>> 1)) & 0x1fff;
  38269. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38270. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38271. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38272. h9 += ((t7 >>> 5)) | hibit;
  38273. c = 0;
  38274. d0 = c;
  38275. d0 += h0 * r0;
  38276. d0 += h1 * (5 * r9);
  38277. d0 += h2 * (5 * r8);
  38278. d0 += h3 * (5 * r7);
  38279. d0 += h4 * (5 * r6);
  38280. c = (d0 >>> 13); d0 &= 0x1fff;
  38281. d0 += h5 * (5 * r5);
  38282. d0 += h6 * (5 * r4);
  38283. d0 += h7 * (5 * r3);
  38284. d0 += h8 * (5 * r2);
  38285. d0 += h9 * (5 * r1);
  38286. c += (d0 >>> 13); d0 &= 0x1fff;
  38287. d1 = c;
  38288. d1 += h0 * r1;
  38289. d1 += h1 * r0;
  38290. d1 += h2 * (5 * r9);
  38291. d1 += h3 * (5 * r8);
  38292. d1 += h4 * (5 * r7);
  38293. c = (d1 >>> 13); d1 &= 0x1fff;
  38294. d1 += h5 * (5 * r6);
  38295. d1 += h6 * (5 * r5);
  38296. d1 += h7 * (5 * r4);
  38297. d1 += h8 * (5 * r3);
  38298. d1 += h9 * (5 * r2);
  38299. c += (d1 >>> 13); d1 &= 0x1fff;
  38300. d2 = c;
  38301. d2 += h0 * r2;
  38302. d2 += h1 * r1;
  38303. d2 += h2 * r0;
  38304. d2 += h3 * (5 * r9);
  38305. d2 += h4 * (5 * r8);
  38306. c = (d2 >>> 13); d2 &= 0x1fff;
  38307. d2 += h5 * (5 * r7);
  38308. d2 += h6 * (5 * r6);
  38309. d2 += h7 * (5 * r5);
  38310. d2 += h8 * (5 * r4);
  38311. d2 += h9 * (5 * r3);
  38312. c += (d2 >>> 13); d2 &= 0x1fff;
  38313. d3 = c;
  38314. d3 += h0 * r3;
  38315. d3 += h1 * r2;
  38316. d3 += h2 * r1;
  38317. d3 += h3 * r0;
  38318. d3 += h4 * (5 * r9);
  38319. c = (d3 >>> 13); d3 &= 0x1fff;
  38320. d3 += h5 * (5 * r8);
  38321. d3 += h6 * (5 * r7);
  38322. d3 += h7 * (5 * r6);
  38323. d3 += h8 * (5 * r5);
  38324. d3 += h9 * (5 * r4);
  38325. c += (d3 >>> 13); d3 &= 0x1fff;
  38326. d4 = c;
  38327. d4 += h0 * r4;
  38328. d4 += h1 * r3;
  38329. d4 += h2 * r2;
  38330. d4 += h3 * r1;
  38331. d4 += h4 * r0;
  38332. c = (d4 >>> 13); d4 &= 0x1fff;
  38333. d4 += h5 * (5 * r9);
  38334. d4 += h6 * (5 * r8);
  38335. d4 += h7 * (5 * r7);
  38336. d4 += h8 * (5 * r6);
  38337. d4 += h9 * (5 * r5);
  38338. c += (d4 >>> 13); d4 &= 0x1fff;
  38339. d5 = c;
  38340. d5 += h0 * r5;
  38341. d5 += h1 * r4;
  38342. d5 += h2 * r3;
  38343. d5 += h3 * r2;
  38344. d5 += h4 * r1;
  38345. c = (d5 >>> 13); d5 &= 0x1fff;
  38346. d5 += h5 * r0;
  38347. d5 += h6 * (5 * r9);
  38348. d5 += h7 * (5 * r8);
  38349. d5 += h8 * (5 * r7);
  38350. d5 += h9 * (5 * r6);
  38351. c += (d5 >>> 13); d5 &= 0x1fff;
  38352. d6 = c;
  38353. d6 += h0 * r6;
  38354. d6 += h1 * r5;
  38355. d6 += h2 * r4;
  38356. d6 += h3 * r3;
  38357. d6 += h4 * r2;
  38358. c = (d6 >>> 13); d6 &= 0x1fff;
  38359. d6 += h5 * r1;
  38360. d6 += h6 * r0;
  38361. d6 += h7 * (5 * r9);
  38362. d6 += h8 * (5 * r8);
  38363. d6 += h9 * (5 * r7);
  38364. c += (d6 >>> 13); d6 &= 0x1fff;
  38365. d7 = c;
  38366. d7 += h0 * r7;
  38367. d7 += h1 * r6;
  38368. d7 += h2 * r5;
  38369. d7 += h3 * r4;
  38370. d7 += h4 * r3;
  38371. c = (d7 >>> 13); d7 &= 0x1fff;
  38372. d7 += h5 * r2;
  38373. d7 += h6 * r1;
  38374. d7 += h7 * r0;
  38375. d7 += h8 * (5 * r9);
  38376. d7 += h9 * (5 * r8);
  38377. c += (d7 >>> 13); d7 &= 0x1fff;
  38378. d8 = c;
  38379. d8 += h0 * r8;
  38380. d8 += h1 * r7;
  38381. d8 += h2 * r6;
  38382. d8 += h3 * r5;
  38383. d8 += h4 * r4;
  38384. c = (d8 >>> 13); d8 &= 0x1fff;
  38385. d8 += h5 * r3;
  38386. d8 += h6 * r2;
  38387. d8 += h7 * r1;
  38388. d8 += h8 * r0;
  38389. d8 += h9 * (5 * r9);
  38390. c += (d8 >>> 13); d8 &= 0x1fff;
  38391. d9 = c;
  38392. d9 += h0 * r9;
  38393. d9 += h1 * r8;
  38394. d9 += h2 * r7;
  38395. d9 += h3 * r6;
  38396. d9 += h4 * r5;
  38397. c = (d9 >>> 13); d9 &= 0x1fff;
  38398. d9 += h5 * r4;
  38399. d9 += h6 * r3;
  38400. d9 += h7 * r2;
  38401. d9 += h8 * r1;
  38402. d9 += h9 * r0;
  38403. c += (d9 >>> 13); d9 &= 0x1fff;
  38404. c = (((c << 2) + c)) | 0;
  38405. c = (c + d0) | 0;
  38406. d0 = c & 0x1fff;
  38407. c = (c >>> 13);
  38408. d1 += c;
  38409. h0 = d0;
  38410. h1 = d1;
  38411. h2 = d2;
  38412. h3 = d3;
  38413. h4 = d4;
  38414. h5 = d5;
  38415. h6 = d6;
  38416. h7 = d7;
  38417. h8 = d8;
  38418. h9 = d9;
  38419. mpos += 16;
  38420. bytes -= 16;
  38421. }
  38422. this.h[0] = h0;
  38423. this.h[1] = h1;
  38424. this.h[2] = h2;
  38425. this.h[3] = h3;
  38426. this.h[4] = h4;
  38427. this.h[5] = h5;
  38428. this.h[6] = h6;
  38429. this.h[7] = h7;
  38430. this.h[8] = h8;
  38431. this.h[9] = h9;
  38432. };
  38433. poly1305.prototype.finish = function(mac, macpos) {
  38434. var g = new Uint16Array(10);
  38435. var c, mask, f, i;
  38436. if (this.leftover) {
  38437. i = this.leftover;
  38438. this.buffer[i++] = 1;
  38439. for (; i < 16; i++) this.buffer[i] = 0;
  38440. this.fin = 1;
  38441. this.blocks(this.buffer, 0, 16);
  38442. }
  38443. c = this.h[1] >>> 13;
  38444. this.h[1] &= 0x1fff;
  38445. for (i = 2; i < 10; i++) {
  38446. this.h[i] += c;
  38447. c = this.h[i] >>> 13;
  38448. this.h[i] &= 0x1fff;
  38449. }
  38450. this.h[0] += (c * 5);
  38451. c = this.h[0] >>> 13;
  38452. this.h[0] &= 0x1fff;
  38453. this.h[1] += c;
  38454. c = this.h[1] >>> 13;
  38455. this.h[1] &= 0x1fff;
  38456. this.h[2] += c;
  38457. g[0] = this.h[0] + 5;
  38458. c = g[0] >>> 13;
  38459. g[0] &= 0x1fff;
  38460. for (i = 1; i < 10; i++) {
  38461. g[i] = this.h[i] + c;
  38462. c = g[i] >>> 13;
  38463. g[i] &= 0x1fff;
  38464. }
  38465. g[9] -= (1 << 13);
  38466. mask = (c ^ 1) - 1;
  38467. for (i = 0; i < 10; i++) g[i] &= mask;
  38468. mask = ~mask;
  38469. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38470. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38471. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38472. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38473. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38474. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38475. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38476. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38477. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38478. f = this.h[0] + this.pad[0];
  38479. this.h[0] = f & 0xffff;
  38480. for (i = 1; i < 8; i++) {
  38481. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38482. this.h[i] = f & 0xffff;
  38483. }
  38484. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38485. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38486. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38487. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38488. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38489. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38490. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38491. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38492. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38493. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38494. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38495. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38496. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38497. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38498. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38499. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38500. };
  38501. poly1305.prototype.update = function(m, mpos, bytes) {
  38502. var i, want;
  38503. if (this.leftover) {
  38504. want = (16 - this.leftover);
  38505. if (want > bytes)
  38506. want = bytes;
  38507. for (i = 0; i < want; i++)
  38508. this.buffer[this.leftover + i] = m[mpos+i];
  38509. bytes -= want;
  38510. mpos += want;
  38511. this.leftover += want;
  38512. if (this.leftover < 16)
  38513. return;
  38514. this.blocks(this.buffer, 0, 16);
  38515. this.leftover = 0;
  38516. }
  38517. if (bytes >= 16) {
  38518. want = bytes - (bytes % 16);
  38519. this.blocks(m, mpos, want);
  38520. mpos += want;
  38521. bytes -= want;
  38522. }
  38523. if (bytes) {
  38524. for (i = 0; i < bytes; i++)
  38525. this.buffer[this.leftover + i] = m[mpos+i];
  38526. this.leftover += bytes;
  38527. }
  38528. };
  38529. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38530. var s = new poly1305(k);
  38531. s.update(m, mpos, n);
  38532. s.finish(out, outpos);
  38533. return 0;
  38534. }
  38535. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38536. var x = new Uint8Array(16);
  38537. crypto_onetimeauth(x,0,m,mpos,n,k);
  38538. return crypto_verify_16(h,hpos,x,0);
  38539. }
  38540. function crypto_secretbox(c,m,d,n,k) {
  38541. var i;
  38542. if (d < 32) return -1;
  38543. crypto_stream_xor(c,0,m,0,d,n,k);
  38544. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38545. for (i = 0; i < 16; i++) c[i] = 0;
  38546. return 0;
  38547. }
  38548. function crypto_secretbox_open(m,c,d,n,k) {
  38549. var i;
  38550. var x = new Uint8Array(32);
  38551. if (d < 32) return -1;
  38552. crypto_stream(x,0,32,n,k);
  38553. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38554. crypto_stream_xor(m,0,c,0,d,n,k);
  38555. for (i = 0; i < 32; i++) m[i] = 0;
  38556. return 0;
  38557. }
  38558. function set25519(r, a) {
  38559. var i;
  38560. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38561. }
  38562. function car25519(o) {
  38563. var i, v, c = 1;
  38564. for (i = 0; i < 16; i++) {
  38565. v = o[i] + c + 65535;
  38566. c = Math.floor(v / 65536);
  38567. o[i] = v - c * 65536;
  38568. }
  38569. o[0] += c-1 + 37 * (c-1);
  38570. }
  38571. function sel25519(p, q, b) {
  38572. var t, c = ~(b-1);
  38573. for (var i = 0; i < 16; i++) {
  38574. t = c & (p[i] ^ q[i]);
  38575. p[i] ^= t;
  38576. q[i] ^= t;
  38577. }
  38578. }
  38579. function pack25519(o, n) {
  38580. var i, j, b;
  38581. var m = gf(), t = gf();
  38582. for (i = 0; i < 16; i++) t[i] = n[i];
  38583. car25519(t);
  38584. car25519(t);
  38585. car25519(t);
  38586. for (j = 0; j < 2; j++) {
  38587. m[0] = t[0] - 0xffed;
  38588. for (i = 1; i < 15; i++) {
  38589. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38590. m[i-1] &= 0xffff;
  38591. }
  38592. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38593. b = (m[15]>>16) & 1;
  38594. m[14] &= 0xffff;
  38595. sel25519(t, m, 1-b);
  38596. }
  38597. for (i = 0; i < 16; i++) {
  38598. o[2*i] = t[i] & 0xff;
  38599. o[2*i+1] = t[i]>>8;
  38600. }
  38601. }
  38602. function neq25519(a, b) {
  38603. var c = new Uint8Array(32), d = new Uint8Array(32);
  38604. pack25519(c, a);
  38605. pack25519(d, b);
  38606. return crypto_verify_32(c, 0, d, 0);
  38607. }
  38608. function par25519(a) {
  38609. var d = new Uint8Array(32);
  38610. pack25519(d, a);
  38611. return d[0] & 1;
  38612. }
  38613. function unpack25519(o, n) {
  38614. var i;
  38615. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38616. o[15] &= 0x7fff;
  38617. }
  38618. function A(o, a, b) {
  38619. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38620. }
  38621. function Z(o, a, b) {
  38622. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38623. }
  38624. function M(o, a, b) {
  38625. var v, c,
  38626. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38627. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38628. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38629. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38630. b0 = b[0],
  38631. b1 = b[1],
  38632. b2 = b[2],
  38633. b3 = b[3],
  38634. b4 = b[4],
  38635. b5 = b[5],
  38636. b6 = b[6],
  38637. b7 = b[7],
  38638. b8 = b[8],
  38639. b9 = b[9],
  38640. b10 = b[10],
  38641. b11 = b[11],
  38642. b12 = b[12],
  38643. b13 = b[13],
  38644. b14 = b[14],
  38645. b15 = b[15];
  38646. v = a[0];
  38647. t0 += v * b0;
  38648. t1 += v * b1;
  38649. t2 += v * b2;
  38650. t3 += v * b3;
  38651. t4 += v * b4;
  38652. t5 += v * b5;
  38653. t6 += v * b6;
  38654. t7 += v * b7;
  38655. t8 += v * b8;
  38656. t9 += v * b9;
  38657. t10 += v * b10;
  38658. t11 += v * b11;
  38659. t12 += v * b12;
  38660. t13 += v * b13;
  38661. t14 += v * b14;
  38662. t15 += v * b15;
  38663. v = a[1];
  38664. t1 += v * b0;
  38665. t2 += v * b1;
  38666. t3 += v * b2;
  38667. t4 += v * b3;
  38668. t5 += v * b4;
  38669. t6 += v * b5;
  38670. t7 += v * b6;
  38671. t8 += v * b7;
  38672. t9 += v * b8;
  38673. t10 += v * b9;
  38674. t11 += v * b10;
  38675. t12 += v * b11;
  38676. t13 += v * b12;
  38677. t14 += v * b13;
  38678. t15 += v * b14;
  38679. t16 += v * b15;
  38680. v = a[2];
  38681. t2 += v * b0;
  38682. t3 += v * b1;
  38683. t4 += v * b2;
  38684. t5 += v * b3;
  38685. t6 += v * b4;
  38686. t7 += v * b5;
  38687. t8 += v * b6;
  38688. t9 += v * b7;
  38689. t10 += v * b8;
  38690. t11 += v * b9;
  38691. t12 += v * b10;
  38692. t13 += v * b11;
  38693. t14 += v * b12;
  38694. t15 += v * b13;
  38695. t16 += v * b14;
  38696. t17 += v * b15;
  38697. v = a[3];
  38698. t3 += v * b0;
  38699. t4 += v * b1;
  38700. t5 += v * b2;
  38701. t6 += v * b3;
  38702. t7 += v * b4;
  38703. t8 += v * b5;
  38704. t9 += v * b6;
  38705. t10 += v * b7;
  38706. t11 += v * b8;
  38707. t12 += v * b9;
  38708. t13 += v * b10;
  38709. t14 += v * b11;
  38710. t15 += v * b12;
  38711. t16 += v * b13;
  38712. t17 += v * b14;
  38713. t18 += v * b15;
  38714. v = a[4];
  38715. t4 += v * b0;
  38716. t5 += v * b1;
  38717. t6 += v * b2;
  38718. t7 += v * b3;
  38719. t8 += v * b4;
  38720. t9 += v * b5;
  38721. t10 += v * b6;
  38722. t11 += v * b7;
  38723. t12 += v * b8;
  38724. t13 += v * b9;
  38725. t14 += v * b10;
  38726. t15 += v * b11;
  38727. t16 += v * b12;
  38728. t17 += v * b13;
  38729. t18 += v * b14;
  38730. t19 += v * b15;
  38731. v = a[5];
  38732. t5 += v * b0;
  38733. t6 += v * b1;
  38734. t7 += v * b2;
  38735. t8 += v * b3;
  38736. t9 += v * b4;
  38737. t10 += v * b5;
  38738. t11 += v * b6;
  38739. t12 += v * b7;
  38740. t13 += v * b8;
  38741. t14 += v * b9;
  38742. t15 += v * b10;
  38743. t16 += v * b11;
  38744. t17 += v * b12;
  38745. t18 += v * b13;
  38746. t19 += v * b14;
  38747. t20 += v * b15;
  38748. v = a[6];
  38749. t6 += v * b0;
  38750. t7 += v * b1;
  38751. t8 += v * b2;
  38752. t9 += v * b3;
  38753. t10 += v * b4;
  38754. t11 += v * b5;
  38755. t12 += v * b6;
  38756. t13 += v * b7;
  38757. t14 += v * b8;
  38758. t15 += v * b9;
  38759. t16 += v * b10;
  38760. t17 += v * b11;
  38761. t18 += v * b12;
  38762. t19 += v * b13;
  38763. t20 += v * b14;
  38764. t21 += v * b15;
  38765. v = a[7];
  38766. t7 += v * b0;
  38767. t8 += v * b1;
  38768. t9 += v * b2;
  38769. t10 += v * b3;
  38770. t11 += v * b4;
  38771. t12 += v * b5;
  38772. t13 += v * b6;
  38773. t14 += v * b7;
  38774. t15 += v * b8;
  38775. t16 += v * b9;
  38776. t17 += v * b10;
  38777. t18 += v * b11;
  38778. t19 += v * b12;
  38779. t20 += v * b13;
  38780. t21 += v * b14;
  38781. t22 += v * b15;
  38782. v = a[8];
  38783. t8 += v * b0;
  38784. t9 += v * b1;
  38785. t10 += v * b2;
  38786. t11 += v * b3;
  38787. t12 += v * b4;
  38788. t13 += v * b5;
  38789. t14 += v * b6;
  38790. t15 += v * b7;
  38791. t16 += v * b8;
  38792. t17 += v * b9;
  38793. t18 += v * b10;
  38794. t19 += v * b11;
  38795. t20 += v * b12;
  38796. t21 += v * b13;
  38797. t22 += v * b14;
  38798. t23 += v * b15;
  38799. v = a[9];
  38800. t9 += v * b0;
  38801. t10 += v * b1;
  38802. t11 += v * b2;
  38803. t12 += v * b3;
  38804. t13 += v * b4;
  38805. t14 += v * b5;
  38806. t15 += v * b6;
  38807. t16 += v * b7;
  38808. t17 += v * b8;
  38809. t18 += v * b9;
  38810. t19 += v * b10;
  38811. t20 += v * b11;
  38812. t21 += v * b12;
  38813. t22 += v * b13;
  38814. t23 += v * b14;
  38815. t24 += v * b15;
  38816. v = a[10];
  38817. t10 += v * b0;
  38818. t11 += v * b1;
  38819. t12 += v * b2;
  38820. t13 += v * b3;
  38821. t14 += v * b4;
  38822. t15 += v * b5;
  38823. t16 += v * b6;
  38824. t17 += v * b7;
  38825. t18 += v * b8;
  38826. t19 += v * b9;
  38827. t20 += v * b10;
  38828. t21 += v * b11;
  38829. t22 += v * b12;
  38830. t23 += v * b13;
  38831. t24 += v * b14;
  38832. t25 += v * b15;
  38833. v = a[11];
  38834. t11 += v * b0;
  38835. t12 += v * b1;
  38836. t13 += v * b2;
  38837. t14 += v * b3;
  38838. t15 += v * b4;
  38839. t16 += v * b5;
  38840. t17 += v * b6;
  38841. t18 += v * b7;
  38842. t19 += v * b8;
  38843. t20 += v * b9;
  38844. t21 += v * b10;
  38845. t22 += v * b11;
  38846. t23 += v * b12;
  38847. t24 += v * b13;
  38848. t25 += v * b14;
  38849. t26 += v * b15;
  38850. v = a[12];
  38851. t12 += v * b0;
  38852. t13 += v * b1;
  38853. t14 += v * b2;
  38854. t15 += v * b3;
  38855. t16 += v * b4;
  38856. t17 += v * b5;
  38857. t18 += v * b6;
  38858. t19 += v * b7;
  38859. t20 += v * b8;
  38860. t21 += v * b9;
  38861. t22 += v * b10;
  38862. t23 += v * b11;
  38863. t24 += v * b12;
  38864. t25 += v * b13;
  38865. t26 += v * b14;
  38866. t27 += v * b15;
  38867. v = a[13];
  38868. t13 += v * b0;
  38869. t14 += v * b1;
  38870. t15 += v * b2;
  38871. t16 += v * b3;
  38872. t17 += v * b4;
  38873. t18 += v * b5;
  38874. t19 += v * b6;
  38875. t20 += v * b7;
  38876. t21 += v * b8;
  38877. t22 += v * b9;
  38878. t23 += v * b10;
  38879. t24 += v * b11;
  38880. t25 += v * b12;
  38881. t26 += v * b13;
  38882. t27 += v * b14;
  38883. t28 += v * b15;
  38884. v = a[14];
  38885. t14 += v * b0;
  38886. t15 += v * b1;
  38887. t16 += v * b2;
  38888. t17 += v * b3;
  38889. t18 += v * b4;
  38890. t19 += v * b5;
  38891. t20 += v * b6;
  38892. t21 += v * b7;
  38893. t22 += v * b8;
  38894. t23 += v * b9;
  38895. t24 += v * b10;
  38896. t25 += v * b11;
  38897. t26 += v * b12;
  38898. t27 += v * b13;
  38899. t28 += v * b14;
  38900. t29 += v * b15;
  38901. v = a[15];
  38902. t15 += v * b0;
  38903. t16 += v * b1;
  38904. t17 += v * b2;
  38905. t18 += v * b3;
  38906. t19 += v * b4;
  38907. t20 += v * b5;
  38908. t21 += v * b6;
  38909. t22 += v * b7;
  38910. t23 += v * b8;
  38911. t24 += v * b9;
  38912. t25 += v * b10;
  38913. t26 += v * b11;
  38914. t27 += v * b12;
  38915. t28 += v * b13;
  38916. t29 += v * b14;
  38917. t30 += v * b15;
  38918. t0 += 38 * t16;
  38919. t1 += 38 * t17;
  38920. t2 += 38 * t18;
  38921. t3 += 38 * t19;
  38922. t4 += 38 * t20;
  38923. t5 += 38 * t21;
  38924. t6 += 38 * t22;
  38925. t7 += 38 * t23;
  38926. t8 += 38 * t24;
  38927. t9 += 38 * t25;
  38928. t10 += 38 * t26;
  38929. t11 += 38 * t27;
  38930. t12 += 38 * t28;
  38931. t13 += 38 * t29;
  38932. t14 += 38 * t30;
  38933. // t15 left as is
  38934. // first car
  38935. c = 1;
  38936. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38937. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38938. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38939. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38940. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38941. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38942. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38943. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38944. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38945. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38946. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38947. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38948. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38949. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38950. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38951. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38952. t0 += c-1 + 37 * (c-1);
  38953. // second car
  38954. c = 1;
  38955. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38956. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38957. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38958. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38959. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38960. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38961. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38962. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38963. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38964. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38965. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38966. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38967. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38968. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38969. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38970. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38971. t0 += c-1 + 37 * (c-1);
  38972. o[ 0] = t0;
  38973. o[ 1] = t1;
  38974. o[ 2] = t2;
  38975. o[ 3] = t3;
  38976. o[ 4] = t4;
  38977. o[ 5] = t5;
  38978. o[ 6] = t6;
  38979. o[ 7] = t7;
  38980. o[ 8] = t8;
  38981. o[ 9] = t9;
  38982. o[10] = t10;
  38983. o[11] = t11;
  38984. o[12] = t12;
  38985. o[13] = t13;
  38986. o[14] = t14;
  38987. o[15] = t15;
  38988. }
  38989. function S(o, a) {
  38990. M(o, a, a);
  38991. }
  38992. function inv25519(o, i) {
  38993. var c = gf();
  38994. var a;
  38995. for (a = 0; a < 16; a++) c[a] = i[a];
  38996. for (a = 253; a >= 0; a--) {
  38997. S(c, c);
  38998. if(a !== 2 && a !== 4) M(c, c, i);
  38999. }
  39000. for (a = 0; a < 16; a++) o[a] = c[a];
  39001. }
  39002. function pow2523(o, i) {
  39003. var c = gf();
  39004. var a;
  39005. for (a = 0; a < 16; a++) c[a] = i[a];
  39006. for (a = 250; a >= 0; a--) {
  39007. S(c, c);
  39008. if(a !== 1) M(c, c, i);
  39009. }
  39010. for (a = 0; a < 16; a++) o[a] = c[a];
  39011. }
  39012. function crypto_scalarmult(q, n, p) {
  39013. var z = new Uint8Array(32);
  39014. var x = new Float64Array(80), r, i;
  39015. var a = gf(), b = gf(), c = gf(),
  39016. d = gf(), e = gf(), f = gf();
  39017. for (i = 0; i < 31; i++) z[i] = n[i];
  39018. z[31]=(n[31]&127)|64;
  39019. z[0]&=248;
  39020. unpack25519(x,p);
  39021. for (i = 0; i < 16; i++) {
  39022. b[i]=x[i];
  39023. d[i]=a[i]=c[i]=0;
  39024. }
  39025. a[0]=d[0]=1;
  39026. for (i=254; i>=0; --i) {
  39027. r=(z[i>>>3]>>>(i&7))&1;
  39028. sel25519(a,b,r);
  39029. sel25519(c,d,r);
  39030. A(e,a,c);
  39031. Z(a,a,c);
  39032. A(c,b,d);
  39033. Z(b,b,d);
  39034. S(d,e);
  39035. S(f,a);
  39036. M(a,c,a);
  39037. M(c,b,e);
  39038. A(e,a,c);
  39039. Z(a,a,c);
  39040. S(b,a);
  39041. Z(c,d,f);
  39042. M(a,c,_121665);
  39043. A(a,a,d);
  39044. M(c,c,a);
  39045. M(a,d,f);
  39046. M(d,b,x);
  39047. S(b,e);
  39048. sel25519(a,b,r);
  39049. sel25519(c,d,r);
  39050. }
  39051. for (i = 0; i < 16; i++) {
  39052. x[i+16]=a[i];
  39053. x[i+32]=c[i];
  39054. x[i+48]=b[i];
  39055. x[i+64]=d[i];
  39056. }
  39057. var x32 = x.subarray(32);
  39058. var x16 = x.subarray(16);
  39059. inv25519(x32,x32);
  39060. M(x16,x16,x32);
  39061. pack25519(q,x16);
  39062. return 0;
  39063. }
  39064. function crypto_scalarmult_base(q, n) {
  39065. return crypto_scalarmult(q, n, _9);
  39066. }
  39067. function crypto_box_keypair(y, x) {
  39068. randombytes(x, 32);
  39069. return crypto_scalarmult_base(y, x);
  39070. }
  39071. function crypto_box_beforenm(k, y, x) {
  39072. var s = new Uint8Array(32);
  39073. crypto_scalarmult(s, x, y);
  39074. return crypto_core_hsalsa20(k, _0, s, sigma);
  39075. }
  39076. var crypto_box_afternm = crypto_secretbox;
  39077. var crypto_box_open_afternm = crypto_secretbox_open;
  39078. function crypto_box(c, m, d, n, y, x) {
  39079. var k = new Uint8Array(32);
  39080. crypto_box_beforenm(k, y, x);
  39081. return crypto_box_afternm(c, m, d, n, k);
  39082. }
  39083. function crypto_box_open(m, c, d, n, y, x) {
  39084. var k = new Uint8Array(32);
  39085. crypto_box_beforenm(k, y, x);
  39086. return crypto_box_open_afternm(m, c, d, n, k);
  39087. }
  39088. var K = [
  39089. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39090. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39091. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39092. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39093. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39094. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39095. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39096. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39097. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39098. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39099. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39100. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39101. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39102. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39103. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39104. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39105. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39106. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39107. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39108. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39109. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39110. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39111. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39112. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39113. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39114. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39115. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39116. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39117. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39118. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39119. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39120. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39121. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39122. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39123. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39124. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39125. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39126. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39127. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39128. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39129. ];
  39130. function crypto_hashblocks_hl(hh, hl, m, n) {
  39131. var wh = new Int32Array(16), wl = new Int32Array(16),
  39132. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39133. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39134. th, tl, i, j, h, l, a, b, c, d;
  39135. var ah0 = hh[0],
  39136. ah1 = hh[1],
  39137. ah2 = hh[2],
  39138. ah3 = hh[3],
  39139. ah4 = hh[4],
  39140. ah5 = hh[5],
  39141. ah6 = hh[6],
  39142. ah7 = hh[7],
  39143. al0 = hl[0],
  39144. al1 = hl[1],
  39145. al2 = hl[2],
  39146. al3 = hl[3],
  39147. al4 = hl[4],
  39148. al5 = hl[5],
  39149. al6 = hl[6],
  39150. al7 = hl[7];
  39151. var pos = 0;
  39152. while (n >= 128) {
  39153. for (i = 0; i < 16; i++) {
  39154. j = 8 * i + pos;
  39155. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39156. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39157. }
  39158. for (i = 0; i < 80; i++) {
  39159. bh0 = ah0;
  39160. bh1 = ah1;
  39161. bh2 = ah2;
  39162. bh3 = ah3;
  39163. bh4 = ah4;
  39164. bh5 = ah5;
  39165. bh6 = ah6;
  39166. bh7 = ah7;
  39167. bl0 = al0;
  39168. bl1 = al1;
  39169. bl2 = al2;
  39170. bl3 = al3;
  39171. bl4 = al4;
  39172. bl5 = al5;
  39173. bl6 = al6;
  39174. bl7 = al7;
  39175. // add
  39176. h = ah7;
  39177. l = al7;
  39178. a = l & 0xffff; b = l >>> 16;
  39179. c = h & 0xffff; d = h >>> 16;
  39180. // Sigma1
  39181. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39182. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39183. a += l & 0xffff; b += l >>> 16;
  39184. c += h & 0xffff; d += h >>> 16;
  39185. // Ch
  39186. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39187. l = (al4 & al5) ^ (~al4 & al6);
  39188. a += l & 0xffff; b += l >>> 16;
  39189. c += h & 0xffff; d += h >>> 16;
  39190. // K
  39191. h = K[i*2];
  39192. l = K[i*2+1];
  39193. a += l & 0xffff; b += l >>> 16;
  39194. c += h & 0xffff; d += h >>> 16;
  39195. // w
  39196. h = wh[i%16];
  39197. l = wl[i%16];
  39198. a += l & 0xffff; b += l >>> 16;
  39199. c += h & 0xffff; d += h >>> 16;
  39200. b += a >>> 16;
  39201. c += b >>> 16;
  39202. d += c >>> 16;
  39203. th = c & 0xffff | d << 16;
  39204. tl = a & 0xffff | b << 16;
  39205. // add
  39206. h = th;
  39207. l = tl;
  39208. a = l & 0xffff; b = l >>> 16;
  39209. c = h & 0xffff; d = h >>> 16;
  39210. // Sigma0
  39211. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39212. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39213. a += l & 0xffff; b += l >>> 16;
  39214. c += h & 0xffff; d += h >>> 16;
  39215. // Maj
  39216. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39217. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39218. a += l & 0xffff; b += l >>> 16;
  39219. c += h & 0xffff; d += h >>> 16;
  39220. b += a >>> 16;
  39221. c += b >>> 16;
  39222. d += c >>> 16;
  39223. bh7 = (c & 0xffff) | (d << 16);
  39224. bl7 = (a & 0xffff) | (b << 16);
  39225. // add
  39226. h = bh3;
  39227. l = bl3;
  39228. a = l & 0xffff; b = l >>> 16;
  39229. c = h & 0xffff; d = h >>> 16;
  39230. h = th;
  39231. l = tl;
  39232. a += l & 0xffff; b += l >>> 16;
  39233. c += h & 0xffff; d += h >>> 16;
  39234. b += a >>> 16;
  39235. c += b >>> 16;
  39236. d += c >>> 16;
  39237. bh3 = (c & 0xffff) | (d << 16);
  39238. bl3 = (a & 0xffff) | (b << 16);
  39239. ah1 = bh0;
  39240. ah2 = bh1;
  39241. ah3 = bh2;
  39242. ah4 = bh3;
  39243. ah5 = bh4;
  39244. ah6 = bh5;
  39245. ah7 = bh6;
  39246. ah0 = bh7;
  39247. al1 = bl0;
  39248. al2 = bl1;
  39249. al3 = bl2;
  39250. al4 = bl3;
  39251. al5 = bl4;
  39252. al6 = bl5;
  39253. al7 = bl6;
  39254. al0 = bl7;
  39255. if (i%16 === 15) {
  39256. for (j = 0; j < 16; j++) {
  39257. // add
  39258. h = wh[j];
  39259. l = wl[j];
  39260. a = l & 0xffff; b = l >>> 16;
  39261. c = h & 0xffff; d = h >>> 16;
  39262. h = wh[(j+9)%16];
  39263. l = wl[(j+9)%16];
  39264. a += l & 0xffff; b += l >>> 16;
  39265. c += h & 0xffff; d += h >>> 16;
  39266. // sigma0
  39267. th = wh[(j+1)%16];
  39268. tl = wl[(j+1)%16];
  39269. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39270. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39271. a += l & 0xffff; b += l >>> 16;
  39272. c += h & 0xffff; d += h >>> 16;
  39273. // sigma1
  39274. th = wh[(j+14)%16];
  39275. tl = wl[(j+14)%16];
  39276. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39277. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39278. a += l & 0xffff; b += l >>> 16;
  39279. c += h & 0xffff; d += h >>> 16;
  39280. b += a >>> 16;
  39281. c += b >>> 16;
  39282. d += c >>> 16;
  39283. wh[j] = (c & 0xffff) | (d << 16);
  39284. wl[j] = (a & 0xffff) | (b << 16);
  39285. }
  39286. }
  39287. }
  39288. // add
  39289. h = ah0;
  39290. l = al0;
  39291. a = l & 0xffff; b = l >>> 16;
  39292. c = h & 0xffff; d = h >>> 16;
  39293. h = hh[0];
  39294. l = hl[0];
  39295. a += l & 0xffff; b += l >>> 16;
  39296. c += h & 0xffff; d += h >>> 16;
  39297. b += a >>> 16;
  39298. c += b >>> 16;
  39299. d += c >>> 16;
  39300. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39301. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39302. h = ah1;
  39303. l = al1;
  39304. a = l & 0xffff; b = l >>> 16;
  39305. c = h & 0xffff; d = h >>> 16;
  39306. h = hh[1];
  39307. l = hl[1];
  39308. a += l & 0xffff; b += l >>> 16;
  39309. c += h & 0xffff; d += h >>> 16;
  39310. b += a >>> 16;
  39311. c += b >>> 16;
  39312. d += c >>> 16;
  39313. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39314. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39315. h = ah2;
  39316. l = al2;
  39317. a = l & 0xffff; b = l >>> 16;
  39318. c = h & 0xffff; d = h >>> 16;
  39319. h = hh[2];
  39320. l = hl[2];
  39321. a += l & 0xffff; b += l >>> 16;
  39322. c += h & 0xffff; d += h >>> 16;
  39323. b += a >>> 16;
  39324. c += b >>> 16;
  39325. d += c >>> 16;
  39326. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39327. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39328. h = ah3;
  39329. l = al3;
  39330. a = l & 0xffff; b = l >>> 16;
  39331. c = h & 0xffff; d = h >>> 16;
  39332. h = hh[3];
  39333. l = hl[3];
  39334. a += l & 0xffff; b += l >>> 16;
  39335. c += h & 0xffff; d += h >>> 16;
  39336. b += a >>> 16;
  39337. c += b >>> 16;
  39338. d += c >>> 16;
  39339. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39340. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39341. h = ah4;
  39342. l = al4;
  39343. a = l & 0xffff; b = l >>> 16;
  39344. c = h & 0xffff; d = h >>> 16;
  39345. h = hh[4];
  39346. l = hl[4];
  39347. a += l & 0xffff; b += l >>> 16;
  39348. c += h & 0xffff; d += h >>> 16;
  39349. b += a >>> 16;
  39350. c += b >>> 16;
  39351. d += c >>> 16;
  39352. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39353. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39354. h = ah5;
  39355. l = al5;
  39356. a = l & 0xffff; b = l >>> 16;
  39357. c = h & 0xffff; d = h >>> 16;
  39358. h = hh[5];
  39359. l = hl[5];
  39360. a += l & 0xffff; b += l >>> 16;
  39361. c += h & 0xffff; d += h >>> 16;
  39362. b += a >>> 16;
  39363. c += b >>> 16;
  39364. d += c >>> 16;
  39365. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39366. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39367. h = ah6;
  39368. l = al6;
  39369. a = l & 0xffff; b = l >>> 16;
  39370. c = h & 0xffff; d = h >>> 16;
  39371. h = hh[6];
  39372. l = hl[6];
  39373. a += l & 0xffff; b += l >>> 16;
  39374. c += h & 0xffff; d += h >>> 16;
  39375. b += a >>> 16;
  39376. c += b >>> 16;
  39377. d += c >>> 16;
  39378. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39379. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39380. h = ah7;
  39381. l = al7;
  39382. a = l & 0xffff; b = l >>> 16;
  39383. c = h & 0xffff; d = h >>> 16;
  39384. h = hh[7];
  39385. l = hl[7];
  39386. a += l & 0xffff; b += l >>> 16;
  39387. c += h & 0xffff; d += h >>> 16;
  39388. b += a >>> 16;
  39389. c += b >>> 16;
  39390. d += c >>> 16;
  39391. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39392. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39393. pos += 128;
  39394. n -= 128;
  39395. }
  39396. return n;
  39397. }
  39398. function crypto_hash(out, m, n) {
  39399. var hh = new Int32Array(8),
  39400. hl = new Int32Array(8),
  39401. x = new Uint8Array(256),
  39402. i, b = n;
  39403. hh[0] = 0x6a09e667;
  39404. hh[1] = 0xbb67ae85;
  39405. hh[2] = 0x3c6ef372;
  39406. hh[3] = 0xa54ff53a;
  39407. hh[4] = 0x510e527f;
  39408. hh[5] = 0x9b05688c;
  39409. hh[6] = 0x1f83d9ab;
  39410. hh[7] = 0x5be0cd19;
  39411. hl[0] = 0xf3bcc908;
  39412. hl[1] = 0x84caa73b;
  39413. hl[2] = 0xfe94f82b;
  39414. hl[3] = 0x5f1d36f1;
  39415. hl[4] = 0xade682d1;
  39416. hl[5] = 0x2b3e6c1f;
  39417. hl[6] = 0xfb41bd6b;
  39418. hl[7] = 0x137e2179;
  39419. crypto_hashblocks_hl(hh, hl, m, n);
  39420. n %= 128;
  39421. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39422. x[n] = 128;
  39423. n = 256-128*(n<112?1:0);
  39424. x[n-9] = 0;
  39425. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39426. crypto_hashblocks_hl(hh, hl, x, n);
  39427. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39428. return 0;
  39429. }
  39430. function add(p, q) {
  39431. var a = gf(), b = gf(), c = gf(),
  39432. d = gf(), e = gf(), f = gf(),
  39433. g = gf(), h = gf(), t = gf();
  39434. Z(a, p[1], p[0]);
  39435. Z(t, q[1], q[0]);
  39436. M(a, a, t);
  39437. A(b, p[0], p[1]);
  39438. A(t, q[0], q[1]);
  39439. M(b, b, t);
  39440. M(c, p[3], q[3]);
  39441. M(c, c, D2);
  39442. M(d, p[2], q[2]);
  39443. A(d, d, d);
  39444. Z(e, b, a);
  39445. Z(f, d, c);
  39446. A(g, d, c);
  39447. A(h, b, a);
  39448. M(p[0], e, f);
  39449. M(p[1], h, g);
  39450. M(p[2], g, f);
  39451. M(p[3], e, h);
  39452. }
  39453. function cswap(p, q, b) {
  39454. var i;
  39455. for (i = 0; i < 4; i++) {
  39456. sel25519(p[i], q[i], b);
  39457. }
  39458. }
  39459. function pack(r, p) {
  39460. var tx = gf(), ty = gf(), zi = gf();
  39461. inv25519(zi, p[2]);
  39462. M(tx, p[0], zi);
  39463. M(ty, p[1], zi);
  39464. pack25519(r, ty);
  39465. r[31] ^= par25519(tx) << 7;
  39466. }
  39467. function scalarmult(p, q, s) {
  39468. var b, i;
  39469. set25519(p[0], gf0);
  39470. set25519(p[1], gf1);
  39471. set25519(p[2], gf1);
  39472. set25519(p[3], gf0);
  39473. for (i = 255; i >= 0; --i) {
  39474. b = (s[(i/8)|0] >> (i&7)) & 1;
  39475. cswap(p, q, b);
  39476. add(q, p);
  39477. add(p, p);
  39478. cswap(p, q, b);
  39479. }
  39480. }
  39481. function scalarbase(p, s) {
  39482. var q = [gf(), gf(), gf(), gf()];
  39483. set25519(q[0], X);
  39484. set25519(q[1], Y);
  39485. set25519(q[2], gf1);
  39486. M(q[3], X, Y);
  39487. scalarmult(p, q, s);
  39488. }
  39489. function crypto_sign_keypair(pk, sk, seeded) {
  39490. var d = new Uint8Array(64);
  39491. var p = [gf(), gf(), gf(), gf()];
  39492. var i;
  39493. if (!seeded) randombytes(sk, 32);
  39494. crypto_hash(d, sk, 32);
  39495. d[0] &= 248;
  39496. d[31] &= 127;
  39497. d[31] |= 64;
  39498. scalarbase(p, d);
  39499. pack(pk, p);
  39500. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39501. return 0;
  39502. }
  39503. 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]);
  39504. function modL(r, x) {
  39505. var carry, i, j, k;
  39506. for (i = 63; i >= 32; --i) {
  39507. carry = 0;
  39508. for (j = i - 32, k = i - 12; j < k; ++j) {
  39509. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39510. carry = (x[j] + 128) >> 8;
  39511. x[j] -= carry * 256;
  39512. }
  39513. x[j] += carry;
  39514. x[i] = 0;
  39515. }
  39516. carry = 0;
  39517. for (j = 0; j < 32; j++) {
  39518. x[j] += carry - (x[31] >> 4) * L[j];
  39519. carry = x[j] >> 8;
  39520. x[j] &= 255;
  39521. }
  39522. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39523. for (i = 0; i < 32; i++) {
  39524. x[i+1] += x[i] >> 8;
  39525. r[i] = x[i] & 255;
  39526. }
  39527. }
  39528. function reduce(r) {
  39529. var x = new Float64Array(64), i;
  39530. for (i = 0; i < 64; i++) x[i] = r[i];
  39531. for (i = 0; i < 64; i++) r[i] = 0;
  39532. modL(r, x);
  39533. }
  39534. // Note: difference from C - smlen returned, not passed as argument.
  39535. function crypto_sign(sm, m, n, sk) {
  39536. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39537. var i, j, x = new Float64Array(64);
  39538. var p = [gf(), gf(), gf(), gf()];
  39539. crypto_hash(d, sk, 32);
  39540. d[0] &= 248;
  39541. d[31] &= 127;
  39542. d[31] |= 64;
  39543. var smlen = n + 64;
  39544. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39545. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39546. crypto_hash(r, sm.subarray(32), n+32);
  39547. reduce(r);
  39548. scalarbase(p, r);
  39549. pack(sm, p);
  39550. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39551. crypto_hash(h, sm, n + 64);
  39552. reduce(h);
  39553. for (i = 0; i < 64; i++) x[i] = 0;
  39554. for (i = 0; i < 32; i++) x[i] = r[i];
  39555. for (i = 0; i < 32; i++) {
  39556. for (j = 0; j < 32; j++) {
  39557. x[i+j] += h[i] * d[j];
  39558. }
  39559. }
  39560. modL(sm.subarray(32), x);
  39561. return smlen;
  39562. }
  39563. function unpackneg(r, p) {
  39564. var t = gf(), chk = gf(), num = gf(),
  39565. den = gf(), den2 = gf(), den4 = gf(),
  39566. den6 = gf();
  39567. set25519(r[2], gf1);
  39568. unpack25519(r[1], p);
  39569. S(num, r[1]);
  39570. M(den, num, D);
  39571. Z(num, num, r[2]);
  39572. A(den, r[2], den);
  39573. S(den2, den);
  39574. S(den4, den2);
  39575. M(den6, den4, den2);
  39576. M(t, den6, num);
  39577. M(t, t, den);
  39578. pow2523(t, t);
  39579. M(t, t, num);
  39580. M(t, t, den);
  39581. M(t, t, den);
  39582. M(r[0], t, den);
  39583. S(chk, r[0]);
  39584. M(chk, chk, den);
  39585. if (neq25519(chk, num)) M(r[0], r[0], I);
  39586. S(chk, r[0]);
  39587. M(chk, chk, den);
  39588. if (neq25519(chk, num)) return -1;
  39589. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39590. M(r[3], r[0], r[1]);
  39591. return 0;
  39592. }
  39593. function crypto_sign_open(m, sm, n, pk) {
  39594. var i, mlen;
  39595. var t = new Uint8Array(32), h = new Uint8Array(64);
  39596. var p = [gf(), gf(), gf(), gf()],
  39597. q = [gf(), gf(), gf(), gf()];
  39598. mlen = -1;
  39599. if (n < 64) return -1;
  39600. if (unpackneg(q, pk)) return -1;
  39601. for (i = 0; i < n; i++) m[i] = sm[i];
  39602. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39603. crypto_hash(h, m, n);
  39604. reduce(h);
  39605. scalarmult(p, q, h);
  39606. scalarbase(q, sm.subarray(32));
  39607. add(p, q);
  39608. pack(t, p);
  39609. n -= 64;
  39610. if (crypto_verify_32(sm, 0, t, 0)) {
  39611. for (i = 0; i < n; i++) m[i] = 0;
  39612. return -1;
  39613. }
  39614. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39615. mlen = n;
  39616. return mlen;
  39617. }
  39618. var crypto_secretbox_KEYBYTES = 32,
  39619. crypto_secretbox_NONCEBYTES = 24,
  39620. crypto_secretbox_ZEROBYTES = 32,
  39621. crypto_secretbox_BOXZEROBYTES = 16,
  39622. crypto_scalarmult_BYTES = 32,
  39623. crypto_scalarmult_SCALARBYTES = 32,
  39624. crypto_box_PUBLICKEYBYTES = 32,
  39625. crypto_box_SECRETKEYBYTES = 32,
  39626. crypto_box_BEFORENMBYTES = 32,
  39627. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39628. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39629. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39630. crypto_sign_BYTES = 64,
  39631. crypto_sign_PUBLICKEYBYTES = 32,
  39632. crypto_sign_SECRETKEYBYTES = 64,
  39633. crypto_sign_SEEDBYTES = 32,
  39634. crypto_hash_BYTES = 64;
  39635. nacl.lowlevel = {
  39636. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39637. crypto_stream_xor: crypto_stream_xor,
  39638. crypto_stream: crypto_stream,
  39639. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39640. crypto_stream_salsa20: crypto_stream_salsa20,
  39641. crypto_onetimeauth: crypto_onetimeauth,
  39642. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39643. crypto_verify_16: crypto_verify_16,
  39644. crypto_verify_32: crypto_verify_32,
  39645. crypto_secretbox: crypto_secretbox,
  39646. crypto_secretbox_open: crypto_secretbox_open,
  39647. crypto_scalarmult: crypto_scalarmult,
  39648. crypto_scalarmult_base: crypto_scalarmult_base,
  39649. crypto_box_beforenm: crypto_box_beforenm,
  39650. crypto_box_afternm: crypto_box_afternm,
  39651. crypto_box: crypto_box,
  39652. crypto_box_open: crypto_box_open,
  39653. crypto_box_keypair: crypto_box_keypair,
  39654. crypto_hash: crypto_hash,
  39655. crypto_sign: crypto_sign,
  39656. crypto_sign_keypair: crypto_sign_keypair,
  39657. crypto_sign_open: crypto_sign_open,
  39658. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39659. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39660. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39661. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39662. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39663. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39664. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39665. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39666. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39667. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39668. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39669. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39670. crypto_sign_BYTES: crypto_sign_BYTES,
  39671. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39672. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39673. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39674. crypto_hash_BYTES: crypto_hash_BYTES
  39675. };
  39676. /* High-level API */
  39677. function checkLengths(k, n) {
  39678. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39679. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39680. }
  39681. function checkBoxLengths(pk, sk) {
  39682. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39683. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39684. }
  39685. function checkArrayTypes() {
  39686. for (var i = 0; i < arguments.length; i++) {
  39687. if (!(arguments[i] instanceof Uint8Array))
  39688. throw new TypeError('unexpected type, use Uint8Array');
  39689. }
  39690. }
  39691. function cleanup(arr) {
  39692. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39693. }
  39694. nacl.randomBytes = function(n) {
  39695. var b = new Uint8Array(n);
  39696. randombytes(b, n);
  39697. return b;
  39698. };
  39699. nacl.secretbox = function(msg, nonce, key) {
  39700. checkArrayTypes(msg, nonce, key);
  39701. checkLengths(key, nonce);
  39702. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39703. var c = new Uint8Array(m.length);
  39704. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39705. crypto_secretbox(c, m, m.length, nonce, key);
  39706. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39707. };
  39708. nacl.secretbox.open = function(box, nonce, key) {
  39709. checkArrayTypes(box, nonce, key);
  39710. checkLengths(key, nonce);
  39711. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39712. var m = new Uint8Array(c.length);
  39713. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39714. if (c.length < 32) return null;
  39715. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39716. return m.subarray(crypto_secretbox_ZEROBYTES);
  39717. };
  39718. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39719. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39720. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39721. nacl.scalarMult = function(n, p) {
  39722. checkArrayTypes(n, p);
  39723. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39724. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39725. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39726. crypto_scalarmult(q, n, p);
  39727. return q;
  39728. };
  39729. nacl.scalarMult.base = function(n) {
  39730. checkArrayTypes(n);
  39731. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39732. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39733. crypto_scalarmult_base(q, n);
  39734. return q;
  39735. };
  39736. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39737. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39738. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39739. var k = nacl.box.before(publicKey, secretKey);
  39740. return nacl.secretbox(msg, nonce, k);
  39741. };
  39742. nacl.box.before = function(publicKey, secretKey) {
  39743. checkArrayTypes(publicKey, secretKey);
  39744. checkBoxLengths(publicKey, secretKey);
  39745. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39746. crypto_box_beforenm(k, publicKey, secretKey);
  39747. return k;
  39748. };
  39749. nacl.box.after = nacl.secretbox;
  39750. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39751. var k = nacl.box.before(publicKey, secretKey);
  39752. return nacl.secretbox.open(msg, nonce, k);
  39753. };
  39754. nacl.box.open.after = nacl.secretbox.open;
  39755. nacl.box.keyPair = function() {
  39756. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39757. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39758. crypto_box_keypair(pk, sk);
  39759. return {publicKey: pk, secretKey: sk};
  39760. };
  39761. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39762. checkArrayTypes(secretKey);
  39763. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39764. throw new Error('bad secret key size');
  39765. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39766. crypto_scalarmult_base(pk, secretKey);
  39767. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39768. };
  39769. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39770. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39771. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39772. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39773. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39774. nacl.sign = function(msg, secretKey) {
  39775. checkArrayTypes(msg, secretKey);
  39776. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39777. throw new Error('bad secret key size');
  39778. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39779. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39780. return signedMsg;
  39781. };
  39782. nacl.sign.open = function(signedMsg, publicKey) {
  39783. checkArrayTypes(signedMsg, publicKey);
  39784. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39785. throw new Error('bad public key size');
  39786. var tmp = new Uint8Array(signedMsg.length);
  39787. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39788. if (mlen < 0) return null;
  39789. var m = new Uint8Array(mlen);
  39790. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39791. return m;
  39792. };
  39793. nacl.sign.detached = function(msg, secretKey) {
  39794. var signedMsg = nacl.sign(msg, secretKey);
  39795. var sig = new Uint8Array(crypto_sign_BYTES);
  39796. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39797. return sig;
  39798. };
  39799. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39800. checkArrayTypes(msg, sig, publicKey);
  39801. if (sig.length !== crypto_sign_BYTES)
  39802. throw new Error('bad signature size');
  39803. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39804. throw new Error('bad public key size');
  39805. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39806. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39807. var i;
  39808. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39809. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39810. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39811. };
  39812. nacl.sign.keyPair = function() {
  39813. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39814. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39815. crypto_sign_keypair(pk, sk);
  39816. return {publicKey: pk, secretKey: sk};
  39817. };
  39818. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39819. checkArrayTypes(secretKey);
  39820. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39821. throw new Error('bad secret key size');
  39822. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39823. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39824. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39825. };
  39826. nacl.sign.keyPair.fromSeed = function(seed) {
  39827. checkArrayTypes(seed);
  39828. if (seed.length !== crypto_sign_SEEDBYTES)
  39829. throw new Error('bad seed size');
  39830. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39831. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39832. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39833. crypto_sign_keypair(pk, sk, true);
  39834. return {publicKey: pk, secretKey: sk};
  39835. };
  39836. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39837. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39838. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39839. nacl.sign.signatureLength = crypto_sign_BYTES;
  39840. nacl.hash = function(msg) {
  39841. checkArrayTypes(msg);
  39842. var h = new Uint8Array(crypto_hash_BYTES);
  39843. crypto_hash(h, msg, msg.length);
  39844. return h;
  39845. };
  39846. nacl.hash.hashLength = crypto_hash_BYTES;
  39847. nacl.verify = function(x, y) {
  39848. checkArrayTypes(x, y);
  39849. // Zero length arguments are considered not equal.
  39850. if (x.length === 0 || y.length === 0) return false;
  39851. if (x.length !== y.length) return false;
  39852. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39853. };
  39854. nacl.setPRNG = function(fn) {
  39855. randombytes = fn;
  39856. };
  39857. (function() {
  39858. // Initialize PRNG if environment provides CSPRNG.
  39859. // If not, methods calling randombytes will throw.
  39860. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39861. if (crypto && crypto.getRandomValues) {
  39862. // Browsers.
  39863. var QUOTA = 65536;
  39864. nacl.setPRNG(function(x, n) {
  39865. var i, v = new Uint8Array(n);
  39866. for (i = 0; i < n; i += QUOTA) {
  39867. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39868. }
  39869. for (i = 0; i < n; i++) x[i] = v[i];
  39870. cleanup(v);
  39871. });
  39872. } else if (true) {
  39873. // Node.js.
  39874. crypto = __webpack_require__(3);
  39875. if (crypto && crypto.randomBytes) {
  39876. nacl.setPRNG(function(x, n) {
  39877. var i, v = crypto.randomBytes(n);
  39878. for (i = 0; i < n; i++) x[i] = v[i];
  39879. cleanup(v);
  39880. });
  39881. }
  39882. }
  39883. })();
  39884. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39885. /***/ }),
  39886. /* 1 */
  39887. /***/ (function(module, exports, __webpack_require__) {
  39888. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39889. // Public domain.
  39890. (function(root, f) {
  39891. 'use strict';
  39892. if ( true && module.exports) module.exports = f();
  39893. else if (root.nacl) root.nacl.util = f();
  39894. else {
  39895. root.nacl = {};
  39896. root.nacl.util = f();
  39897. }
  39898. }(this, function() {
  39899. 'use strict';
  39900. var util = {};
  39901. function validateBase64(s) {
  39902. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39903. throw new TypeError('invalid encoding');
  39904. }
  39905. }
  39906. util.decodeUTF8 = function(s) {
  39907. if (typeof s !== 'string') throw new TypeError('expected string');
  39908. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39909. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39910. return b;
  39911. };
  39912. util.encodeUTF8 = function(arr) {
  39913. var i, s = [];
  39914. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39915. return decodeURIComponent(escape(s.join('')));
  39916. };
  39917. if (typeof atob === 'undefined') {
  39918. // Node.js
  39919. if (typeof Buffer.from !== 'undefined') {
  39920. // Node v6 and later
  39921. util.encodeBase64 = function (arr) { // v6 and later
  39922. return Buffer.from(arr).toString('base64');
  39923. };
  39924. util.decodeBase64 = function (s) {
  39925. validateBase64(s);
  39926. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39927. };
  39928. } else {
  39929. // Node earlier than v6
  39930. util.encodeBase64 = function (arr) { // v6 and later
  39931. return (new Buffer(arr)).toString('base64');
  39932. };
  39933. util.decodeBase64 = function(s) {
  39934. validateBase64(s);
  39935. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39936. };
  39937. }
  39938. } else {
  39939. // Browsers
  39940. util.encodeBase64 = function(arr) {
  39941. var i, s = [], len = arr.length;
  39942. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39943. return btoa(s.join(''));
  39944. };
  39945. util.decodeBase64 = function(s) {
  39946. validateBase64(s);
  39947. var i, d = atob(s), b = new Uint8Array(d.length);
  39948. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39949. return b;
  39950. };
  39951. }
  39952. return util;
  39953. }));
  39954. /***/ }),
  39955. /* 2 */
  39956. /***/ (function(module, exports, __webpack_require__) {
  39957. // required so we don't have to do require('pusher').default etc.
  39958. module.exports = __webpack_require__(4).default;
  39959. /***/ }),
  39960. /* 3 */
  39961. /***/ (function(module, exports) {
  39962. /* (ignored) */
  39963. /***/ }),
  39964. /* 4 */
  39965. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39966. "use strict";
  39967. __webpack_require__.r(__webpack_exports__);
  39968. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39969. var ScriptReceiverFactory = (function () {
  39970. function ScriptReceiverFactory(prefix, name) {
  39971. this.lastId = 0;
  39972. this.prefix = prefix;
  39973. this.name = name;
  39974. }
  39975. ScriptReceiverFactory.prototype.create = function (callback) {
  39976. this.lastId++;
  39977. var number = this.lastId;
  39978. var id = this.prefix + number;
  39979. var name = this.name + "[" + number + "]";
  39980. var called = false;
  39981. var callbackWrapper = function () {
  39982. if (!called) {
  39983. callback.apply(null, arguments);
  39984. called = true;
  39985. }
  39986. };
  39987. this[number] = callbackWrapper;
  39988. return { number: number, id: id, name: name, callback: callbackWrapper };
  39989. };
  39990. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39991. delete this[receiver.number];
  39992. };
  39993. return ScriptReceiverFactory;
  39994. }());
  39995. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39996. // CONCATENATED MODULE: ./src/core/defaults.ts
  39997. var Defaults = {
  39998. VERSION: "5.0.3",
  39999. PROTOCOL: 7,
  40000. host: 'ws.pusherapp.com',
  40001. ws_port: 80,
  40002. wss_port: 443,
  40003. ws_path: '',
  40004. sockjs_host: 'sockjs.pusher.com',
  40005. sockjs_http_port: 80,
  40006. sockjs_https_port: 443,
  40007. sockjs_path: '/pusher',
  40008. stats_host: 'stats.pusher.com',
  40009. channel_auth_endpoint: '/pusher/auth',
  40010. channel_auth_transport: 'ajax',
  40011. activity_timeout: 120000,
  40012. pong_timeout: 30000,
  40013. unavailable_timeout: 10000,
  40014. cdn_http: "http://js.pusher.com",
  40015. cdn_https: "https://js.pusher.com",
  40016. dependency_suffix: ""
  40017. };
  40018. /* harmony default export */ var defaults = (Defaults);
  40019. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40020. var dependency_loader_DependencyLoader = (function () {
  40021. function DependencyLoader(options) {
  40022. this.options = options;
  40023. this.receivers = options.receivers || ScriptReceivers;
  40024. this.loading = {};
  40025. }
  40026. DependencyLoader.prototype.load = function (name, options, callback) {
  40027. var self = this;
  40028. if (self.loading[name] && self.loading[name].length > 0) {
  40029. self.loading[name].push(callback);
  40030. }
  40031. else {
  40032. self.loading[name] = [callback];
  40033. var request = runtime.createScriptRequest(self.getPath(name, options));
  40034. var receiver = self.receivers.create(function (error) {
  40035. self.receivers.remove(receiver);
  40036. if (self.loading[name]) {
  40037. var callbacks = self.loading[name];
  40038. delete self.loading[name];
  40039. var successCallback = function (wasSuccessful) {
  40040. if (!wasSuccessful) {
  40041. request.cleanup();
  40042. }
  40043. };
  40044. for (var i = 0; i < callbacks.length; i++) {
  40045. callbacks[i](error, successCallback);
  40046. }
  40047. }
  40048. });
  40049. request.send(receiver);
  40050. }
  40051. };
  40052. DependencyLoader.prototype.getRoot = function (options) {
  40053. var cdn;
  40054. var protocol = runtime.getDocument().location.protocol;
  40055. if ((options && options.useTLS) || protocol === "https:") {
  40056. cdn = this.options.cdn_https;
  40057. }
  40058. else {
  40059. cdn = this.options.cdn_http;
  40060. }
  40061. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40062. };
  40063. DependencyLoader.prototype.getPath = function (name, options) {
  40064. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40065. };
  40066. ;
  40067. return DependencyLoader;
  40068. }());
  40069. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40070. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40071. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40072. var Dependencies = new dependency_loader({
  40073. cdn_http: defaults.cdn_http,
  40074. cdn_https: defaults.cdn_https,
  40075. version: defaults.VERSION,
  40076. suffix: defaults.dependency_suffix,
  40077. receivers: DependenciesReceivers
  40078. });
  40079. // CONCATENATED MODULE: ./src/core/base64.ts
  40080. function encode(s) {
  40081. return btoa(utob(s));
  40082. }
  40083. var fromCharCode = String.fromCharCode;
  40084. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40085. var b64tab = {};
  40086. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40087. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40088. }
  40089. var cb_utob = function (c) {
  40090. var cc = c.charCodeAt(0);
  40091. return cc < 0x80
  40092. ? c
  40093. : cc < 0x800
  40094. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40095. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40096. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40097. fromCharCode(0x80 | (cc & 0x3f));
  40098. };
  40099. var utob = function (u) {
  40100. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40101. };
  40102. var cb_encode = function (ccc) {
  40103. var padlen = [0, 2, 1][ccc.length % 3];
  40104. var ord = (ccc.charCodeAt(0) << 16) |
  40105. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40106. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40107. var chars = [
  40108. b64chars.charAt(ord >>> 18),
  40109. b64chars.charAt((ord >>> 12) & 63),
  40110. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40111. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40112. ];
  40113. return chars.join('');
  40114. };
  40115. var btoa = window.btoa ||
  40116. function (b) {
  40117. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40118. };
  40119. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40120. var Timer = (function () {
  40121. function Timer(set, clear, delay, callback) {
  40122. var _this = this;
  40123. this.clear = clear;
  40124. this.timer = set(function () {
  40125. if (_this.timer) {
  40126. _this.timer = callback(_this.timer);
  40127. }
  40128. }, delay);
  40129. }
  40130. Timer.prototype.isRunning = function () {
  40131. return this.timer !== null;
  40132. };
  40133. Timer.prototype.ensureAborted = function () {
  40134. if (this.timer) {
  40135. this.clear(this.timer);
  40136. this.timer = null;
  40137. }
  40138. };
  40139. return Timer;
  40140. }());
  40141. /* harmony default export */ var abstract_timer = (Timer);
  40142. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40143. var __extends = (undefined && undefined.__extends) || (function () {
  40144. var extendStatics = function (d, b) {
  40145. extendStatics = Object.setPrototypeOf ||
  40146. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40147. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40148. return extendStatics(d, b);
  40149. };
  40150. return function (d, b) {
  40151. extendStatics(d, b);
  40152. function __() { this.constructor = d; }
  40153. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40154. };
  40155. })();
  40156. function timers_clearTimeout(timer) {
  40157. window.clearTimeout(timer);
  40158. }
  40159. function timers_clearInterval(timer) {
  40160. window.clearInterval(timer);
  40161. }
  40162. var OneOffTimer = (function (_super) {
  40163. __extends(OneOffTimer, _super);
  40164. function OneOffTimer(delay, callback) {
  40165. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40166. callback();
  40167. return null;
  40168. }) || this;
  40169. }
  40170. return OneOffTimer;
  40171. }(abstract_timer));
  40172. var PeriodicTimer = (function (_super) {
  40173. __extends(PeriodicTimer, _super);
  40174. function PeriodicTimer(delay, callback) {
  40175. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40176. callback();
  40177. return timer;
  40178. }) || this;
  40179. }
  40180. return PeriodicTimer;
  40181. }(abstract_timer));
  40182. // CONCATENATED MODULE: ./src/core/util.ts
  40183. var Util = {
  40184. now: function () {
  40185. if (Date.now) {
  40186. return Date.now();
  40187. }
  40188. else {
  40189. return new Date().valueOf();
  40190. }
  40191. },
  40192. defer: function (callback) {
  40193. return new OneOffTimer(0, callback);
  40194. },
  40195. method: function (name) {
  40196. var args = [];
  40197. for (var _i = 1; _i < arguments.length; _i++) {
  40198. args[_i - 1] = arguments[_i];
  40199. }
  40200. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40201. return function (object) {
  40202. return object[name].apply(object, boundArguments.concat(arguments));
  40203. };
  40204. }
  40205. };
  40206. /* harmony default export */ var util = (Util);
  40207. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40208. function extend(target) {
  40209. var sources = [];
  40210. for (var _i = 1; _i < arguments.length; _i++) {
  40211. sources[_i - 1] = arguments[_i];
  40212. }
  40213. for (var i = 0; i < sources.length; i++) {
  40214. var extensions = sources[i];
  40215. for (var property in extensions) {
  40216. if (extensions[property] && extensions[property].constructor &&
  40217. extensions[property].constructor === Object) {
  40218. target[property] = extend(target[property] || {}, extensions[property]);
  40219. }
  40220. else {
  40221. target[property] = extensions[property];
  40222. }
  40223. }
  40224. }
  40225. return target;
  40226. }
  40227. function stringify() {
  40228. var m = ["Pusher"];
  40229. for (var i = 0; i < arguments.length; i++) {
  40230. if (typeof arguments[i] === "string") {
  40231. m.push(arguments[i]);
  40232. }
  40233. else {
  40234. m.push(safeJSONStringify(arguments[i]));
  40235. }
  40236. }
  40237. return m.join(" : ");
  40238. }
  40239. function arrayIndexOf(array, item) {
  40240. var nativeIndexOf = Array.prototype.indexOf;
  40241. if (array === null) {
  40242. return -1;
  40243. }
  40244. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40245. return array.indexOf(item);
  40246. }
  40247. for (var i = 0, l = array.length; i < l; i++) {
  40248. if (array[i] === item) {
  40249. return i;
  40250. }
  40251. }
  40252. return -1;
  40253. }
  40254. function objectApply(object, f) {
  40255. for (var key in object) {
  40256. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40257. f(object[key], key, object);
  40258. }
  40259. }
  40260. }
  40261. function keys(object) {
  40262. var keys = [];
  40263. objectApply(object, function (_, key) {
  40264. keys.push(key);
  40265. });
  40266. return keys;
  40267. }
  40268. function values(object) {
  40269. var values = [];
  40270. objectApply(object, function (value) {
  40271. values.push(value);
  40272. });
  40273. return values;
  40274. }
  40275. function apply(array, f, context) {
  40276. for (var i = 0; i < array.length; i++) {
  40277. f.call(context || window, array[i], i, array);
  40278. }
  40279. }
  40280. function map(array, f) {
  40281. var result = [];
  40282. for (var i = 0; i < array.length; i++) {
  40283. result.push(f(array[i], i, array, result));
  40284. }
  40285. return result;
  40286. }
  40287. function mapObject(object, f) {
  40288. var result = {};
  40289. objectApply(object, function (value, key) {
  40290. result[key] = f(value);
  40291. });
  40292. return result;
  40293. }
  40294. function filter(array, test) {
  40295. test = test || function (value) { return !!value; };
  40296. var result = [];
  40297. for (var i = 0; i < array.length; i++) {
  40298. if (test(array[i], i, array, result)) {
  40299. result.push(array[i]);
  40300. }
  40301. }
  40302. return result;
  40303. }
  40304. function filterObject(object, test) {
  40305. var result = {};
  40306. objectApply(object, function (value, key) {
  40307. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40308. result[key] = value;
  40309. }
  40310. });
  40311. return result;
  40312. }
  40313. function flatten(object) {
  40314. var result = [];
  40315. objectApply(object, function (value, key) {
  40316. result.push([key, value]);
  40317. });
  40318. return result;
  40319. }
  40320. function any(array, test) {
  40321. for (var i = 0; i < array.length; i++) {
  40322. if (test(array[i], i, array)) {
  40323. return true;
  40324. }
  40325. }
  40326. return false;
  40327. }
  40328. function collections_all(array, test) {
  40329. for (var i = 0; i < array.length; i++) {
  40330. if (!test(array[i], i, array)) {
  40331. return false;
  40332. }
  40333. }
  40334. return true;
  40335. }
  40336. function encodeParamsObject(data) {
  40337. return mapObject(data, function (value) {
  40338. if (typeof value === "object") {
  40339. value = safeJSONStringify(value);
  40340. }
  40341. return encodeURIComponent(encode(value.toString()));
  40342. });
  40343. }
  40344. function buildQueryString(data) {
  40345. var params = filterObject(data, function (value) {
  40346. return value !== undefined;
  40347. });
  40348. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40349. return query;
  40350. }
  40351. function decycleObject(object) {
  40352. var objects = [], paths = [];
  40353. return (function derez(value, path) {
  40354. var i, name, nu;
  40355. switch (typeof value) {
  40356. case 'object':
  40357. if (!value) {
  40358. return null;
  40359. }
  40360. for (i = 0; i < objects.length; i += 1) {
  40361. if (objects[i] === value) {
  40362. return { $ref: paths[i] };
  40363. }
  40364. }
  40365. objects.push(value);
  40366. paths.push(path);
  40367. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40368. nu = [];
  40369. for (i = 0; i < value.length; i += 1) {
  40370. nu[i] = derez(value[i], path + '[' + i + ']');
  40371. }
  40372. }
  40373. else {
  40374. nu = {};
  40375. for (name in value) {
  40376. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40377. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40378. }
  40379. }
  40380. }
  40381. return nu;
  40382. case 'number':
  40383. case 'string':
  40384. case 'boolean':
  40385. return value;
  40386. }
  40387. }(object, '$'));
  40388. }
  40389. function safeJSONStringify(source) {
  40390. try {
  40391. return JSON.stringify(source);
  40392. }
  40393. catch (e) {
  40394. return JSON.stringify(decycleObject(source));
  40395. }
  40396. }
  40397. // CONCATENATED MODULE: ./src/core/logger.ts
  40398. var logger_Logger = (function () {
  40399. function Logger() {
  40400. this.globalLog = function (message) {
  40401. if (window.console && window.console.log) {
  40402. window.console.log(message);
  40403. }
  40404. };
  40405. }
  40406. Logger.prototype.debug = function () {
  40407. var args = [];
  40408. for (var _i = 0; _i < arguments.length; _i++) {
  40409. args[_i] = arguments[_i];
  40410. }
  40411. this.log(this.globalLog, args);
  40412. };
  40413. Logger.prototype.warn = function () {
  40414. var args = [];
  40415. for (var _i = 0; _i < arguments.length; _i++) {
  40416. args[_i] = arguments[_i];
  40417. }
  40418. this.log(this.globalLogWarn, args);
  40419. };
  40420. Logger.prototype.error = function () {
  40421. var args = [];
  40422. for (var _i = 0; _i < arguments.length; _i++) {
  40423. args[_i] = arguments[_i];
  40424. }
  40425. this.log(this.globalLogError, args);
  40426. };
  40427. Logger.prototype.globalLogWarn = function (message) {
  40428. if (window.console && window.console.warn) {
  40429. window.console.warn(message);
  40430. }
  40431. else {
  40432. this.globalLog(message);
  40433. }
  40434. };
  40435. Logger.prototype.globalLogError = function (message) {
  40436. if (window.console && window.console.error) {
  40437. window.console.error(message);
  40438. }
  40439. else {
  40440. this.globalLogWarn(message);
  40441. }
  40442. };
  40443. Logger.prototype.log = function (defaultLoggingFunction) {
  40444. var args = [];
  40445. for (var _i = 1; _i < arguments.length; _i++) {
  40446. args[_i - 1] = arguments[_i];
  40447. }
  40448. var message = stringify.apply(this, arguments);
  40449. if (core_pusher.log) {
  40450. core_pusher.log(message);
  40451. }
  40452. else if (core_pusher.logToConsole) {
  40453. var log = defaultLoggingFunction.bind(this);
  40454. log(message);
  40455. }
  40456. };
  40457. return Logger;
  40458. }());
  40459. /* harmony default export */ var logger = (new logger_Logger());
  40460. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40461. var urlStore = {
  40462. baseUrl: "https://pusher.com",
  40463. urls: {
  40464. authenticationEndpoint: {
  40465. path: "/docs/authenticating_users",
  40466. },
  40467. javascriptQuickStart: {
  40468. path: "/docs/javascript_quick_start"
  40469. },
  40470. triggeringClientEvents: {
  40471. path: "/docs/client_api_guide/client_events#trigger-events"
  40472. }
  40473. }
  40474. };
  40475. var buildLogSuffix = function (key) {
  40476. var urlPrefix = "See:";
  40477. var urlObj = urlStore.urls[key];
  40478. if (!urlObj)
  40479. return "";
  40480. var url;
  40481. if (urlObj.fullUrl) {
  40482. url = urlObj.fullUrl;
  40483. }
  40484. else if (urlObj.path) {
  40485. url = urlStore.baseUrl + urlObj.path;
  40486. }
  40487. if (!url)
  40488. return "";
  40489. return urlPrefix + " " + url;
  40490. };
  40491. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40492. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40493. var ajax = function (context, socketId, callback) {
  40494. var self = this, xhr;
  40495. xhr = runtime.createXHR();
  40496. xhr.open("POST", self.options.authEndpoint, true);
  40497. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40498. for (var headerName in this.authOptions.headers) {
  40499. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40500. }
  40501. xhr.onreadystatechange = function () {
  40502. if (xhr.readyState === 4) {
  40503. if (xhr.status === 200) {
  40504. var data, parsed = false;
  40505. try {
  40506. data = JSON.parse(xhr.responseText);
  40507. parsed = true;
  40508. }
  40509. catch (e) {
  40510. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40511. }
  40512. if (parsed) {
  40513. callback(false, data);
  40514. }
  40515. }
  40516. else {
  40517. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40518. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40519. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40520. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40521. callback(true, xhr.status);
  40522. }
  40523. }
  40524. };
  40525. xhr.send(this.composeQuery(socketId));
  40526. return xhr;
  40527. };
  40528. /* harmony default export */ var xhr_auth = (ajax);
  40529. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40530. var jsonp = function (context, socketId, callback) {
  40531. if (this.authOptions.headers !== undefined) {
  40532. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40533. }
  40534. var callbackName = context.nextAuthCallbackID.toString();
  40535. context.nextAuthCallbackID++;
  40536. var document = context.getDocument();
  40537. var script = document.createElement("script");
  40538. context.auth_callbacks[callbackName] = function (data) {
  40539. callback(false, data);
  40540. };
  40541. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40542. script.src = this.options.authEndpoint +
  40543. '?callback=' +
  40544. encodeURIComponent(callback_name) +
  40545. '&' +
  40546. this.composeQuery(socketId);
  40547. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40548. head.insertBefore(script, head.firstChild);
  40549. };
  40550. /* harmony default export */ var jsonp_auth = (jsonp);
  40551. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40552. var ScriptRequest = (function () {
  40553. function ScriptRequest(src) {
  40554. this.src = src;
  40555. }
  40556. ScriptRequest.prototype.send = function (receiver) {
  40557. var self = this;
  40558. var errorString = "Error loading " + self.src;
  40559. self.script = document.createElement("script");
  40560. self.script.id = receiver.id;
  40561. self.script.src = self.src;
  40562. self.script.type = "text/javascript";
  40563. self.script.charset = "UTF-8";
  40564. if (self.script.addEventListener) {
  40565. self.script.onerror = function () {
  40566. receiver.callback(errorString);
  40567. };
  40568. self.script.onload = function () {
  40569. receiver.callback(null);
  40570. };
  40571. }
  40572. else {
  40573. self.script.onreadystatechange = function () {
  40574. if (self.script.readyState === 'loaded' ||
  40575. self.script.readyState === 'complete') {
  40576. receiver.callback(null);
  40577. }
  40578. };
  40579. }
  40580. if (self.script.async === undefined && document.attachEvent &&
  40581. /opera/i.test(navigator.userAgent)) {
  40582. self.errorScript = document.createElement("script");
  40583. self.errorScript.id = receiver.id + "_error";
  40584. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40585. self.script.async = self.errorScript.async = false;
  40586. }
  40587. else {
  40588. self.script.async = true;
  40589. }
  40590. var head = document.getElementsByTagName('head')[0];
  40591. head.insertBefore(self.script, head.firstChild);
  40592. if (self.errorScript) {
  40593. head.insertBefore(self.errorScript, self.script.nextSibling);
  40594. }
  40595. };
  40596. ScriptRequest.prototype.cleanup = function () {
  40597. if (this.script) {
  40598. this.script.onload = this.script.onerror = null;
  40599. this.script.onreadystatechange = null;
  40600. }
  40601. if (this.script && this.script.parentNode) {
  40602. this.script.parentNode.removeChild(this.script);
  40603. }
  40604. if (this.errorScript && this.errorScript.parentNode) {
  40605. this.errorScript.parentNode.removeChild(this.errorScript);
  40606. }
  40607. this.script = null;
  40608. this.errorScript = null;
  40609. };
  40610. return ScriptRequest;
  40611. }());
  40612. /* harmony default export */ var script_request = (ScriptRequest);
  40613. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40614. var jsonp_request_JSONPRequest = (function () {
  40615. function JSONPRequest(url, data) {
  40616. this.url = url;
  40617. this.data = data;
  40618. }
  40619. JSONPRequest.prototype.send = function (receiver) {
  40620. if (this.request) {
  40621. return;
  40622. }
  40623. var query = buildQueryString(this.data);
  40624. var url = this.url + "/" + receiver.number + "?" + query;
  40625. this.request = runtime.createScriptRequest(url);
  40626. this.request.send(receiver);
  40627. };
  40628. JSONPRequest.prototype.cleanup = function () {
  40629. if (this.request) {
  40630. this.request.cleanup();
  40631. }
  40632. };
  40633. return JSONPRequest;
  40634. }());
  40635. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40636. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40637. var getAgent = function (sender, useTLS) {
  40638. return function (data, callback) {
  40639. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40640. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40641. var request = runtime.createJSONPRequest(url, data);
  40642. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40643. ScriptReceivers.remove(receiver);
  40644. request.cleanup();
  40645. if (result && result.host) {
  40646. sender.host = result.host;
  40647. }
  40648. if (callback) {
  40649. callback(error, result);
  40650. }
  40651. });
  40652. request.send(receiver);
  40653. };
  40654. };
  40655. var jsonp_timeline_jsonp = {
  40656. name: 'jsonp',
  40657. getAgent: getAgent
  40658. };
  40659. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40660. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40661. function getGenericURL(baseScheme, params, path) {
  40662. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40663. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40664. return scheme + "://" + host + path;
  40665. }
  40666. function getGenericPath(key, queryString) {
  40667. var path = "/app/" + key;
  40668. var query = "?protocol=" + defaults.PROTOCOL +
  40669. "&client=js" +
  40670. "&version=" + defaults.VERSION +
  40671. (queryString ? ("&" + queryString) : "");
  40672. return path + query;
  40673. }
  40674. var ws = {
  40675. getInitial: function (key, params) {
  40676. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40677. return getGenericURL("ws", params, path);
  40678. }
  40679. };
  40680. var http = {
  40681. getInitial: function (key, params) {
  40682. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40683. return getGenericURL("http", params, path);
  40684. }
  40685. };
  40686. var sockjs = {
  40687. getInitial: function (key, params) {
  40688. return getGenericURL("http", params, params.httpPath || "/pusher");
  40689. },
  40690. getPath: function (key, params) {
  40691. return getGenericPath(key);
  40692. }
  40693. };
  40694. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40695. var callback_registry_CallbackRegistry = (function () {
  40696. function CallbackRegistry() {
  40697. this._callbacks = {};
  40698. }
  40699. CallbackRegistry.prototype.get = function (name) {
  40700. return this._callbacks[prefix(name)];
  40701. };
  40702. CallbackRegistry.prototype.add = function (name, callback, context) {
  40703. var prefixedEventName = prefix(name);
  40704. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40705. this._callbacks[prefixedEventName].push({
  40706. fn: callback,
  40707. context: context
  40708. });
  40709. };
  40710. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40711. if (!name && !callback && !context) {
  40712. this._callbacks = {};
  40713. return;
  40714. }
  40715. var names = name ? [prefix(name)] : keys(this._callbacks);
  40716. if (callback || context) {
  40717. this.removeCallback(names, callback, context);
  40718. }
  40719. else {
  40720. this.removeAllCallbacks(names);
  40721. }
  40722. };
  40723. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40724. apply(names, function (name) {
  40725. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40726. return (callback && callback !== binding.fn) ||
  40727. (context && context !== binding.context);
  40728. });
  40729. if (this._callbacks[name].length === 0) {
  40730. delete this._callbacks[name];
  40731. }
  40732. }, this);
  40733. };
  40734. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40735. apply(names, function (name) {
  40736. delete this._callbacks[name];
  40737. }, this);
  40738. };
  40739. return CallbackRegistry;
  40740. }());
  40741. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40742. function prefix(name) {
  40743. return "_" + name;
  40744. }
  40745. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40746. var dispatcher_Dispatcher = (function () {
  40747. function Dispatcher(failThrough) {
  40748. this.callbacks = new callback_registry();
  40749. this.global_callbacks = [];
  40750. this.failThrough = failThrough;
  40751. }
  40752. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40753. this.callbacks.add(eventName, callback, context);
  40754. return this;
  40755. };
  40756. Dispatcher.prototype.bind_global = function (callback) {
  40757. this.global_callbacks.push(callback);
  40758. return this;
  40759. };
  40760. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40761. this.callbacks.remove(eventName, callback, context);
  40762. return this;
  40763. };
  40764. Dispatcher.prototype.unbind_global = function (callback) {
  40765. if (!callback) {
  40766. this.global_callbacks = [];
  40767. return this;
  40768. }
  40769. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40770. return this;
  40771. };
  40772. Dispatcher.prototype.unbind_all = function () {
  40773. this.unbind();
  40774. this.unbind_global();
  40775. return this;
  40776. };
  40777. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40778. for (var i = 0; i < this.global_callbacks.length; i++) {
  40779. this.global_callbacks[i](eventName, data);
  40780. }
  40781. var callbacks = this.callbacks.get(eventName);
  40782. var args = [];
  40783. if (metadata) {
  40784. args.push(data, metadata);
  40785. }
  40786. else if (data) {
  40787. args.push(data);
  40788. }
  40789. if (callbacks && callbacks.length > 0) {
  40790. for (var i = 0; i < callbacks.length; i++) {
  40791. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40792. }
  40793. }
  40794. else if (this.failThrough) {
  40795. this.failThrough(eventName, data);
  40796. }
  40797. return this;
  40798. };
  40799. return Dispatcher;
  40800. }());
  40801. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40802. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40803. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40804. var extendStatics = function (d, b) {
  40805. extendStatics = Object.setPrototypeOf ||
  40806. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40807. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40808. return extendStatics(d, b);
  40809. };
  40810. return function (d, b) {
  40811. extendStatics(d, b);
  40812. function __() { this.constructor = d; }
  40813. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40814. };
  40815. })();
  40816. var transport_connection_TransportConnection = (function (_super) {
  40817. transport_connection_extends(TransportConnection, _super);
  40818. function TransportConnection(hooks, name, priority, key, options) {
  40819. var _this = _super.call(this) || this;
  40820. _this.initialize = runtime.transportConnectionInitializer;
  40821. _this.hooks = hooks;
  40822. _this.name = name;
  40823. _this.priority = priority;
  40824. _this.key = key;
  40825. _this.options = options;
  40826. _this.state = "new";
  40827. _this.timeline = options.timeline;
  40828. _this.activityTimeout = options.activityTimeout;
  40829. _this.id = _this.timeline.generateUniqueID();
  40830. return _this;
  40831. }
  40832. TransportConnection.prototype.handlesActivityChecks = function () {
  40833. return Boolean(this.hooks.handlesActivityChecks);
  40834. };
  40835. TransportConnection.prototype.supportsPing = function () {
  40836. return Boolean(this.hooks.supportsPing);
  40837. };
  40838. TransportConnection.prototype.connect = function () {
  40839. var _this = this;
  40840. if (this.socket || this.state !== "initialized") {
  40841. return false;
  40842. }
  40843. var url = this.hooks.urls.getInitial(this.key, this.options);
  40844. try {
  40845. this.socket = this.hooks.getSocket(url, this.options);
  40846. }
  40847. catch (e) {
  40848. util.defer(function () {
  40849. _this.onError(e);
  40850. _this.changeState("closed");
  40851. });
  40852. return false;
  40853. }
  40854. this.bindListeners();
  40855. logger.debug("Connecting", { transport: this.name, url: url });
  40856. this.changeState("connecting");
  40857. return true;
  40858. };
  40859. TransportConnection.prototype.close = function () {
  40860. if (this.socket) {
  40861. this.socket.close();
  40862. return true;
  40863. }
  40864. else {
  40865. return false;
  40866. }
  40867. };
  40868. TransportConnection.prototype.send = function (data) {
  40869. var _this = this;
  40870. if (this.state === "open") {
  40871. util.defer(function () {
  40872. if (_this.socket) {
  40873. _this.socket.send(data);
  40874. }
  40875. });
  40876. return true;
  40877. }
  40878. else {
  40879. return false;
  40880. }
  40881. };
  40882. TransportConnection.prototype.ping = function () {
  40883. if (this.state === "open" && this.supportsPing()) {
  40884. this.socket.ping();
  40885. }
  40886. };
  40887. TransportConnection.prototype.onOpen = function () {
  40888. if (this.hooks.beforeOpen) {
  40889. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40890. }
  40891. this.changeState("open");
  40892. this.socket.onopen = undefined;
  40893. };
  40894. TransportConnection.prototype.onError = function (error) {
  40895. this.emit("error", { type: 'WebSocketError', error: error });
  40896. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40897. };
  40898. TransportConnection.prototype.onClose = function (closeEvent) {
  40899. if (closeEvent) {
  40900. this.changeState("closed", {
  40901. code: closeEvent.code,
  40902. reason: closeEvent.reason,
  40903. wasClean: closeEvent.wasClean
  40904. });
  40905. }
  40906. else {
  40907. this.changeState("closed");
  40908. }
  40909. this.unbindListeners();
  40910. this.socket = undefined;
  40911. };
  40912. TransportConnection.prototype.onMessage = function (message) {
  40913. this.emit("message", message);
  40914. };
  40915. TransportConnection.prototype.onActivity = function () {
  40916. this.emit("activity");
  40917. };
  40918. TransportConnection.prototype.bindListeners = function () {
  40919. var _this = this;
  40920. this.socket.onopen = function () {
  40921. _this.onOpen();
  40922. };
  40923. this.socket.onerror = function (error) {
  40924. _this.onError(error);
  40925. };
  40926. this.socket.onclose = function (closeEvent) {
  40927. _this.onClose(closeEvent);
  40928. };
  40929. this.socket.onmessage = function (message) {
  40930. _this.onMessage(message);
  40931. };
  40932. if (this.supportsPing()) {
  40933. this.socket.onactivity = function () { _this.onActivity(); };
  40934. }
  40935. };
  40936. TransportConnection.prototype.unbindListeners = function () {
  40937. if (this.socket) {
  40938. this.socket.onopen = undefined;
  40939. this.socket.onerror = undefined;
  40940. this.socket.onclose = undefined;
  40941. this.socket.onmessage = undefined;
  40942. if (this.supportsPing()) {
  40943. this.socket.onactivity = undefined;
  40944. }
  40945. }
  40946. };
  40947. TransportConnection.prototype.changeState = function (state, params) {
  40948. this.state = state;
  40949. this.timeline.info(this.buildTimelineMessage({
  40950. state: state,
  40951. params: params
  40952. }));
  40953. this.emit(state, params);
  40954. };
  40955. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40956. return extend({ cid: this.id }, message);
  40957. };
  40958. return TransportConnection;
  40959. }(dispatcher));
  40960. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40961. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40962. var transport_Transport = (function () {
  40963. function Transport(hooks) {
  40964. this.hooks = hooks;
  40965. }
  40966. Transport.prototype.isSupported = function (environment) {
  40967. return this.hooks.isSupported(environment);
  40968. };
  40969. Transport.prototype.createConnection = function (name, priority, key, options) {
  40970. return new transport_connection(this.hooks, name, priority, key, options);
  40971. };
  40972. return Transport;
  40973. }());
  40974. /* harmony default export */ var transports_transport = (transport_Transport);
  40975. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40976. var WSTransport = new transports_transport({
  40977. urls: ws,
  40978. handlesActivityChecks: false,
  40979. supportsPing: false,
  40980. isInitialized: function () {
  40981. return Boolean(runtime.getWebSocketAPI());
  40982. },
  40983. isSupported: function () {
  40984. return Boolean(runtime.getWebSocketAPI());
  40985. },
  40986. getSocket: function (url) {
  40987. return runtime.createWebSocket(url);
  40988. }
  40989. });
  40990. var httpConfiguration = {
  40991. urls: http,
  40992. handlesActivityChecks: false,
  40993. supportsPing: true,
  40994. isInitialized: function () {
  40995. return true;
  40996. }
  40997. };
  40998. var streamingConfiguration = extend({ getSocket: function (url) {
  40999. return runtime.HTTPFactory.createStreamingSocket(url);
  41000. }
  41001. }, httpConfiguration);
  41002. var pollingConfiguration = extend({ getSocket: function (url) {
  41003. return runtime.HTTPFactory.createPollingSocket(url);
  41004. }
  41005. }, httpConfiguration);
  41006. var xhrConfiguration = {
  41007. isSupported: function () {
  41008. return runtime.isXHRSupported();
  41009. }
  41010. };
  41011. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  41012. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41013. var Transports = {
  41014. ws: WSTransport,
  41015. xhr_streaming: XHRStreamingTransport,
  41016. xhr_polling: XHRPollingTransport
  41017. };
  41018. /* harmony default export */ var transports = (Transports);
  41019. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41020. var SockJSTransport = new transports_transport({
  41021. file: "sockjs",
  41022. urls: sockjs,
  41023. handlesActivityChecks: true,
  41024. supportsPing: false,
  41025. isSupported: function () {
  41026. return true;
  41027. },
  41028. isInitialized: function () {
  41029. return window.SockJS !== undefined;
  41030. },
  41031. getSocket: function (url, options) {
  41032. return new window.SockJS(url, null, {
  41033. js_path: Dependencies.getPath("sockjs", {
  41034. useTLS: options.useTLS
  41035. }),
  41036. ignore_null_origin: options.ignoreNullOrigin
  41037. });
  41038. },
  41039. beforeOpen: function (socket, path) {
  41040. socket.send(JSON.stringify({
  41041. path: path
  41042. }));
  41043. }
  41044. });
  41045. var xdrConfiguration = {
  41046. isSupported: function (environment) {
  41047. var yes = runtime.isXDRSupported(environment.useTLS);
  41048. return yes;
  41049. }
  41050. };
  41051. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41052. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41053. transports.xdr_streaming = XDRStreamingTransport;
  41054. transports.xdr_polling = XDRPollingTransport;
  41055. transports.sockjs = SockJSTransport;
  41056. /* harmony default export */ var transports_transports = (transports);
  41057. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41058. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41059. var extendStatics = function (d, b) {
  41060. extendStatics = Object.setPrototypeOf ||
  41061. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41062. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41063. return extendStatics(d, b);
  41064. };
  41065. return function (d, b) {
  41066. extendStatics(d, b);
  41067. function __() { this.constructor = d; }
  41068. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41069. };
  41070. })();
  41071. var NetInfo = (function (_super) {
  41072. net_info_extends(NetInfo, _super);
  41073. function NetInfo() {
  41074. var _this = _super.call(this) || this;
  41075. var self = _this;
  41076. if (window.addEventListener !== undefined) {
  41077. window.addEventListener("online", function () {
  41078. self.emit('online');
  41079. }, false);
  41080. window.addEventListener("offline", function () {
  41081. self.emit('offline');
  41082. }, false);
  41083. }
  41084. return _this;
  41085. }
  41086. NetInfo.prototype.isOnline = function () {
  41087. if (window.navigator.onLine === undefined) {
  41088. return true;
  41089. }
  41090. else {
  41091. return window.navigator.onLine;
  41092. }
  41093. };
  41094. return NetInfo;
  41095. }(dispatcher));
  41096. var net_info_Network = new NetInfo();
  41097. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41098. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41099. function AssistantToTheTransportManager(manager, transport, options) {
  41100. this.manager = manager;
  41101. this.transport = transport;
  41102. this.minPingDelay = options.minPingDelay;
  41103. this.maxPingDelay = options.maxPingDelay;
  41104. this.pingDelay = undefined;
  41105. }
  41106. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41107. var _this = this;
  41108. options = extend({}, options, {
  41109. activityTimeout: this.pingDelay
  41110. });
  41111. var connection = this.transport.createConnection(name, priority, key, options);
  41112. var openTimestamp = null;
  41113. var onOpen = function () {
  41114. connection.unbind("open", onOpen);
  41115. connection.bind("closed", onClosed);
  41116. openTimestamp = util.now();
  41117. };
  41118. var onClosed = function (closeEvent) {
  41119. connection.unbind("closed", onClosed);
  41120. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41121. _this.manager.reportDeath();
  41122. }
  41123. else if (!closeEvent.wasClean && openTimestamp) {
  41124. var lifespan = util.now() - openTimestamp;
  41125. if (lifespan < 2 * _this.maxPingDelay) {
  41126. _this.manager.reportDeath();
  41127. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41128. }
  41129. }
  41130. };
  41131. connection.bind("open", onOpen);
  41132. return connection;
  41133. };
  41134. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41135. return this.manager.isAlive() && this.transport.isSupported(environment);
  41136. };
  41137. return AssistantToTheTransportManager;
  41138. }());
  41139. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41140. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41141. var Protocol = {
  41142. decodeMessage: function (messageEvent) {
  41143. try {
  41144. var messageData = JSON.parse(messageEvent.data);
  41145. var pusherEventData = messageData.data;
  41146. if (typeof pusherEventData === 'string') {
  41147. try {
  41148. pusherEventData = JSON.parse(messageData.data);
  41149. }
  41150. catch (e) { }
  41151. }
  41152. var pusherEvent = {
  41153. event: messageData.event,
  41154. channel: messageData.channel,
  41155. data: pusherEventData,
  41156. };
  41157. if (messageData.user_id) {
  41158. pusherEvent.user_id = messageData.user_id;
  41159. }
  41160. return pusherEvent;
  41161. }
  41162. catch (e) {
  41163. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41164. }
  41165. },
  41166. encodeMessage: function (event) {
  41167. return JSON.stringify(event);
  41168. },
  41169. processHandshake: function (messageEvent) {
  41170. var message = Protocol.decodeMessage(messageEvent);
  41171. if (message.event === "pusher:connection_established") {
  41172. if (!message.data.activity_timeout) {
  41173. throw "No activity timeout specified in handshake";
  41174. }
  41175. return {
  41176. action: "connected",
  41177. id: message.data.socket_id,
  41178. activityTimeout: message.data.activity_timeout * 1000
  41179. };
  41180. }
  41181. else if (message.event === "pusher:error") {
  41182. return {
  41183. action: this.getCloseAction(message.data),
  41184. error: this.getCloseError(message.data)
  41185. };
  41186. }
  41187. else {
  41188. throw "Invalid handshake";
  41189. }
  41190. },
  41191. getCloseAction: function (closeEvent) {
  41192. if (closeEvent.code < 4000) {
  41193. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41194. return "backoff";
  41195. }
  41196. else {
  41197. return null;
  41198. }
  41199. }
  41200. else if (closeEvent.code === 4000) {
  41201. return "tls_only";
  41202. }
  41203. else if (closeEvent.code < 4100) {
  41204. return "refused";
  41205. }
  41206. else if (closeEvent.code < 4200) {
  41207. return "backoff";
  41208. }
  41209. else if (closeEvent.code < 4300) {
  41210. return "retry";
  41211. }
  41212. else {
  41213. return "refused";
  41214. }
  41215. },
  41216. getCloseError: function (closeEvent) {
  41217. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41218. return {
  41219. type: 'PusherError',
  41220. data: {
  41221. code: closeEvent.code,
  41222. message: closeEvent.reason || closeEvent.message
  41223. }
  41224. };
  41225. }
  41226. else {
  41227. return null;
  41228. }
  41229. }
  41230. };
  41231. /* harmony default export */ var protocol_protocol = (Protocol);
  41232. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41233. var connection_extends = (undefined && undefined.__extends) || (function () {
  41234. var extendStatics = function (d, b) {
  41235. extendStatics = Object.setPrototypeOf ||
  41236. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41237. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41238. return extendStatics(d, b);
  41239. };
  41240. return function (d, b) {
  41241. extendStatics(d, b);
  41242. function __() { this.constructor = d; }
  41243. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41244. };
  41245. })();
  41246. var connection_Connection = (function (_super) {
  41247. connection_extends(Connection, _super);
  41248. function Connection(id, transport) {
  41249. var _this = _super.call(this) || this;
  41250. _this.id = id;
  41251. _this.transport = transport;
  41252. _this.activityTimeout = transport.activityTimeout;
  41253. _this.bindListeners();
  41254. return _this;
  41255. }
  41256. Connection.prototype.handlesActivityChecks = function () {
  41257. return this.transport.handlesActivityChecks();
  41258. };
  41259. Connection.prototype.send = function (data) {
  41260. return this.transport.send(data);
  41261. };
  41262. Connection.prototype.send_event = function (name, data, channel) {
  41263. var event = { event: name, data: data };
  41264. if (channel) {
  41265. event.channel = channel;
  41266. }
  41267. logger.debug('Event sent', event);
  41268. return this.send(protocol_protocol.encodeMessage(event));
  41269. };
  41270. Connection.prototype.ping = function () {
  41271. if (this.transport.supportsPing()) {
  41272. this.transport.ping();
  41273. }
  41274. else {
  41275. this.send_event('pusher:ping', {});
  41276. }
  41277. };
  41278. Connection.prototype.close = function () {
  41279. this.transport.close();
  41280. };
  41281. Connection.prototype.bindListeners = function () {
  41282. var _this = this;
  41283. var listeners = {
  41284. message: function (messageEvent) {
  41285. var pusherEvent;
  41286. try {
  41287. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41288. }
  41289. catch (e) {
  41290. _this.emit('error', {
  41291. type: 'MessageParseError',
  41292. error: e,
  41293. data: messageEvent.data
  41294. });
  41295. }
  41296. if (pusherEvent !== undefined) {
  41297. logger.debug('Event recd', pusherEvent);
  41298. switch (pusherEvent.event) {
  41299. case 'pusher:error':
  41300. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41301. break;
  41302. case 'pusher:ping':
  41303. _this.emit("ping");
  41304. break;
  41305. case 'pusher:pong':
  41306. _this.emit("pong");
  41307. break;
  41308. }
  41309. _this.emit('message', pusherEvent);
  41310. }
  41311. },
  41312. activity: function () {
  41313. _this.emit("activity");
  41314. },
  41315. error: function (error) {
  41316. _this.emit("error", { type: "WebSocketError", error: error });
  41317. },
  41318. closed: function (closeEvent) {
  41319. unbindListeners();
  41320. if (closeEvent && closeEvent.code) {
  41321. _this.handleCloseEvent(closeEvent);
  41322. }
  41323. _this.transport = null;
  41324. _this.emit("closed");
  41325. }
  41326. };
  41327. var unbindListeners = function () {
  41328. objectApply(listeners, function (listener, event) {
  41329. _this.transport.unbind(event, listener);
  41330. });
  41331. };
  41332. objectApply(listeners, function (listener, event) {
  41333. _this.transport.bind(event, listener);
  41334. });
  41335. };
  41336. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41337. var action = protocol_protocol.getCloseAction(closeEvent);
  41338. var error = protocol_protocol.getCloseError(closeEvent);
  41339. if (error) {
  41340. this.emit('error', error);
  41341. }
  41342. if (action) {
  41343. this.emit(action, { action: action, error: error });
  41344. }
  41345. };
  41346. return Connection;
  41347. }(dispatcher));
  41348. /* harmony default export */ var connection_connection = (connection_Connection);
  41349. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41350. var handshake_Handshake = (function () {
  41351. function Handshake(transport, callback) {
  41352. this.transport = transport;
  41353. this.callback = callback;
  41354. this.bindListeners();
  41355. }
  41356. Handshake.prototype.close = function () {
  41357. this.unbindListeners();
  41358. this.transport.close();
  41359. };
  41360. Handshake.prototype.bindListeners = function () {
  41361. var _this = this;
  41362. this.onMessage = function (m) {
  41363. _this.unbindListeners();
  41364. var result;
  41365. try {
  41366. result = protocol_protocol.processHandshake(m);
  41367. }
  41368. catch (e) {
  41369. _this.finish("error", { error: e });
  41370. _this.transport.close();
  41371. return;
  41372. }
  41373. if (result.action === "connected") {
  41374. _this.finish("connected", {
  41375. connection: new connection_connection(result.id, _this.transport),
  41376. activityTimeout: result.activityTimeout
  41377. });
  41378. }
  41379. else {
  41380. _this.finish(result.action, { error: result.error });
  41381. _this.transport.close();
  41382. }
  41383. };
  41384. this.onClosed = function (closeEvent) {
  41385. _this.unbindListeners();
  41386. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41387. var error = protocol_protocol.getCloseError(closeEvent);
  41388. _this.finish(action, { error: error });
  41389. };
  41390. this.transport.bind("message", this.onMessage);
  41391. this.transport.bind("closed", this.onClosed);
  41392. };
  41393. Handshake.prototype.unbindListeners = function () {
  41394. this.transport.unbind("message", this.onMessage);
  41395. this.transport.unbind("closed", this.onClosed);
  41396. };
  41397. Handshake.prototype.finish = function (action, params) {
  41398. this.callback(extend({ transport: this.transport, action: action }, params));
  41399. };
  41400. return Handshake;
  41401. }());
  41402. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41403. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41404. var pusher_authorizer_PusherAuthorizer = (function () {
  41405. function PusherAuthorizer(channel, options) {
  41406. this.channel = channel;
  41407. var authTransport = options.authTransport;
  41408. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41409. throw "'" + authTransport + "' is not a recognized auth transport";
  41410. }
  41411. this.type = authTransport;
  41412. this.options = options;
  41413. this.authOptions = (options || {}).auth || {};
  41414. }
  41415. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41416. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41417. '&channel_name=' + encodeURIComponent(this.channel.name);
  41418. for (var i in this.authOptions.params) {
  41419. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41420. }
  41421. return query;
  41422. };
  41423. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41424. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41425. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41426. };
  41427. return PusherAuthorizer;
  41428. }());
  41429. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41430. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41431. var timeline_sender_TimelineSender = (function () {
  41432. function TimelineSender(timeline, options) {
  41433. this.timeline = timeline;
  41434. this.options = options || {};
  41435. }
  41436. TimelineSender.prototype.send = function (useTLS, callback) {
  41437. if (this.timeline.isEmpty()) {
  41438. return;
  41439. }
  41440. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41441. };
  41442. return TimelineSender;
  41443. }());
  41444. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41445. // CONCATENATED MODULE: ./src/core/errors.ts
  41446. var errors_extends = (undefined && undefined.__extends) || (function () {
  41447. var extendStatics = function (d, b) {
  41448. extendStatics = Object.setPrototypeOf ||
  41449. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41450. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41451. return extendStatics(d, b);
  41452. };
  41453. return function (d, b) {
  41454. extendStatics(d, b);
  41455. function __() { this.constructor = d; }
  41456. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41457. };
  41458. })();
  41459. var BadEventName = (function (_super) {
  41460. errors_extends(BadEventName, _super);
  41461. function BadEventName(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 BadEventName;
  41468. }(Error));
  41469. var RequestTimedOut = (function (_super) {
  41470. errors_extends(RequestTimedOut, _super);
  41471. function RequestTimedOut(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 RequestTimedOut;
  41478. }(Error));
  41479. var TransportPriorityTooLow = (function (_super) {
  41480. errors_extends(TransportPriorityTooLow, _super);
  41481. function TransportPriorityTooLow(msg) {
  41482. var _newTarget = this.constructor;
  41483. var _this = _super.call(this, msg) || this;
  41484. Object.setPrototypeOf(_this, _newTarget.prototype);
  41485. return _this;
  41486. }
  41487. return TransportPriorityTooLow;
  41488. }(Error));
  41489. var TransportClosed = (function (_super) {
  41490. errors_extends(TransportClosed, _super);
  41491. function TransportClosed(msg) {
  41492. var _newTarget = this.constructor;
  41493. var _this = _super.call(this, msg) || this;
  41494. Object.setPrototypeOf(_this, _newTarget.prototype);
  41495. return _this;
  41496. }
  41497. return TransportClosed;
  41498. }(Error));
  41499. var UnsupportedFeature = (function (_super) {
  41500. errors_extends(UnsupportedFeature, _super);
  41501. function UnsupportedFeature(msg) {
  41502. var _newTarget = this.constructor;
  41503. var _this = _super.call(this, msg) || this;
  41504. Object.setPrototypeOf(_this, _newTarget.prototype);
  41505. return _this;
  41506. }
  41507. return UnsupportedFeature;
  41508. }(Error));
  41509. var UnsupportedTransport = (function (_super) {
  41510. errors_extends(UnsupportedTransport, _super);
  41511. function UnsupportedTransport(msg) {
  41512. var _newTarget = this.constructor;
  41513. var _this = _super.call(this, msg) || this;
  41514. Object.setPrototypeOf(_this, _newTarget.prototype);
  41515. return _this;
  41516. }
  41517. return UnsupportedTransport;
  41518. }(Error));
  41519. var UnsupportedStrategy = (function (_super) {
  41520. errors_extends(UnsupportedStrategy, _super);
  41521. function UnsupportedStrategy(msg) {
  41522. var _newTarget = this.constructor;
  41523. var _this = _super.call(this, msg) || this;
  41524. Object.setPrototypeOf(_this, _newTarget.prototype);
  41525. return _this;
  41526. }
  41527. return UnsupportedStrategy;
  41528. }(Error));
  41529. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41530. var channel_extends = (undefined && undefined.__extends) || (function () {
  41531. var extendStatics = function (d, b) {
  41532. extendStatics = Object.setPrototypeOf ||
  41533. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41534. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41535. return extendStatics(d, b);
  41536. };
  41537. return function (d, b) {
  41538. extendStatics(d, b);
  41539. function __() { this.constructor = d; }
  41540. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41541. };
  41542. })();
  41543. var channel_Channel = (function (_super) {
  41544. channel_extends(Channel, _super);
  41545. function Channel(name, pusher) {
  41546. var _this = _super.call(this, function (event, data) {
  41547. logger.debug('No callbacks on ' + name + ' for ' + event);
  41548. }) || this;
  41549. _this.name = name;
  41550. _this.pusher = pusher;
  41551. _this.subscribed = false;
  41552. _this.subscriptionPending = false;
  41553. _this.subscriptionCancelled = false;
  41554. return _this;
  41555. }
  41556. Channel.prototype.authorize = function (socketId, callback) {
  41557. return callback(false, {});
  41558. };
  41559. Channel.prototype.trigger = function (event, data) {
  41560. if (event.indexOf("client-") !== 0) {
  41561. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41562. }
  41563. if (!this.subscribed) {
  41564. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41565. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41566. }
  41567. return this.pusher.send_event(event, data, this.name);
  41568. };
  41569. Channel.prototype.disconnect = function () {
  41570. this.subscribed = false;
  41571. this.subscriptionPending = false;
  41572. };
  41573. Channel.prototype.handleEvent = function (event) {
  41574. var eventName = event.event;
  41575. var data = event.data;
  41576. if (eventName === "pusher_internal:subscription_succeeded") {
  41577. this.handleSubscriptionSucceededEvent(event);
  41578. }
  41579. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41580. var metadata = {};
  41581. this.emit(eventName, data, metadata);
  41582. }
  41583. };
  41584. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41585. this.subscriptionPending = false;
  41586. this.subscribed = true;
  41587. if (this.subscriptionCancelled) {
  41588. this.pusher.unsubscribe(this.name);
  41589. }
  41590. else {
  41591. this.emit("pusher:subscription_succeeded", event.data);
  41592. }
  41593. };
  41594. Channel.prototype.subscribe = function () {
  41595. var _this = this;
  41596. if (this.subscribed) {
  41597. return;
  41598. }
  41599. this.subscriptionPending = true;
  41600. this.subscriptionCancelled = false;
  41601. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41602. if (error) {
  41603. logger.error(data);
  41604. _this.emit('pusher:subscription_error', data);
  41605. }
  41606. else {
  41607. _this.pusher.send_event('pusher:subscribe', {
  41608. auth: data.auth,
  41609. channel_data: data.channel_data,
  41610. channel: _this.name
  41611. });
  41612. }
  41613. });
  41614. };
  41615. Channel.prototype.unsubscribe = function () {
  41616. this.subscribed = false;
  41617. this.pusher.send_event('pusher:unsubscribe', {
  41618. channel: this.name
  41619. });
  41620. };
  41621. Channel.prototype.cancelSubscription = function () {
  41622. this.subscriptionCancelled = true;
  41623. };
  41624. Channel.prototype.reinstateSubscription = function () {
  41625. this.subscriptionCancelled = false;
  41626. };
  41627. return Channel;
  41628. }(dispatcher));
  41629. /* harmony default export */ var channels_channel = (channel_Channel);
  41630. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41631. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41632. var extendStatics = function (d, b) {
  41633. extendStatics = Object.setPrototypeOf ||
  41634. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41635. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41636. return extendStatics(d, b);
  41637. };
  41638. return function (d, b) {
  41639. extendStatics(d, b);
  41640. function __() { this.constructor = d; }
  41641. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41642. };
  41643. })();
  41644. var private_channel_PrivateChannel = (function (_super) {
  41645. private_channel_extends(PrivateChannel, _super);
  41646. function PrivateChannel() {
  41647. return _super !== null && _super.apply(this, arguments) || this;
  41648. }
  41649. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41650. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41651. return authorizer.authorize(socketId, callback);
  41652. };
  41653. return PrivateChannel;
  41654. }(channels_channel));
  41655. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41656. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41657. var members_Members = (function () {
  41658. function Members() {
  41659. this.reset();
  41660. }
  41661. Members.prototype.get = function (id) {
  41662. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41663. return {
  41664. id: id,
  41665. info: this.members[id]
  41666. };
  41667. }
  41668. else {
  41669. return null;
  41670. }
  41671. };
  41672. Members.prototype.each = function (callback) {
  41673. var _this = this;
  41674. objectApply(this.members, function (member, id) {
  41675. callback(_this.get(id));
  41676. });
  41677. };
  41678. Members.prototype.setMyID = function (id) {
  41679. this.myID = id;
  41680. };
  41681. Members.prototype.onSubscription = function (subscriptionData) {
  41682. this.members = subscriptionData.presence.hash;
  41683. this.count = subscriptionData.presence.count;
  41684. this.me = this.get(this.myID);
  41685. };
  41686. Members.prototype.addMember = function (memberData) {
  41687. if (this.get(memberData.user_id) === null) {
  41688. this.count++;
  41689. }
  41690. this.members[memberData.user_id] = memberData.user_info;
  41691. return this.get(memberData.user_id);
  41692. };
  41693. Members.prototype.removeMember = function (memberData) {
  41694. var member = this.get(memberData.user_id);
  41695. if (member) {
  41696. delete this.members[memberData.user_id];
  41697. this.count--;
  41698. }
  41699. return member;
  41700. };
  41701. Members.prototype.reset = function () {
  41702. this.members = {};
  41703. this.count = 0;
  41704. this.myID = null;
  41705. this.me = null;
  41706. };
  41707. return Members;
  41708. }());
  41709. /* harmony default export */ var members = (members_Members);
  41710. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41711. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41712. var extendStatics = function (d, b) {
  41713. extendStatics = Object.setPrototypeOf ||
  41714. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41715. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41716. return extendStatics(d, b);
  41717. };
  41718. return function (d, b) {
  41719. extendStatics(d, b);
  41720. function __() { this.constructor = d; }
  41721. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41722. };
  41723. })();
  41724. var presence_channel_PresenceChannel = (function (_super) {
  41725. presence_channel_extends(PresenceChannel, _super);
  41726. function PresenceChannel(name, pusher) {
  41727. var _this = _super.call(this, name, pusher) || this;
  41728. _this.members = new members();
  41729. return _this;
  41730. }
  41731. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41732. var _this = this;
  41733. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41734. if (!error) {
  41735. if (authData.channel_data === undefined) {
  41736. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41737. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41738. ("expected 'channel_data' field. " + suffix));
  41739. callback("Invalid auth response");
  41740. return;
  41741. }
  41742. var channelData = JSON.parse(authData.channel_data);
  41743. _this.members.setMyID(channelData.user_id);
  41744. }
  41745. callback(error, authData);
  41746. });
  41747. };
  41748. PresenceChannel.prototype.handleEvent = function (event) {
  41749. var eventName = event.event;
  41750. if (eventName.indexOf("pusher_internal:") === 0) {
  41751. this.handleInternalEvent(event);
  41752. }
  41753. else {
  41754. var data = event.data;
  41755. var metadata = {};
  41756. if (event.user_id) {
  41757. metadata.user_id = event.user_id;
  41758. }
  41759. this.emit(eventName, data, metadata);
  41760. }
  41761. };
  41762. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41763. var eventName = event.event;
  41764. var data = event.data;
  41765. switch (eventName) {
  41766. case "pusher_internal:subscription_succeeded":
  41767. this.handleSubscriptionSucceededEvent(event);
  41768. break;
  41769. case "pusher_internal:member_added":
  41770. var addedMember = this.members.addMember(data);
  41771. this.emit('pusher:member_added', addedMember);
  41772. break;
  41773. case "pusher_internal:member_removed":
  41774. var removedMember = this.members.removeMember(data);
  41775. if (removedMember) {
  41776. this.emit('pusher:member_removed', removedMember);
  41777. }
  41778. break;
  41779. }
  41780. };
  41781. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41782. this.subscriptionPending = false;
  41783. this.subscribed = true;
  41784. if (this.subscriptionCancelled) {
  41785. this.pusher.unsubscribe(this.name);
  41786. }
  41787. else {
  41788. this.members.onSubscription(event.data);
  41789. this.emit("pusher:subscription_succeeded", this.members);
  41790. }
  41791. };
  41792. PresenceChannel.prototype.disconnect = function () {
  41793. this.members.reset();
  41794. _super.prototype.disconnect.call(this);
  41795. };
  41796. return PresenceChannel;
  41797. }(private_channel));
  41798. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41799. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41800. var nacl_fast = __webpack_require__(0);
  41801. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41802. var nacl_util = __webpack_require__(1);
  41803. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41804. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41805. var extendStatics = function (d, b) {
  41806. extendStatics = Object.setPrototypeOf ||
  41807. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41808. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41809. return extendStatics(d, b);
  41810. };
  41811. return function (d, b) {
  41812. extendStatics(d, b);
  41813. function __() { this.constructor = d; }
  41814. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41815. };
  41816. })();
  41817. var encrypted_channel_EncryptedChannel = (function (_super) {
  41818. encrypted_channel_extends(EncryptedChannel, _super);
  41819. function EncryptedChannel() {
  41820. var _this = _super !== null && _super.apply(this, arguments) || this;
  41821. _this.key = null;
  41822. return _this;
  41823. }
  41824. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41825. var _this = this;
  41826. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41827. if (error) {
  41828. callback(true, authData);
  41829. return;
  41830. }
  41831. var sharedSecret = authData["shared_secret"];
  41832. if (!sharedSecret) {
  41833. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41834. callback(true, errorMsg);
  41835. return;
  41836. }
  41837. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41838. delete authData["shared_secret"];
  41839. callback(false, authData);
  41840. });
  41841. };
  41842. EncryptedChannel.prototype.trigger = function (event, data) {
  41843. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41844. };
  41845. EncryptedChannel.prototype.handleEvent = function (event) {
  41846. var eventName = event.event;
  41847. var data = event.data;
  41848. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41849. _super.prototype.handleEvent.call(this, event);
  41850. return;
  41851. }
  41852. this.handleEncryptedEvent(eventName, data);
  41853. };
  41854. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41855. var _this = this;
  41856. if (!this.key) {
  41857. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41858. return;
  41859. }
  41860. if (!data.ciphertext || !data.nonce) {
  41861. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41862. return;
  41863. }
  41864. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41865. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41866. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41867. return;
  41868. }
  41869. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41870. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41871. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41872. return;
  41873. }
  41874. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41875. if (bytes === null) {
  41876. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41877. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41878. if (error) {
  41879. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41880. return;
  41881. }
  41882. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41883. if (bytes === null) {
  41884. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41885. return;
  41886. }
  41887. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41888. return;
  41889. });
  41890. return;
  41891. }
  41892. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41893. };
  41894. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41895. try {
  41896. this.emit(eventName, JSON.parse(data));
  41897. }
  41898. catch (e) {
  41899. this.emit(eventName, data);
  41900. }
  41901. return this;
  41902. };
  41903. return EncryptedChannel;
  41904. }(private_channel));
  41905. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41906. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41907. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41908. var extendStatics = function (d, b) {
  41909. extendStatics = Object.setPrototypeOf ||
  41910. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41911. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41912. return extendStatics(d, b);
  41913. };
  41914. return function (d, b) {
  41915. extendStatics(d, b);
  41916. function __() { this.constructor = d; }
  41917. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41918. };
  41919. })();
  41920. var connection_manager_ConnectionManager = (function (_super) {
  41921. connection_manager_extends(ConnectionManager, _super);
  41922. function ConnectionManager(key, options) {
  41923. var _this = _super.call(this) || this;
  41924. _this.key = key;
  41925. _this.options = options || {};
  41926. _this.state = "initialized";
  41927. _this.connection = null;
  41928. _this.usingTLS = !!options.useTLS;
  41929. _this.timeline = _this.options.timeline;
  41930. _this.errorCallbacks = _this.buildErrorCallbacks();
  41931. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41932. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41933. var Network = runtime.getNetwork();
  41934. Network.bind("online", function () {
  41935. _this.timeline.info({ netinfo: "online" });
  41936. if (_this.state === "connecting" || _this.state === "unavailable") {
  41937. _this.retryIn(0);
  41938. }
  41939. });
  41940. Network.bind("offline", function () {
  41941. _this.timeline.info({ netinfo: "offline" });
  41942. if (_this.connection) {
  41943. _this.sendActivityCheck();
  41944. }
  41945. });
  41946. _this.updateStrategy();
  41947. return _this;
  41948. }
  41949. ConnectionManager.prototype.connect = function () {
  41950. if (this.connection || this.runner) {
  41951. return;
  41952. }
  41953. if (!this.strategy.isSupported()) {
  41954. this.updateState("failed");
  41955. return;
  41956. }
  41957. this.updateState("connecting");
  41958. this.startConnecting();
  41959. this.setUnavailableTimer();
  41960. };
  41961. ;
  41962. ConnectionManager.prototype.send = function (data) {
  41963. if (this.connection) {
  41964. return this.connection.send(data);
  41965. }
  41966. else {
  41967. return false;
  41968. }
  41969. };
  41970. ;
  41971. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41972. if (this.connection) {
  41973. return this.connection.send_event(name, data, channel);
  41974. }
  41975. else {
  41976. return false;
  41977. }
  41978. };
  41979. ;
  41980. ConnectionManager.prototype.disconnect = function () {
  41981. this.disconnectInternally();
  41982. this.updateState("disconnected");
  41983. };
  41984. ;
  41985. ConnectionManager.prototype.isUsingTLS = function () {
  41986. return this.usingTLS;
  41987. };
  41988. ;
  41989. ConnectionManager.prototype.startConnecting = function () {
  41990. var _this = this;
  41991. var callback = function (error, handshake) {
  41992. if (error) {
  41993. _this.runner = _this.strategy.connect(0, callback);
  41994. }
  41995. else {
  41996. if (handshake.action === "error") {
  41997. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41998. _this.timeline.error({ handshakeError: handshake.error });
  41999. }
  42000. else {
  42001. _this.abortConnecting();
  42002. _this.handshakeCallbacks[handshake.action](handshake);
  42003. }
  42004. }
  42005. };
  42006. this.runner = this.strategy.connect(0, callback);
  42007. };
  42008. ;
  42009. ConnectionManager.prototype.abortConnecting = function () {
  42010. if (this.runner) {
  42011. this.runner.abort();
  42012. this.runner = null;
  42013. }
  42014. };
  42015. ;
  42016. ConnectionManager.prototype.disconnectInternally = function () {
  42017. this.abortConnecting();
  42018. this.clearRetryTimer();
  42019. this.clearUnavailableTimer();
  42020. if (this.connection) {
  42021. var connection = this.abandonConnection();
  42022. connection.close();
  42023. }
  42024. };
  42025. ;
  42026. ConnectionManager.prototype.updateStrategy = function () {
  42027. this.strategy = this.options.getStrategy({
  42028. key: this.key,
  42029. timeline: this.timeline,
  42030. useTLS: this.usingTLS
  42031. });
  42032. };
  42033. ;
  42034. ConnectionManager.prototype.retryIn = function (delay) {
  42035. var _this = this;
  42036. this.timeline.info({ action: "retry", delay: delay });
  42037. if (delay > 0) {
  42038. this.emit("connecting_in", Math.round(delay / 1000));
  42039. }
  42040. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42041. _this.disconnectInternally();
  42042. _this.connect();
  42043. });
  42044. };
  42045. ;
  42046. ConnectionManager.prototype.clearRetryTimer = function () {
  42047. if (this.retryTimer) {
  42048. this.retryTimer.ensureAborted();
  42049. this.retryTimer = null;
  42050. }
  42051. };
  42052. ;
  42053. ConnectionManager.prototype.setUnavailableTimer = function () {
  42054. var _this = this;
  42055. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42056. _this.updateState("unavailable");
  42057. });
  42058. };
  42059. ;
  42060. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42061. if (this.unavailableTimer) {
  42062. this.unavailableTimer.ensureAborted();
  42063. }
  42064. };
  42065. ;
  42066. ConnectionManager.prototype.sendActivityCheck = function () {
  42067. var _this = this;
  42068. this.stopActivityCheck();
  42069. this.connection.ping();
  42070. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42071. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42072. _this.retryIn(0);
  42073. });
  42074. };
  42075. ;
  42076. ConnectionManager.prototype.resetActivityCheck = function () {
  42077. var _this = this;
  42078. this.stopActivityCheck();
  42079. if (this.connection && !this.connection.handlesActivityChecks()) {
  42080. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42081. _this.sendActivityCheck();
  42082. });
  42083. }
  42084. };
  42085. ;
  42086. ConnectionManager.prototype.stopActivityCheck = function () {
  42087. if (this.activityTimer) {
  42088. this.activityTimer.ensureAborted();
  42089. }
  42090. };
  42091. ;
  42092. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42093. var _this = this;
  42094. return extend({}, errorCallbacks, {
  42095. message: function (message) {
  42096. _this.resetActivityCheck();
  42097. _this.emit('message', message);
  42098. },
  42099. ping: function () {
  42100. _this.send_event('pusher:pong', {});
  42101. },
  42102. activity: function () {
  42103. _this.resetActivityCheck();
  42104. },
  42105. error: function (error) {
  42106. _this.emit("error", { type: "WebSocketError", error: error });
  42107. },
  42108. closed: function () {
  42109. _this.abandonConnection();
  42110. if (_this.shouldRetry()) {
  42111. _this.retryIn(1000);
  42112. }
  42113. }
  42114. });
  42115. };
  42116. ;
  42117. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42118. var _this = this;
  42119. return extend({}, errorCallbacks, {
  42120. connected: function (handshake) {
  42121. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42122. _this.clearUnavailableTimer();
  42123. _this.setConnection(handshake.connection);
  42124. _this.socket_id = _this.connection.id;
  42125. _this.updateState("connected", { socket_id: _this.socket_id });
  42126. }
  42127. });
  42128. };
  42129. ;
  42130. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42131. var _this = this;
  42132. var withErrorEmitted = function (callback) {
  42133. return function (result) {
  42134. if (result.error) {
  42135. _this.emit("error", { type: "WebSocketError", error: result.error });
  42136. }
  42137. callback(result);
  42138. };
  42139. };
  42140. return {
  42141. tls_only: withErrorEmitted(function () {
  42142. _this.usingTLS = true;
  42143. _this.updateStrategy();
  42144. _this.retryIn(0);
  42145. }),
  42146. refused: withErrorEmitted(function () {
  42147. _this.disconnect();
  42148. }),
  42149. backoff: withErrorEmitted(function () {
  42150. _this.retryIn(1000);
  42151. }),
  42152. retry: withErrorEmitted(function () {
  42153. _this.retryIn(0);
  42154. })
  42155. };
  42156. };
  42157. ;
  42158. ConnectionManager.prototype.setConnection = function (connection) {
  42159. this.connection = connection;
  42160. for (var event in this.connectionCallbacks) {
  42161. this.connection.bind(event, this.connectionCallbacks[event]);
  42162. }
  42163. this.resetActivityCheck();
  42164. };
  42165. ;
  42166. ConnectionManager.prototype.abandonConnection = function () {
  42167. if (!this.connection) {
  42168. return;
  42169. }
  42170. this.stopActivityCheck();
  42171. for (var event in this.connectionCallbacks) {
  42172. this.connection.unbind(event, this.connectionCallbacks[event]);
  42173. }
  42174. var connection = this.connection;
  42175. this.connection = null;
  42176. return connection;
  42177. };
  42178. ConnectionManager.prototype.updateState = function (newState, data) {
  42179. var previousState = this.state;
  42180. this.state = newState;
  42181. if (previousState !== newState) {
  42182. var newStateDescription = newState;
  42183. if (newStateDescription === "connected") {
  42184. newStateDescription += " with new socket ID " + data.socket_id;
  42185. }
  42186. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42187. this.timeline.info({ state: newState, params: data });
  42188. this.emit('state_change', { previous: previousState, current: newState });
  42189. this.emit(newState, data);
  42190. }
  42191. };
  42192. ConnectionManager.prototype.shouldRetry = function () {
  42193. return this.state === "connecting" || this.state === "connected";
  42194. };
  42195. return ConnectionManager;
  42196. }(dispatcher));
  42197. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42198. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42199. var channels_Channels = (function () {
  42200. function Channels() {
  42201. this.channels = {};
  42202. }
  42203. Channels.prototype.add = function (name, pusher) {
  42204. if (!this.channels[name]) {
  42205. this.channels[name] = createChannel(name, pusher);
  42206. }
  42207. return this.channels[name];
  42208. };
  42209. Channels.prototype.all = function () {
  42210. return values(this.channels);
  42211. };
  42212. Channels.prototype.find = function (name) {
  42213. return this.channels[name];
  42214. };
  42215. Channels.prototype.remove = function (name) {
  42216. var channel = this.channels[name];
  42217. delete this.channels[name];
  42218. return channel;
  42219. };
  42220. Channels.prototype.disconnect = function () {
  42221. objectApply(this.channels, function (channel) {
  42222. channel.disconnect();
  42223. });
  42224. };
  42225. return Channels;
  42226. }());
  42227. /* harmony default export */ var channels = (channels_Channels);
  42228. function createChannel(name, pusher) {
  42229. if (name.indexOf('private-encrypted-') === 0) {
  42230. if (false) { var errorMsg; }
  42231. return factory.createEncryptedChannel(name, pusher);
  42232. }
  42233. else if (name.indexOf('private-') === 0) {
  42234. return factory.createPrivateChannel(name, pusher);
  42235. }
  42236. else if (name.indexOf('presence-') === 0) {
  42237. return factory.createPresenceChannel(name, pusher);
  42238. }
  42239. else {
  42240. return factory.createChannel(name, pusher);
  42241. }
  42242. }
  42243. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42244. var Factory = {
  42245. createChannels: function () {
  42246. return new channels();
  42247. },
  42248. createConnectionManager: function (key, options) {
  42249. return new connection_manager(key, options);
  42250. },
  42251. createChannel: function (name, pusher) {
  42252. return new channels_channel(name, pusher);
  42253. },
  42254. createPrivateChannel: function (name, pusher) {
  42255. return new private_channel(name, pusher);
  42256. },
  42257. createPresenceChannel: function (name, pusher) {
  42258. return new presence_channel(name, pusher);
  42259. },
  42260. createEncryptedChannel: function (name, pusher) {
  42261. return new encrypted_channel(name, pusher);
  42262. },
  42263. createTimelineSender: function (timeline, options) {
  42264. return new timeline_sender(timeline, options);
  42265. },
  42266. createAuthorizer: function (channel, options) {
  42267. if (options.authorizer) {
  42268. return options.authorizer(channel, options);
  42269. }
  42270. return new pusher_authorizer(channel, options);
  42271. },
  42272. createHandshake: function (transport, callback) {
  42273. return new connection_handshake(transport, callback);
  42274. },
  42275. createAssistantToTheTransportManager: function (manager, transport, options) {
  42276. return new assistant_to_the_transport_manager(manager, transport, options);
  42277. }
  42278. };
  42279. /* harmony default export */ var factory = (Factory);
  42280. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42281. var transport_manager_TransportManager = (function () {
  42282. function TransportManager(options) {
  42283. this.options = options || {};
  42284. this.livesLeft = this.options.lives || Infinity;
  42285. }
  42286. TransportManager.prototype.getAssistant = function (transport) {
  42287. return factory.createAssistantToTheTransportManager(this, transport, {
  42288. minPingDelay: this.options.minPingDelay,
  42289. maxPingDelay: this.options.maxPingDelay
  42290. });
  42291. };
  42292. TransportManager.prototype.isAlive = function () {
  42293. return this.livesLeft > 0;
  42294. };
  42295. TransportManager.prototype.reportDeath = function () {
  42296. this.livesLeft -= 1;
  42297. };
  42298. return TransportManager;
  42299. }());
  42300. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42301. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42302. var sequential_strategy_SequentialStrategy = (function () {
  42303. function SequentialStrategy(strategies, options) {
  42304. this.strategies = strategies;
  42305. this.loop = Boolean(options.loop);
  42306. this.failFast = Boolean(options.failFast);
  42307. this.timeout = options.timeout;
  42308. this.timeoutLimit = options.timeoutLimit;
  42309. }
  42310. SequentialStrategy.prototype.isSupported = function () {
  42311. return any(this.strategies, util.method("isSupported"));
  42312. };
  42313. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42314. var _this = this;
  42315. var strategies = this.strategies;
  42316. var current = 0;
  42317. var timeout = this.timeout;
  42318. var runner = null;
  42319. var tryNextStrategy = function (error, handshake) {
  42320. if (handshake) {
  42321. callback(null, handshake);
  42322. }
  42323. else {
  42324. current = current + 1;
  42325. if (_this.loop) {
  42326. current = current % strategies.length;
  42327. }
  42328. if (current < strategies.length) {
  42329. if (timeout) {
  42330. timeout = timeout * 2;
  42331. if (_this.timeoutLimit) {
  42332. timeout = Math.min(timeout, _this.timeoutLimit);
  42333. }
  42334. }
  42335. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42336. }
  42337. else {
  42338. callback(true);
  42339. }
  42340. }
  42341. };
  42342. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42343. return {
  42344. abort: function () {
  42345. runner.abort();
  42346. },
  42347. forceMinPriority: function (p) {
  42348. minPriority = p;
  42349. if (runner) {
  42350. runner.forceMinPriority(p);
  42351. }
  42352. }
  42353. };
  42354. };
  42355. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42356. var timer = null;
  42357. var runner = null;
  42358. if (options.timeout > 0) {
  42359. timer = new OneOffTimer(options.timeout, function () {
  42360. runner.abort();
  42361. callback(true);
  42362. });
  42363. }
  42364. runner = strategy.connect(minPriority, function (error, handshake) {
  42365. if (error && timer && timer.isRunning() && !options.failFast) {
  42366. return;
  42367. }
  42368. if (timer) {
  42369. timer.ensureAborted();
  42370. }
  42371. callback(error, handshake);
  42372. });
  42373. return {
  42374. abort: function () {
  42375. if (timer) {
  42376. timer.ensureAborted();
  42377. }
  42378. runner.abort();
  42379. },
  42380. forceMinPriority: function (p) {
  42381. runner.forceMinPriority(p);
  42382. }
  42383. };
  42384. };
  42385. return SequentialStrategy;
  42386. }());
  42387. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42388. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42389. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42390. function BestConnectedEverStrategy(strategies) {
  42391. this.strategies = strategies;
  42392. }
  42393. BestConnectedEverStrategy.prototype.isSupported = function () {
  42394. return any(this.strategies, util.method("isSupported"));
  42395. };
  42396. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42397. return connect(this.strategies, minPriority, function (i, runners) {
  42398. return function (error, handshake) {
  42399. runners[i].error = error;
  42400. if (error) {
  42401. if (allRunnersFailed(runners)) {
  42402. callback(true);
  42403. }
  42404. return;
  42405. }
  42406. apply(runners, function (runner) {
  42407. runner.forceMinPriority(handshake.transport.priority);
  42408. });
  42409. callback(null, handshake);
  42410. };
  42411. });
  42412. };
  42413. return BestConnectedEverStrategy;
  42414. }());
  42415. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42416. function connect(strategies, minPriority, callbackBuilder) {
  42417. var runners = map(strategies, function (strategy, i, _, rs) {
  42418. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42419. });
  42420. return {
  42421. abort: function () {
  42422. apply(runners, abortRunner);
  42423. },
  42424. forceMinPriority: function (p) {
  42425. apply(runners, function (runner) {
  42426. runner.forceMinPriority(p);
  42427. });
  42428. }
  42429. };
  42430. }
  42431. function allRunnersFailed(runners) {
  42432. return collections_all(runners, function (runner) {
  42433. return Boolean(runner.error);
  42434. });
  42435. }
  42436. function abortRunner(runner) {
  42437. if (!runner.error && !runner.aborted) {
  42438. runner.abort();
  42439. runner.aborted = true;
  42440. }
  42441. }
  42442. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42443. var cached_strategy_CachedStrategy = (function () {
  42444. function CachedStrategy(strategy, transports, options) {
  42445. this.strategy = strategy;
  42446. this.transports = transports;
  42447. this.ttl = options.ttl || 1800 * 1000;
  42448. this.usingTLS = options.useTLS;
  42449. this.timeline = options.timeline;
  42450. }
  42451. CachedStrategy.prototype.isSupported = function () {
  42452. return this.strategy.isSupported();
  42453. };
  42454. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42455. var usingTLS = this.usingTLS;
  42456. var info = fetchTransportCache(usingTLS);
  42457. var strategies = [this.strategy];
  42458. if (info && info.timestamp + this.ttl >= util.now()) {
  42459. var transport = this.transports[info.transport];
  42460. if (transport) {
  42461. this.timeline.info({
  42462. cached: true,
  42463. transport: info.transport,
  42464. latency: info.latency
  42465. });
  42466. strategies.push(new sequential_strategy([transport], {
  42467. timeout: info.latency * 2 + 1000,
  42468. failFast: true
  42469. }));
  42470. }
  42471. }
  42472. var startTimestamp = util.now();
  42473. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42474. if (error) {
  42475. flushTransportCache(usingTLS);
  42476. if (strategies.length > 0) {
  42477. startTimestamp = util.now();
  42478. runner = strategies.pop().connect(minPriority, cb);
  42479. }
  42480. else {
  42481. callback(error);
  42482. }
  42483. }
  42484. else {
  42485. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42486. callback(null, handshake);
  42487. }
  42488. });
  42489. return {
  42490. abort: function () {
  42491. runner.abort();
  42492. },
  42493. forceMinPriority: function (p) {
  42494. minPriority = p;
  42495. if (runner) {
  42496. runner.forceMinPriority(p);
  42497. }
  42498. }
  42499. };
  42500. };
  42501. return CachedStrategy;
  42502. }());
  42503. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42504. function getTransportCacheKey(usingTLS) {
  42505. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42506. }
  42507. function fetchTransportCache(usingTLS) {
  42508. var storage = runtime.getLocalStorage();
  42509. if (storage) {
  42510. try {
  42511. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42512. if (serializedCache) {
  42513. return JSON.parse(serializedCache);
  42514. }
  42515. }
  42516. catch (e) {
  42517. flushTransportCache(usingTLS);
  42518. }
  42519. }
  42520. return null;
  42521. }
  42522. function storeTransportCache(usingTLS, transport, latency) {
  42523. var storage = runtime.getLocalStorage();
  42524. if (storage) {
  42525. try {
  42526. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42527. timestamp: util.now(),
  42528. transport: transport,
  42529. latency: latency
  42530. });
  42531. }
  42532. catch (e) {
  42533. }
  42534. }
  42535. }
  42536. function flushTransportCache(usingTLS) {
  42537. var storage = runtime.getLocalStorage();
  42538. if (storage) {
  42539. try {
  42540. delete storage[getTransportCacheKey(usingTLS)];
  42541. }
  42542. catch (e) {
  42543. }
  42544. }
  42545. }
  42546. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42547. var delayed_strategy_DelayedStrategy = (function () {
  42548. function DelayedStrategy(strategy, _a) {
  42549. var number = _a.delay;
  42550. this.strategy = strategy;
  42551. this.options = { delay: number };
  42552. }
  42553. DelayedStrategy.prototype.isSupported = function () {
  42554. return this.strategy.isSupported();
  42555. };
  42556. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42557. var strategy = this.strategy;
  42558. var runner;
  42559. var timer = new OneOffTimer(this.options.delay, function () {
  42560. runner = strategy.connect(minPriority, callback);
  42561. });
  42562. return {
  42563. abort: function () {
  42564. timer.ensureAborted();
  42565. if (runner) {
  42566. runner.abort();
  42567. }
  42568. },
  42569. forceMinPriority: function (p) {
  42570. minPriority = p;
  42571. if (runner) {
  42572. runner.forceMinPriority(p);
  42573. }
  42574. }
  42575. };
  42576. };
  42577. return DelayedStrategy;
  42578. }());
  42579. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42580. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42581. var IfStrategy = (function () {
  42582. function IfStrategy(test, trueBranch, falseBranch) {
  42583. this.test = test;
  42584. this.trueBranch = trueBranch;
  42585. this.falseBranch = falseBranch;
  42586. }
  42587. IfStrategy.prototype.isSupported = function () {
  42588. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42589. return branch.isSupported();
  42590. };
  42591. IfStrategy.prototype.connect = function (minPriority, callback) {
  42592. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42593. return branch.connect(minPriority, callback);
  42594. };
  42595. return IfStrategy;
  42596. }());
  42597. /* harmony default export */ var if_strategy = (IfStrategy);
  42598. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42599. var FirstConnectedStrategy = (function () {
  42600. function FirstConnectedStrategy(strategy) {
  42601. this.strategy = strategy;
  42602. }
  42603. FirstConnectedStrategy.prototype.isSupported = function () {
  42604. return this.strategy.isSupported();
  42605. };
  42606. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42607. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42608. if (handshake) {
  42609. runner.abort();
  42610. }
  42611. callback(error, handshake);
  42612. });
  42613. return runner;
  42614. };
  42615. return FirstConnectedStrategy;
  42616. }());
  42617. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42618. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42619. function testSupportsStrategy(strategy) {
  42620. return function () {
  42621. return strategy.isSupported();
  42622. };
  42623. }
  42624. var getDefaultStrategy = function (config, defineTransport) {
  42625. var definedTransports = {};
  42626. function defineTransportStrategy(name, type, priority, options, manager) {
  42627. var transport = defineTransport(config, name, type, priority, options, manager);
  42628. definedTransports[name] = transport;
  42629. return transport;
  42630. }
  42631. var ws_options = {
  42632. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42633. hostTLS: config.wsHost + ":" + config.wssPort,
  42634. httpPath: config.wsPath
  42635. };
  42636. var wss_options = extend({}, ws_options, {
  42637. useTLS: true
  42638. });
  42639. var sockjs_options = {
  42640. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42641. hostTLS: config.httpHost + ":" + config.httpsPort,
  42642. httpPath: config.httpPath
  42643. };
  42644. var timeouts = {
  42645. loop: true,
  42646. timeout: 15000,
  42647. timeoutLimit: 60000
  42648. };
  42649. var ws_manager = new transport_manager({
  42650. lives: 2,
  42651. minPingDelay: 10000,
  42652. maxPingDelay: config.activity_timeout
  42653. });
  42654. var streaming_manager = new transport_manager({
  42655. lives: 2,
  42656. minPingDelay: 10000,
  42657. maxPingDelay: config.activity_timeout
  42658. });
  42659. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42660. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42661. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42662. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42663. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42664. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42665. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42666. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42667. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42668. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42669. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42670. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42671. 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);
  42672. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42673. var wsStrategy;
  42674. if (config.useTLS) {
  42675. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42676. }
  42677. else {
  42678. wsStrategy = new best_connected_ever_strategy([
  42679. ws_loop,
  42680. new delayed_strategy(wss_loop, { delay: 2000 }),
  42681. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42682. ]);
  42683. }
  42684. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42685. ttl: 1800000,
  42686. timeline: config.timeline,
  42687. useTLS: config.useTLS
  42688. });
  42689. };
  42690. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42691. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42692. /* harmony default export */ var transport_connection_initializer = (function () {
  42693. var self = this;
  42694. self.timeline.info(self.buildTimelineMessage({
  42695. transport: self.name + (self.options.useTLS ? "s" : "")
  42696. }));
  42697. if (self.hooks.isInitialized()) {
  42698. self.changeState("initialized");
  42699. }
  42700. else if (self.hooks.file) {
  42701. self.changeState("initializing");
  42702. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42703. if (self.hooks.isInitialized()) {
  42704. self.changeState("initialized");
  42705. callback(true);
  42706. }
  42707. else {
  42708. if (error) {
  42709. self.onError(error);
  42710. }
  42711. self.onClose();
  42712. callback(false);
  42713. }
  42714. });
  42715. }
  42716. else {
  42717. self.onClose();
  42718. }
  42719. });
  42720. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42721. var http_xdomain_request_hooks = {
  42722. getRequest: function (socket) {
  42723. var xdr = new window.XDomainRequest();
  42724. xdr.ontimeout = function () {
  42725. socket.emit("error", new RequestTimedOut());
  42726. socket.close();
  42727. };
  42728. xdr.onerror = function (e) {
  42729. socket.emit("error", e);
  42730. socket.close();
  42731. };
  42732. xdr.onprogress = function () {
  42733. if (xdr.responseText && xdr.responseText.length > 0) {
  42734. socket.onChunk(200, xdr.responseText);
  42735. }
  42736. };
  42737. xdr.onload = function () {
  42738. if (xdr.responseText && xdr.responseText.length > 0) {
  42739. socket.onChunk(200, xdr.responseText);
  42740. }
  42741. socket.emit("finished", 200);
  42742. socket.close();
  42743. };
  42744. return xdr;
  42745. },
  42746. abortRequest: function (xdr) {
  42747. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42748. xdr.abort();
  42749. }
  42750. };
  42751. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42752. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42753. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42754. var extendStatics = function (d, b) {
  42755. extendStatics = Object.setPrototypeOf ||
  42756. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42757. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42758. return extendStatics(d, b);
  42759. };
  42760. return function (d, b) {
  42761. extendStatics(d, b);
  42762. function __() { this.constructor = d; }
  42763. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42764. };
  42765. })();
  42766. var MAX_BUFFER_LENGTH = 256 * 1024;
  42767. var http_request_HTTPRequest = (function (_super) {
  42768. http_request_extends(HTTPRequest, _super);
  42769. function HTTPRequest(hooks, method, url) {
  42770. var _this = _super.call(this) || this;
  42771. _this.hooks = hooks;
  42772. _this.method = method;
  42773. _this.url = url;
  42774. return _this;
  42775. }
  42776. HTTPRequest.prototype.start = function (payload) {
  42777. var _this = this;
  42778. this.position = 0;
  42779. this.xhr = this.hooks.getRequest(this);
  42780. this.unloader = function () {
  42781. _this.close();
  42782. };
  42783. runtime.addUnloadListener(this.unloader);
  42784. this.xhr.open(this.method, this.url, true);
  42785. if (this.xhr.setRequestHeader) {
  42786. this.xhr.setRequestHeader("Content-Type", "application/json");
  42787. }
  42788. this.xhr.send(payload);
  42789. };
  42790. HTTPRequest.prototype.close = function () {
  42791. if (this.unloader) {
  42792. runtime.removeUnloadListener(this.unloader);
  42793. this.unloader = null;
  42794. }
  42795. if (this.xhr) {
  42796. this.hooks.abortRequest(this.xhr);
  42797. this.xhr = null;
  42798. }
  42799. };
  42800. HTTPRequest.prototype.onChunk = function (status, data) {
  42801. while (true) {
  42802. var chunk = this.advanceBuffer(data);
  42803. if (chunk) {
  42804. this.emit("chunk", { status: status, data: chunk });
  42805. }
  42806. else {
  42807. break;
  42808. }
  42809. }
  42810. if (this.isBufferTooLong(data)) {
  42811. this.emit("buffer_too_long");
  42812. }
  42813. };
  42814. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42815. var unreadData = buffer.slice(this.position);
  42816. var endOfLinePosition = unreadData.indexOf("\n");
  42817. if (endOfLinePosition !== -1) {
  42818. this.position += endOfLinePosition + 1;
  42819. return unreadData.slice(0, endOfLinePosition);
  42820. }
  42821. else {
  42822. return null;
  42823. }
  42824. };
  42825. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42826. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42827. };
  42828. return HTTPRequest;
  42829. }(dispatcher));
  42830. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42831. // CONCATENATED MODULE: ./src/core/http/state.ts
  42832. var State;
  42833. (function (State) {
  42834. State[State["CONNECTING"] = 0] = "CONNECTING";
  42835. State[State["OPEN"] = 1] = "OPEN";
  42836. State[State["CLOSED"] = 3] = "CLOSED";
  42837. })(State || (State = {}));
  42838. /* harmony default export */ var state = (State);
  42839. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42840. var autoIncrement = 1;
  42841. var http_socket_HTTPSocket = (function () {
  42842. function HTTPSocket(hooks, url) {
  42843. this.hooks = hooks;
  42844. this.session = randomNumber(1000) + "/" + randomString(8);
  42845. this.location = getLocation(url);
  42846. this.readyState = state.CONNECTING;
  42847. this.openStream();
  42848. }
  42849. HTTPSocket.prototype.send = function (payload) {
  42850. return this.sendRaw(JSON.stringify([payload]));
  42851. };
  42852. HTTPSocket.prototype.ping = function () {
  42853. this.hooks.sendHeartbeat(this);
  42854. };
  42855. HTTPSocket.prototype.close = function (code, reason) {
  42856. this.onClose(code, reason, true);
  42857. };
  42858. HTTPSocket.prototype.sendRaw = function (payload) {
  42859. if (this.readyState === state.OPEN) {
  42860. try {
  42861. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42862. return true;
  42863. }
  42864. catch (e) {
  42865. return false;
  42866. }
  42867. }
  42868. else {
  42869. return false;
  42870. }
  42871. };
  42872. HTTPSocket.prototype.reconnect = function () {
  42873. this.closeStream();
  42874. this.openStream();
  42875. };
  42876. ;
  42877. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42878. this.closeStream();
  42879. this.readyState = state.CLOSED;
  42880. if (this.onclose) {
  42881. this.onclose({
  42882. code: code,
  42883. reason: reason,
  42884. wasClean: wasClean
  42885. });
  42886. }
  42887. };
  42888. HTTPSocket.prototype.onChunk = function (chunk) {
  42889. if (chunk.status !== 200) {
  42890. return;
  42891. }
  42892. if (this.readyState === state.OPEN) {
  42893. this.onActivity();
  42894. }
  42895. var payload;
  42896. var type = chunk.data.slice(0, 1);
  42897. switch (type) {
  42898. case 'o':
  42899. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42900. this.onOpen(payload);
  42901. break;
  42902. case 'a':
  42903. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42904. for (var i = 0; i < payload.length; i++) {
  42905. this.onEvent(payload[i]);
  42906. }
  42907. break;
  42908. case 'm':
  42909. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42910. this.onEvent(payload);
  42911. break;
  42912. case 'h':
  42913. this.hooks.onHeartbeat(this);
  42914. break;
  42915. case 'c':
  42916. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42917. this.onClose(payload[0], payload[1], true);
  42918. break;
  42919. }
  42920. };
  42921. HTTPSocket.prototype.onOpen = function (options) {
  42922. if (this.readyState === state.CONNECTING) {
  42923. if (options && options.hostname) {
  42924. this.location.base = replaceHost(this.location.base, options.hostname);
  42925. }
  42926. this.readyState = state.OPEN;
  42927. if (this.onopen) {
  42928. this.onopen();
  42929. }
  42930. }
  42931. else {
  42932. this.onClose(1006, "Server lost session", true);
  42933. }
  42934. };
  42935. HTTPSocket.prototype.onEvent = function (event) {
  42936. if (this.readyState === state.OPEN && this.onmessage) {
  42937. this.onmessage({ data: event });
  42938. }
  42939. };
  42940. HTTPSocket.prototype.onActivity = function () {
  42941. if (this.onactivity) {
  42942. this.onactivity();
  42943. }
  42944. };
  42945. HTTPSocket.prototype.onError = function (error) {
  42946. if (this.onerror) {
  42947. this.onerror(error);
  42948. }
  42949. };
  42950. HTTPSocket.prototype.openStream = function () {
  42951. var _this = this;
  42952. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42953. this.stream.bind("chunk", function (chunk) {
  42954. _this.onChunk(chunk);
  42955. });
  42956. this.stream.bind("finished", function (status) {
  42957. _this.hooks.onFinished(_this, status);
  42958. });
  42959. this.stream.bind("buffer_too_long", function () {
  42960. _this.reconnect();
  42961. });
  42962. try {
  42963. this.stream.start();
  42964. }
  42965. catch (error) {
  42966. util.defer(function () {
  42967. _this.onError(error);
  42968. _this.onClose(1006, "Could not start streaming", false);
  42969. });
  42970. }
  42971. };
  42972. HTTPSocket.prototype.closeStream = function () {
  42973. if (this.stream) {
  42974. this.stream.unbind_all();
  42975. this.stream.close();
  42976. this.stream = null;
  42977. }
  42978. };
  42979. return HTTPSocket;
  42980. }());
  42981. function getLocation(url) {
  42982. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42983. return {
  42984. base: parts[1],
  42985. queryString: parts[2]
  42986. };
  42987. }
  42988. function getSendURL(url, session) {
  42989. return url.base + "/" + session + "/xhr_send";
  42990. }
  42991. function getUniqueURL(url) {
  42992. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42993. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42994. }
  42995. function replaceHost(url, hostname) {
  42996. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42997. return urlParts[1] + hostname + urlParts[3];
  42998. }
  42999. function randomNumber(max) {
  43000. return Math.floor(Math.random() * max);
  43001. }
  43002. function randomString(length) {
  43003. var result = [];
  43004. for (var i = 0; i < length; i++) {
  43005. result.push(randomNumber(32).toString(32));
  43006. }
  43007. return result.join('');
  43008. }
  43009. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  43010. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  43011. var http_streaming_socket_hooks = {
  43012. getReceiveURL: function (url, session) {
  43013. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43014. },
  43015. onHeartbeat: function (socket) {
  43016. socket.sendRaw("[]");
  43017. },
  43018. sendHeartbeat: function (socket) {
  43019. socket.sendRaw("[]");
  43020. },
  43021. onFinished: function (socket, status) {
  43022. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43023. }
  43024. };
  43025. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43026. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43027. var http_polling_socket_hooks = {
  43028. getReceiveURL: function (url, session) {
  43029. return url.base + "/" + session + "/xhr" + url.queryString;
  43030. },
  43031. onHeartbeat: function () {
  43032. },
  43033. sendHeartbeat: function (socket) {
  43034. socket.sendRaw("[]");
  43035. },
  43036. onFinished: function (socket, status) {
  43037. if (status === 200) {
  43038. socket.reconnect();
  43039. }
  43040. else {
  43041. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43042. }
  43043. }
  43044. };
  43045. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43046. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43047. var http_xhr_request_hooks = {
  43048. getRequest: function (socket) {
  43049. var Constructor = runtime.getXHRAPI();
  43050. var xhr = new Constructor();
  43051. xhr.onreadystatechange = xhr.onprogress = function () {
  43052. switch (xhr.readyState) {
  43053. case 3:
  43054. if (xhr.responseText && xhr.responseText.length > 0) {
  43055. socket.onChunk(xhr.status, xhr.responseText);
  43056. }
  43057. break;
  43058. case 4:
  43059. if (xhr.responseText && xhr.responseText.length > 0) {
  43060. socket.onChunk(xhr.status, xhr.responseText);
  43061. }
  43062. socket.emit("finished", xhr.status);
  43063. socket.close();
  43064. break;
  43065. }
  43066. };
  43067. return xhr;
  43068. },
  43069. abortRequest: function (xhr) {
  43070. xhr.onreadystatechange = null;
  43071. xhr.abort();
  43072. }
  43073. };
  43074. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43075. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43076. var HTTP = {
  43077. createStreamingSocket: function (url) {
  43078. return this.createSocket(http_streaming_socket, url);
  43079. },
  43080. createPollingSocket: function (url) {
  43081. return this.createSocket(http_polling_socket, url);
  43082. },
  43083. createSocket: function (hooks, url) {
  43084. return new http_socket(hooks, url);
  43085. },
  43086. createXHR: function (method, url) {
  43087. return this.createRequest(http_xhr_request, method, url);
  43088. },
  43089. createRequest: function (hooks, method, url) {
  43090. return new http_request(hooks, method, url);
  43091. }
  43092. };
  43093. /* harmony default export */ var http_http = (HTTP);
  43094. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43095. http_http.createXDR = function (method, url) {
  43096. return this.createRequest(http_xdomain_request, method, url);
  43097. };
  43098. /* harmony default export */ var web_http_http = (http_http);
  43099. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43100. var Runtime = {
  43101. nextAuthCallbackID: 1,
  43102. auth_callbacks: {},
  43103. ScriptReceivers: ScriptReceivers,
  43104. DependenciesReceivers: DependenciesReceivers,
  43105. getDefaultStrategy: default_strategy,
  43106. Transports: transports_transports,
  43107. transportConnectionInitializer: transport_connection_initializer,
  43108. HTTPFactory: web_http_http,
  43109. TimelineTransport: jsonp_timeline,
  43110. getXHRAPI: function () {
  43111. return window.XMLHttpRequest;
  43112. },
  43113. getWebSocketAPI: function () {
  43114. return window.WebSocket || window.MozWebSocket;
  43115. },
  43116. setup: function (PusherClass) {
  43117. var _this = this;
  43118. window.Pusher = PusherClass;
  43119. var initializeOnDocumentBody = function () {
  43120. _this.onDocumentBody(PusherClass.ready);
  43121. };
  43122. if (!window.JSON) {
  43123. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43124. }
  43125. else {
  43126. initializeOnDocumentBody();
  43127. }
  43128. },
  43129. getDocument: function () {
  43130. return document;
  43131. },
  43132. getProtocol: function () {
  43133. return this.getDocument().location.protocol;
  43134. },
  43135. getAuthorizers: function () {
  43136. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43137. },
  43138. onDocumentBody: function (callback) {
  43139. var _this = this;
  43140. if (document.body) {
  43141. callback();
  43142. }
  43143. else {
  43144. setTimeout(function () {
  43145. _this.onDocumentBody(callback);
  43146. }, 0);
  43147. }
  43148. },
  43149. createJSONPRequest: function (url, data) {
  43150. return new jsonp_request(url, data);
  43151. },
  43152. createScriptRequest: function (src) {
  43153. return new script_request(src);
  43154. },
  43155. getLocalStorage: function () {
  43156. try {
  43157. return window.localStorage;
  43158. }
  43159. catch (e) {
  43160. return undefined;
  43161. }
  43162. },
  43163. createXHR: function () {
  43164. if (this.getXHRAPI()) {
  43165. return this.createXMLHttpRequest();
  43166. }
  43167. else {
  43168. return this.createMicrosoftXHR();
  43169. }
  43170. },
  43171. createXMLHttpRequest: function () {
  43172. var Constructor = this.getXHRAPI();
  43173. return new Constructor();
  43174. },
  43175. createMicrosoftXHR: function () {
  43176. return new ActiveXObject("Microsoft.XMLHTTP");
  43177. },
  43178. getNetwork: function () {
  43179. return net_info_Network;
  43180. },
  43181. createWebSocket: function (url) {
  43182. var Constructor = this.getWebSocketAPI();
  43183. return new Constructor(url);
  43184. },
  43185. createSocketRequest: function (method, url) {
  43186. if (this.isXHRSupported()) {
  43187. return this.HTTPFactory.createXHR(method, url);
  43188. }
  43189. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43190. return this.HTTPFactory.createXDR(method, url);
  43191. }
  43192. else {
  43193. throw "Cross-origin HTTP requests are not supported";
  43194. }
  43195. },
  43196. isXHRSupported: function () {
  43197. var Constructor = this.getXHRAPI();
  43198. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43199. },
  43200. isXDRSupported: function (useTLS) {
  43201. var protocol = useTLS ? "https:" : "http:";
  43202. var documentProtocol = this.getProtocol();
  43203. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43204. },
  43205. addUnloadListener: function (listener) {
  43206. if (window.addEventListener !== undefined) {
  43207. window.addEventListener("unload", listener, false);
  43208. }
  43209. else if (window.attachEvent !== undefined) {
  43210. window.attachEvent("onunload", listener);
  43211. }
  43212. },
  43213. removeUnloadListener: function (listener) {
  43214. if (window.addEventListener !== undefined) {
  43215. window.removeEventListener("unload", listener, false);
  43216. }
  43217. else if (window.detachEvent !== undefined) {
  43218. window.detachEvent("onunload", listener);
  43219. }
  43220. }
  43221. };
  43222. /* harmony default export */ var runtime = (Runtime);
  43223. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43224. var TimelineLevel;
  43225. (function (TimelineLevel) {
  43226. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43227. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43228. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43229. })(TimelineLevel || (TimelineLevel = {}));
  43230. /* harmony default export */ var timeline_level = (TimelineLevel);
  43231. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43232. var timeline_Timeline = (function () {
  43233. function Timeline(key, session, options) {
  43234. this.key = key;
  43235. this.session = session;
  43236. this.events = [];
  43237. this.options = options || {};
  43238. this.sent = 0;
  43239. this.uniqueID = 0;
  43240. }
  43241. Timeline.prototype.log = function (level, event) {
  43242. if (level <= this.options.level) {
  43243. this.events.push(extend({}, event, { timestamp: util.now() }));
  43244. if (this.options.limit && this.events.length > this.options.limit) {
  43245. this.events.shift();
  43246. }
  43247. }
  43248. };
  43249. Timeline.prototype.error = function (event) {
  43250. this.log(timeline_level.ERROR, event);
  43251. };
  43252. Timeline.prototype.info = function (event) {
  43253. this.log(timeline_level.INFO, event);
  43254. };
  43255. Timeline.prototype.debug = function (event) {
  43256. this.log(timeline_level.DEBUG, event);
  43257. };
  43258. Timeline.prototype.isEmpty = function () {
  43259. return this.events.length === 0;
  43260. };
  43261. Timeline.prototype.send = function (sendfn, callback) {
  43262. var _this = this;
  43263. var data = extend({
  43264. session: this.session,
  43265. bundle: this.sent + 1,
  43266. key: this.key,
  43267. lib: "js",
  43268. version: this.options.version,
  43269. cluster: this.options.cluster,
  43270. features: this.options.features,
  43271. timeline: this.events
  43272. }, this.options.params);
  43273. this.events = [];
  43274. sendfn(data, function (error, result) {
  43275. if (!error) {
  43276. _this.sent++;
  43277. }
  43278. if (callback) {
  43279. callback(error, result);
  43280. }
  43281. });
  43282. return true;
  43283. };
  43284. Timeline.prototype.generateUniqueID = function () {
  43285. this.uniqueID++;
  43286. return this.uniqueID;
  43287. };
  43288. return Timeline;
  43289. }());
  43290. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43291. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43292. var transport_strategy_TransportStrategy = (function () {
  43293. function TransportStrategy(name, priority, transport, options) {
  43294. this.name = name;
  43295. this.priority = priority;
  43296. this.transport = transport;
  43297. this.options = options || {};
  43298. }
  43299. TransportStrategy.prototype.isSupported = function () {
  43300. return this.transport.isSupported({
  43301. useTLS: this.options.useTLS
  43302. });
  43303. };
  43304. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43305. var _this = this;
  43306. if (!this.isSupported()) {
  43307. return failAttempt(new UnsupportedStrategy(), callback);
  43308. }
  43309. else if (this.priority < minPriority) {
  43310. return failAttempt(new TransportPriorityTooLow(), callback);
  43311. }
  43312. var connected = false;
  43313. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43314. var handshake = null;
  43315. var onInitialized = function () {
  43316. transport.unbind("initialized", onInitialized);
  43317. transport.connect();
  43318. };
  43319. var onOpen = function () {
  43320. handshake = factory.createHandshake(transport, function (result) {
  43321. connected = true;
  43322. unbindListeners();
  43323. callback(null, result);
  43324. });
  43325. };
  43326. var onError = function (error) {
  43327. unbindListeners();
  43328. callback(error);
  43329. };
  43330. var onClosed = function () {
  43331. unbindListeners();
  43332. var serializedTransport;
  43333. serializedTransport = safeJSONStringify(transport);
  43334. callback(new TransportClosed(serializedTransport));
  43335. };
  43336. var unbindListeners = function () {
  43337. transport.unbind("initialized", onInitialized);
  43338. transport.unbind("open", onOpen);
  43339. transport.unbind("error", onError);
  43340. transport.unbind("closed", onClosed);
  43341. };
  43342. transport.bind("initialized", onInitialized);
  43343. transport.bind("open", onOpen);
  43344. transport.bind("error", onError);
  43345. transport.bind("closed", onClosed);
  43346. transport.initialize();
  43347. return {
  43348. abort: function () {
  43349. if (connected) {
  43350. return;
  43351. }
  43352. unbindListeners();
  43353. if (handshake) {
  43354. handshake.close();
  43355. }
  43356. else {
  43357. transport.close();
  43358. }
  43359. },
  43360. forceMinPriority: function (p) {
  43361. if (connected) {
  43362. return;
  43363. }
  43364. if (_this.priority < p) {
  43365. if (handshake) {
  43366. handshake.close();
  43367. }
  43368. else {
  43369. transport.close();
  43370. }
  43371. }
  43372. }
  43373. };
  43374. };
  43375. return TransportStrategy;
  43376. }());
  43377. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43378. function failAttempt(error, callback) {
  43379. util.defer(function () {
  43380. callback(error);
  43381. });
  43382. return {
  43383. abort: function () { },
  43384. forceMinPriority: function () { }
  43385. };
  43386. }
  43387. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43388. var strategy_builder_Transports = runtime.Transports;
  43389. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43390. var transportClass = strategy_builder_Transports[type];
  43391. if (!transportClass) {
  43392. throw new UnsupportedTransport(type);
  43393. }
  43394. var enabled = (!config.enabledTransports ||
  43395. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43396. (!config.disabledTransports ||
  43397. arrayIndexOf(config.disabledTransports, name) === -1);
  43398. var transport;
  43399. if (enabled) {
  43400. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43401. key: config.key,
  43402. useTLS: config.useTLS,
  43403. timeline: config.timeline,
  43404. ignoreNullOrigin: config.ignoreNullOrigin
  43405. }, options));
  43406. }
  43407. else {
  43408. transport = strategy_builder_UnsupportedStrategy;
  43409. }
  43410. return transport;
  43411. };
  43412. var strategy_builder_UnsupportedStrategy = {
  43413. isSupported: function () {
  43414. return false;
  43415. },
  43416. connect: function (_, callback) {
  43417. var deferred = util.defer(function () {
  43418. callback(new UnsupportedStrategy());
  43419. });
  43420. return {
  43421. abort: function () {
  43422. deferred.ensureAborted();
  43423. },
  43424. forceMinPriority: function () { }
  43425. };
  43426. }
  43427. };
  43428. // CONCATENATED MODULE: ./src/core/config.ts
  43429. var getGlobalConfig = function () {
  43430. return {
  43431. wsHost: defaults.host,
  43432. wsPort: defaults.ws_port,
  43433. wssPort: defaults.wss_port,
  43434. wsPath: defaults.ws_path,
  43435. httpHost: defaults.sockjs_host,
  43436. httpPort: defaults.sockjs_http_port,
  43437. httpsPort: defaults.sockjs_https_port,
  43438. httpPath: defaults.sockjs_path,
  43439. statsHost: defaults.stats_host,
  43440. authEndpoint: defaults.channel_auth_endpoint,
  43441. authTransport: defaults.channel_auth_transport,
  43442. activity_timeout: defaults.activity_timeout,
  43443. pong_timeout: defaults.pong_timeout,
  43444. unavailable_timeout: defaults.unavailable_timeout
  43445. };
  43446. };
  43447. var getClusterConfig = function (clusterName) {
  43448. return {
  43449. wsHost: 'ws-' + clusterName + '.pusher.com',
  43450. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43451. };
  43452. };
  43453. // CONCATENATED MODULE: ./src/core/pusher.ts
  43454. var pusher_Pusher = (function () {
  43455. function Pusher(app_key, options) {
  43456. var _this = this;
  43457. checkAppKey(app_key);
  43458. options = options || {};
  43459. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43460. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43461. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43462. }
  43463. this.key = app_key;
  43464. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43465. this.channels = factory.createChannels();
  43466. this.global_emitter = new dispatcher();
  43467. this.sessionID = Math.floor(Math.random() * 1000000000);
  43468. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43469. cluster: this.config.cluster,
  43470. features: Pusher.getClientFeatures(),
  43471. params: this.config.timelineParams || {},
  43472. limit: 50,
  43473. level: timeline_level.INFO,
  43474. version: defaults.VERSION
  43475. });
  43476. if (!this.config.disableStats) {
  43477. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43478. host: this.config.statsHost,
  43479. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43480. });
  43481. }
  43482. var getStrategy = function (options) {
  43483. var config = extend({}, _this.config, options);
  43484. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43485. };
  43486. this.connection = factory.createConnectionManager(this.key, extend({
  43487. getStrategy: getStrategy,
  43488. timeline: this.timeline,
  43489. activityTimeout: this.config.activity_timeout,
  43490. pongTimeout: this.config.pong_timeout,
  43491. unavailableTimeout: this.config.unavailable_timeout
  43492. }, this.config, { useTLS: this.shouldUseTLS() }));
  43493. this.connection.bind('connected', function () {
  43494. _this.subscribeAll();
  43495. if (_this.timelineSender) {
  43496. _this.timelineSender.send(_this.connection.isUsingTLS());
  43497. }
  43498. });
  43499. this.connection.bind('message', function (event) {
  43500. var eventName = event.event;
  43501. var internal = eventName.indexOf('pusher_internal:') === 0;
  43502. if (event.channel) {
  43503. var channel = _this.channel(event.channel);
  43504. if (channel) {
  43505. channel.handleEvent(event);
  43506. }
  43507. }
  43508. if (!internal) {
  43509. _this.global_emitter.emit(event.event, event.data);
  43510. }
  43511. });
  43512. this.connection.bind('connecting', function () {
  43513. _this.channels.disconnect();
  43514. });
  43515. this.connection.bind('disconnected', function () {
  43516. _this.channels.disconnect();
  43517. });
  43518. this.connection.bind('error', function (err) {
  43519. logger.warn(err);
  43520. });
  43521. Pusher.instances.push(this);
  43522. this.timeline.info({ instances: Pusher.instances.length });
  43523. if (Pusher.isReady) {
  43524. this.connect();
  43525. }
  43526. }
  43527. Pusher.ready = function () {
  43528. Pusher.isReady = true;
  43529. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43530. Pusher.instances[i].connect();
  43531. }
  43532. };
  43533. Pusher.getClientFeatures = function () {
  43534. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43535. return t.isSupported({});
  43536. }));
  43537. };
  43538. Pusher.prototype.channel = function (name) {
  43539. return this.channels.find(name);
  43540. };
  43541. Pusher.prototype.allChannels = function () {
  43542. return this.channels.all();
  43543. };
  43544. Pusher.prototype.connect = function () {
  43545. this.connection.connect();
  43546. if (this.timelineSender) {
  43547. if (!this.timelineSenderTimer) {
  43548. var usingTLS = this.connection.isUsingTLS();
  43549. var timelineSender = this.timelineSender;
  43550. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43551. timelineSender.send(usingTLS);
  43552. });
  43553. }
  43554. }
  43555. };
  43556. Pusher.prototype.disconnect = function () {
  43557. this.connection.disconnect();
  43558. if (this.timelineSenderTimer) {
  43559. this.timelineSenderTimer.ensureAborted();
  43560. this.timelineSenderTimer = null;
  43561. }
  43562. };
  43563. Pusher.prototype.bind = function (event_name, callback, context) {
  43564. this.global_emitter.bind(event_name, callback, context);
  43565. return this;
  43566. };
  43567. Pusher.prototype.unbind = function (event_name, callback, context) {
  43568. this.global_emitter.unbind(event_name, callback, context);
  43569. return this;
  43570. };
  43571. Pusher.prototype.bind_global = function (callback) {
  43572. this.global_emitter.bind_global(callback);
  43573. return this;
  43574. };
  43575. Pusher.prototype.unbind_global = function (callback) {
  43576. this.global_emitter.unbind_global(callback);
  43577. return this;
  43578. };
  43579. Pusher.prototype.unbind_all = function (callback) {
  43580. this.global_emitter.unbind_all();
  43581. return this;
  43582. };
  43583. Pusher.prototype.subscribeAll = function () {
  43584. var channelName;
  43585. for (channelName in this.channels.channels) {
  43586. if (this.channels.channels.hasOwnProperty(channelName)) {
  43587. this.subscribe(channelName);
  43588. }
  43589. }
  43590. };
  43591. Pusher.prototype.subscribe = function (channel_name) {
  43592. var channel = this.channels.add(channel_name, this);
  43593. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43594. channel.reinstateSubscription();
  43595. }
  43596. else if (!channel.subscriptionPending &&
  43597. this.connection.state === 'connected') {
  43598. channel.subscribe();
  43599. }
  43600. return channel;
  43601. };
  43602. Pusher.prototype.unsubscribe = function (channel_name) {
  43603. var channel = this.channels.find(channel_name);
  43604. if (channel && channel.subscriptionPending) {
  43605. channel.cancelSubscription();
  43606. }
  43607. else {
  43608. channel = this.channels.remove(channel_name);
  43609. if (channel && this.connection.state === 'connected') {
  43610. channel.unsubscribe();
  43611. }
  43612. }
  43613. };
  43614. Pusher.prototype.send_event = function (event_name, data, channel) {
  43615. return this.connection.send_event(event_name, data, channel);
  43616. };
  43617. Pusher.prototype.shouldUseTLS = function () {
  43618. if (runtime.getProtocol() === 'https:') {
  43619. return true;
  43620. }
  43621. else if (this.config.forceTLS === true) {
  43622. return true;
  43623. }
  43624. else {
  43625. return Boolean(this.config.encrypted);
  43626. }
  43627. };
  43628. Pusher.instances = [];
  43629. Pusher.isReady = false;
  43630. Pusher.logToConsole = false;
  43631. Pusher.Runtime = runtime;
  43632. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43633. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43634. Pusher.auth_callbacks = runtime.auth_callbacks;
  43635. return Pusher;
  43636. }());
  43637. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43638. function checkAppKey(key) {
  43639. if (key === null || key === undefined) {
  43640. throw 'You must pass your app key when you instantiate Pusher.';
  43641. }
  43642. }
  43643. runtime.setup(pusher_Pusher);
  43644. /***/ })
  43645. /******/ ]);
  43646. });
  43647. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43648. /***/ }),
  43649. /***/ "./node_modules/setimmediate/setImmediate.js":
  43650. /*!***************************************************!*\
  43651. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43652. \***************************************************/
  43653. /*! no static exports found */
  43654. /***/ (function(module, exports, __webpack_require__) {
  43655. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43656. "use strict";
  43657. if (global.setImmediate) {
  43658. return;
  43659. }
  43660. var nextHandle = 1; // Spec says greater than zero
  43661. var tasksByHandle = {};
  43662. var currentlyRunningATask = false;
  43663. var doc = global.document;
  43664. var registerImmediate;
  43665. function setImmediate(callback) {
  43666. // Callback can either be a function or a string
  43667. if (typeof callback !== "function") {
  43668. callback = new Function("" + callback);
  43669. }
  43670. // Copy function arguments
  43671. var args = new Array(arguments.length - 1);
  43672. for (var i = 0; i < args.length; i++) {
  43673. args[i] = arguments[i + 1];
  43674. }
  43675. // Store and register the task
  43676. var task = { callback: callback, args: args };
  43677. tasksByHandle[nextHandle] = task;
  43678. registerImmediate(nextHandle);
  43679. return nextHandle++;
  43680. }
  43681. function clearImmediate(handle) {
  43682. delete tasksByHandle[handle];
  43683. }
  43684. function run(task) {
  43685. var callback = task.callback;
  43686. var args = task.args;
  43687. switch (args.length) {
  43688. case 0:
  43689. callback();
  43690. break;
  43691. case 1:
  43692. callback(args[0]);
  43693. break;
  43694. case 2:
  43695. callback(args[0], args[1]);
  43696. break;
  43697. case 3:
  43698. callback(args[0], args[1], args[2]);
  43699. break;
  43700. default:
  43701. callback.apply(undefined, args);
  43702. break;
  43703. }
  43704. }
  43705. function runIfPresent(handle) {
  43706. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43707. // So if we're currently running a task, we'll need to delay this invocation.
  43708. if (currentlyRunningATask) {
  43709. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43710. // "too much recursion" error.
  43711. setTimeout(runIfPresent, 0, handle);
  43712. } else {
  43713. var task = tasksByHandle[handle];
  43714. if (task) {
  43715. currentlyRunningATask = true;
  43716. try {
  43717. run(task);
  43718. } finally {
  43719. clearImmediate(handle);
  43720. currentlyRunningATask = false;
  43721. }
  43722. }
  43723. }
  43724. }
  43725. function installNextTickImplementation() {
  43726. registerImmediate = function(handle) {
  43727. process.nextTick(function () { runIfPresent(handle); });
  43728. };
  43729. }
  43730. function canUsePostMessage() {
  43731. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43732. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43733. if (global.postMessage && !global.importScripts) {
  43734. var postMessageIsAsynchronous = true;
  43735. var oldOnMessage = global.onmessage;
  43736. global.onmessage = function() {
  43737. postMessageIsAsynchronous = false;
  43738. };
  43739. global.postMessage("", "*");
  43740. global.onmessage = oldOnMessage;
  43741. return postMessageIsAsynchronous;
  43742. }
  43743. }
  43744. function installPostMessageImplementation() {
  43745. // Installs an event handler on `global` for the `message` event: see
  43746. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43747. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43748. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43749. var onGlobalMessage = function(event) {
  43750. if (event.source === global &&
  43751. typeof event.data === "string" &&
  43752. event.data.indexOf(messagePrefix) === 0) {
  43753. runIfPresent(+event.data.slice(messagePrefix.length));
  43754. }
  43755. };
  43756. if (global.addEventListener) {
  43757. global.addEventListener("message", onGlobalMessage, false);
  43758. } else {
  43759. global.attachEvent("onmessage", onGlobalMessage);
  43760. }
  43761. registerImmediate = function(handle) {
  43762. global.postMessage(messagePrefix + handle, "*");
  43763. };
  43764. }
  43765. function installMessageChannelImplementation() {
  43766. var channel = new MessageChannel();
  43767. channel.port1.onmessage = function(event) {
  43768. var handle = event.data;
  43769. runIfPresent(handle);
  43770. };
  43771. registerImmediate = function(handle) {
  43772. channel.port2.postMessage(handle);
  43773. };
  43774. }
  43775. function installReadyStateChangeImplementation() {
  43776. var html = doc.documentElement;
  43777. registerImmediate = function(handle) {
  43778. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43779. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43780. var script = doc.createElement("script");
  43781. script.onreadystatechange = function () {
  43782. runIfPresent(handle);
  43783. script.onreadystatechange = null;
  43784. html.removeChild(script);
  43785. script = null;
  43786. };
  43787. html.appendChild(script);
  43788. };
  43789. }
  43790. function installSetTimeoutImplementation() {
  43791. registerImmediate = function(handle) {
  43792. setTimeout(runIfPresent, 0, handle);
  43793. };
  43794. }
  43795. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43796. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43797. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43798. // Don't get fooled by e.g. browserify environments.
  43799. if ({}.toString.call(global.process) === "[object process]") {
  43800. // For Node.js before 0.9
  43801. installNextTickImplementation();
  43802. } else if (canUsePostMessage()) {
  43803. // For non-IE10 modern browsers
  43804. installPostMessageImplementation();
  43805. } else if (global.MessageChannel) {
  43806. // For web workers, where supported
  43807. installMessageChannelImplementation();
  43808. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43809. // For IE 6–8
  43810. installReadyStateChangeImplementation();
  43811. } else {
  43812. // For older browsers
  43813. installSetTimeoutImplementation();
  43814. }
  43815. attachTo.setImmediate = setImmediate;
  43816. attachTo.clearImmediate = clearImmediate;
  43817. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43818. /* 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")))
  43819. /***/ }),
  43820. /***/ "./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&":
  43821. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43822. !*** ./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& ***!
  43823. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43824. /*! no static exports found */
  43825. /***/ (function(module, exports, __webpack_require__) {
  43826. 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&");
  43827. if(typeof content === 'string') content = [[module.i, content, '']];
  43828. var transform;
  43829. var insertInto;
  43830. var options = {"hmr":true}
  43831. options.transform = transform
  43832. options.insertInto = undefined;
  43833. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43834. if(content.locals) module.exports = content.locals;
  43835. if(false) {}
  43836. /***/ }),
  43837. /***/ "./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&":
  43838. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43839. !*** ./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& ***!
  43840. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43841. /*! no static exports found */
  43842. /***/ (function(module, exports, __webpack_require__) {
  43843. 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&");
  43844. if(typeof content === 'string') content = [[module.i, content, '']];
  43845. var transform;
  43846. var insertInto;
  43847. var options = {"hmr":true}
  43848. options.transform = transform
  43849. options.insertInto = undefined;
  43850. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43851. if(content.locals) module.exports = content.locals;
  43852. if(false) {}
  43853. /***/ }),
  43854. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43855. /*!****************************************************!*\
  43856. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43857. \****************************************************/
  43858. /*! no static exports found */
  43859. /***/ (function(module, exports, __webpack_require__) {
  43860. /*
  43861. MIT License http://www.opensource.org/licenses/mit-license.php
  43862. Author Tobias Koppers @sokra
  43863. */
  43864. var stylesInDom = {};
  43865. var memoize = function (fn) {
  43866. var memo;
  43867. return function () {
  43868. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43869. return memo;
  43870. };
  43871. };
  43872. var isOldIE = memoize(function () {
  43873. // Test for IE <= 9 as proposed by Browserhacks
  43874. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43875. // Tests for existence of standard globals is to allow style-loader
  43876. // to operate correctly into non-standard environments
  43877. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43878. return window && document && document.all && !window.atob;
  43879. });
  43880. var getTarget = function (target, parent) {
  43881. if (parent){
  43882. return parent.querySelector(target);
  43883. }
  43884. return document.querySelector(target);
  43885. };
  43886. var getElement = (function (fn) {
  43887. var memo = {};
  43888. return function(target, parent) {
  43889. // If passing function in options, then use it for resolve "head" element.
  43890. // Useful for Shadow Root style i.e
  43891. // {
  43892. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43893. // }
  43894. if (typeof target === 'function') {
  43895. return target();
  43896. }
  43897. if (typeof memo[target] === "undefined") {
  43898. var styleTarget = getTarget.call(this, target, parent);
  43899. // Special case to return head of iframe instead of iframe itself
  43900. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43901. try {
  43902. // This will throw an exception if access to iframe is blocked
  43903. // due to cross-origin restrictions
  43904. styleTarget = styleTarget.contentDocument.head;
  43905. } catch(e) {
  43906. styleTarget = null;
  43907. }
  43908. }
  43909. memo[target] = styleTarget;
  43910. }
  43911. return memo[target]
  43912. };
  43913. })();
  43914. var singleton = null;
  43915. var singletonCounter = 0;
  43916. var stylesInsertedAtTop = [];
  43917. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43918. module.exports = function(list, options) {
  43919. if (typeof DEBUG !== "undefined" && DEBUG) {
  43920. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43921. }
  43922. options = options || {};
  43923. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43924. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43925. // tags it will allow on a page
  43926. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43927. // By default, add <style> tags to the <head> element
  43928. if (!options.insertInto) options.insertInto = "head";
  43929. // By default, add <style> tags to the bottom of the target
  43930. if (!options.insertAt) options.insertAt = "bottom";
  43931. var styles = listToStyles(list, options);
  43932. addStylesToDom(styles, options);
  43933. return function update (newList) {
  43934. var mayRemove = [];
  43935. for (var i = 0; i < styles.length; i++) {
  43936. var item = styles[i];
  43937. var domStyle = stylesInDom[item.id];
  43938. domStyle.refs--;
  43939. mayRemove.push(domStyle);
  43940. }
  43941. if(newList) {
  43942. var newStyles = listToStyles(newList, options);
  43943. addStylesToDom(newStyles, options);
  43944. }
  43945. for (var i = 0; i < mayRemove.length; i++) {
  43946. var domStyle = mayRemove[i];
  43947. if(domStyle.refs === 0) {
  43948. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43949. delete stylesInDom[domStyle.id];
  43950. }
  43951. }
  43952. };
  43953. };
  43954. function addStylesToDom (styles, options) {
  43955. for (var i = 0; i < styles.length; i++) {
  43956. var item = styles[i];
  43957. var domStyle = stylesInDom[item.id];
  43958. if(domStyle) {
  43959. domStyle.refs++;
  43960. for(var j = 0; j < domStyle.parts.length; j++) {
  43961. domStyle.parts[j](item.parts[j]);
  43962. }
  43963. for(; j < item.parts.length; j++) {
  43964. domStyle.parts.push(addStyle(item.parts[j], options));
  43965. }
  43966. } else {
  43967. var parts = [];
  43968. for(var j = 0; j < item.parts.length; j++) {
  43969. parts.push(addStyle(item.parts[j], options));
  43970. }
  43971. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43972. }
  43973. }
  43974. }
  43975. function listToStyles (list, options) {
  43976. var styles = [];
  43977. var newStyles = {};
  43978. for (var i = 0; i < list.length; i++) {
  43979. var item = list[i];
  43980. var id = options.base ? item[0] + options.base : item[0];
  43981. var css = item[1];
  43982. var media = item[2];
  43983. var sourceMap = item[3];
  43984. var part = {css: css, media: media, sourceMap: sourceMap};
  43985. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43986. else newStyles[id].parts.push(part);
  43987. }
  43988. return styles;
  43989. }
  43990. function insertStyleElement (options, style) {
  43991. var target = getElement(options.insertInto)
  43992. if (!target) {
  43993. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43994. }
  43995. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43996. if (options.insertAt === "top") {
  43997. if (!lastStyleElementInsertedAtTop) {
  43998. target.insertBefore(style, target.firstChild);
  43999. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  44000. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  44001. } else {
  44002. target.appendChild(style);
  44003. }
  44004. stylesInsertedAtTop.push(style);
  44005. } else if (options.insertAt === "bottom") {
  44006. target.appendChild(style);
  44007. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  44008. var nextSibling = getElement(options.insertAt.before, target);
  44009. target.insertBefore(style, nextSibling);
  44010. } else {
  44011. 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");
  44012. }
  44013. }
  44014. function removeStyleElement (style) {
  44015. if (style.parentNode === null) return false;
  44016. style.parentNode.removeChild(style);
  44017. var idx = stylesInsertedAtTop.indexOf(style);
  44018. if(idx >= 0) {
  44019. stylesInsertedAtTop.splice(idx, 1);
  44020. }
  44021. }
  44022. function createStyleElement (options) {
  44023. var style = document.createElement("style");
  44024. if(options.attrs.type === undefined) {
  44025. options.attrs.type = "text/css";
  44026. }
  44027. if(options.attrs.nonce === undefined) {
  44028. var nonce = getNonce();
  44029. if (nonce) {
  44030. options.attrs.nonce = nonce;
  44031. }
  44032. }
  44033. addAttrs(style, options.attrs);
  44034. insertStyleElement(options, style);
  44035. return style;
  44036. }
  44037. function createLinkElement (options) {
  44038. var link = document.createElement("link");
  44039. if(options.attrs.type === undefined) {
  44040. options.attrs.type = "text/css";
  44041. }
  44042. options.attrs.rel = "stylesheet";
  44043. addAttrs(link, options.attrs);
  44044. insertStyleElement(options, link);
  44045. return link;
  44046. }
  44047. function addAttrs (el, attrs) {
  44048. Object.keys(attrs).forEach(function (key) {
  44049. el.setAttribute(key, attrs[key]);
  44050. });
  44051. }
  44052. function getNonce() {
  44053. if (false) {}
  44054. return __webpack_require__.nc;
  44055. }
  44056. function addStyle (obj, options) {
  44057. var style, update, remove, result;
  44058. // If a transform function was defined, run it on the css
  44059. if (options.transform && obj.css) {
  44060. result = typeof options.transform === 'function'
  44061. ? options.transform(obj.css)
  44062. : options.transform.default(obj.css);
  44063. if (result) {
  44064. // If transform returns a value, use that instead of the original css.
  44065. // This allows running runtime transformations on the css.
  44066. obj.css = result;
  44067. } else {
  44068. // If the transform function returns a falsy value, don't add this css.
  44069. // This allows conditional loading of css
  44070. return function() {
  44071. // noop
  44072. };
  44073. }
  44074. }
  44075. if (options.singleton) {
  44076. var styleIndex = singletonCounter++;
  44077. style = singleton || (singleton = createStyleElement(options));
  44078. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44079. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44080. } else if (
  44081. obj.sourceMap &&
  44082. typeof URL === "function" &&
  44083. typeof URL.createObjectURL === "function" &&
  44084. typeof URL.revokeObjectURL === "function" &&
  44085. typeof Blob === "function" &&
  44086. typeof btoa === "function"
  44087. ) {
  44088. style = createLinkElement(options);
  44089. update = updateLink.bind(null, style, options);
  44090. remove = function () {
  44091. removeStyleElement(style);
  44092. if(style.href) URL.revokeObjectURL(style.href);
  44093. };
  44094. } else {
  44095. style = createStyleElement(options);
  44096. update = applyToTag.bind(null, style);
  44097. remove = function () {
  44098. removeStyleElement(style);
  44099. };
  44100. }
  44101. update(obj);
  44102. return function updateStyle (newObj) {
  44103. if (newObj) {
  44104. if (
  44105. newObj.css === obj.css &&
  44106. newObj.media === obj.media &&
  44107. newObj.sourceMap === obj.sourceMap
  44108. ) {
  44109. return;
  44110. }
  44111. update(obj = newObj);
  44112. } else {
  44113. remove();
  44114. }
  44115. };
  44116. }
  44117. var replaceText = (function () {
  44118. var textStore = [];
  44119. return function (index, replacement) {
  44120. textStore[index] = replacement;
  44121. return textStore.filter(Boolean).join('\n');
  44122. };
  44123. })();
  44124. function applyToSingletonTag (style, index, remove, obj) {
  44125. var css = remove ? "" : obj.css;
  44126. if (style.styleSheet) {
  44127. style.styleSheet.cssText = replaceText(index, css);
  44128. } else {
  44129. var cssNode = document.createTextNode(css);
  44130. var childNodes = style.childNodes;
  44131. if (childNodes[index]) style.removeChild(childNodes[index]);
  44132. if (childNodes.length) {
  44133. style.insertBefore(cssNode, childNodes[index]);
  44134. } else {
  44135. style.appendChild(cssNode);
  44136. }
  44137. }
  44138. }
  44139. function applyToTag (style, obj) {
  44140. var css = obj.css;
  44141. var media = obj.media;
  44142. if(media) {
  44143. style.setAttribute("media", media)
  44144. }
  44145. if(style.styleSheet) {
  44146. style.styleSheet.cssText = css;
  44147. } else {
  44148. while(style.firstChild) {
  44149. style.removeChild(style.firstChild);
  44150. }
  44151. style.appendChild(document.createTextNode(css));
  44152. }
  44153. }
  44154. function updateLink (link, options, obj) {
  44155. var css = obj.css;
  44156. var sourceMap = obj.sourceMap;
  44157. /*
  44158. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44159. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44160. on by default. Otherwise default to the convertToAbsoluteUrls option
  44161. directly
  44162. */
  44163. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44164. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44165. css = fixUrls(css);
  44166. }
  44167. if (sourceMap) {
  44168. // http://stackoverflow.com/a/26603875
  44169. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44170. }
  44171. var blob = new Blob([css], { type: "text/css" });
  44172. var oldSrc = link.href;
  44173. link.href = URL.createObjectURL(blob);
  44174. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44175. }
  44176. /***/ }),
  44177. /***/ "./node_modules/style-loader/lib/urls.js":
  44178. /*!***********************************************!*\
  44179. !*** ./node_modules/style-loader/lib/urls.js ***!
  44180. \***********************************************/
  44181. /*! no static exports found */
  44182. /***/ (function(module, exports) {
  44183. /**
  44184. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44185. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44186. * bundle instead of the current page.
  44187. *
  44188. * One solution is to only use full urls, but that may be impossible.
  44189. *
  44190. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44191. *
  44192. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44193. *
  44194. */
  44195. module.exports = function (css) {
  44196. // get current location
  44197. var location = typeof window !== "undefined" && window.location;
  44198. if (!location) {
  44199. throw new Error("fixUrls requires window.location");
  44200. }
  44201. // blank or null?
  44202. if (!css || typeof css !== "string") {
  44203. return css;
  44204. }
  44205. var baseUrl = location.protocol + "//" + location.host;
  44206. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44207. // convert each url(...)
  44208. /*
  44209. This regular expression is just a way to recursively match brackets within
  44210. a string.
  44211. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44212. ( = Start a capturing group
  44213. (?: = Start a non-capturing group
  44214. [^)(] = Match anything that isn't a parentheses
  44215. | = OR
  44216. \( = Match a start parentheses
  44217. (?: = Start another non-capturing groups
  44218. [^)(]+ = Match anything that isn't a parentheses
  44219. | = OR
  44220. \( = Match a start parentheses
  44221. [^)(]* = Match anything that isn't a parentheses
  44222. \) = Match a end parentheses
  44223. ) = End Group
  44224. *\) = Match anything and then a close parens
  44225. ) = Close non-capturing group
  44226. * = Match anything
  44227. ) = Close capturing group
  44228. \) = Match a close parens
  44229. /gi = Get all matches, not the first. Be case insensitive.
  44230. */
  44231. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44232. // strip quotes (if they exist)
  44233. var unquotedOrigUrl = origUrl
  44234. .trim()
  44235. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44236. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44237. // already a full url? no change
  44238. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44239. return fullMatch;
  44240. }
  44241. // convert the url to a full url
  44242. var newUrl;
  44243. if (unquotedOrigUrl.indexOf("//") === 0) {
  44244. //TODO: should we add protocol?
  44245. newUrl = unquotedOrigUrl;
  44246. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44247. // path should be relative to the base url
  44248. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44249. } else {
  44250. // path should be relative to current directory
  44251. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44252. }
  44253. // send back the fixed url(...)
  44254. return "url(" + JSON.stringify(newUrl) + ")";
  44255. });
  44256. // send back the fixed css
  44257. return fixedCss;
  44258. };
  44259. /***/ }),
  44260. /***/ "./node_modules/timers-browserify/main.js":
  44261. /*!************************************************!*\
  44262. !*** ./node_modules/timers-browserify/main.js ***!
  44263. \************************************************/
  44264. /*! no static exports found */
  44265. /***/ (function(module, exports, __webpack_require__) {
  44266. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44267. (typeof self !== "undefined" && self) ||
  44268. window;
  44269. var apply = Function.prototype.apply;
  44270. // DOM APIs, for completeness
  44271. exports.setTimeout = function() {
  44272. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44273. };
  44274. exports.setInterval = function() {
  44275. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44276. };
  44277. exports.clearTimeout =
  44278. exports.clearInterval = function(timeout) {
  44279. if (timeout) {
  44280. timeout.close();
  44281. }
  44282. };
  44283. function Timeout(id, clearFn) {
  44284. this._id = id;
  44285. this._clearFn = clearFn;
  44286. }
  44287. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44288. Timeout.prototype.close = function() {
  44289. this._clearFn.call(scope, this._id);
  44290. };
  44291. // Does not start the time, just sets up the members needed.
  44292. exports.enroll = function(item, msecs) {
  44293. clearTimeout(item._idleTimeoutId);
  44294. item._idleTimeout = msecs;
  44295. };
  44296. exports.unenroll = function(item) {
  44297. clearTimeout(item._idleTimeoutId);
  44298. item._idleTimeout = -1;
  44299. };
  44300. exports._unrefActive = exports.active = function(item) {
  44301. clearTimeout(item._idleTimeoutId);
  44302. var msecs = item._idleTimeout;
  44303. if (msecs >= 0) {
  44304. item._idleTimeoutId = setTimeout(function onTimeout() {
  44305. if (item._onTimeout)
  44306. item._onTimeout();
  44307. }, msecs);
  44308. }
  44309. };
  44310. // setimmediate attaches itself to the global object
  44311. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44312. // On some exotic environments, it's not clear which object `setimmediate` was
  44313. // able to install onto. Search each possibility in the same order as the
  44314. // `setimmediate` library.
  44315. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44316. (typeof global !== "undefined" && global.setImmediate) ||
  44317. (this && this.setImmediate);
  44318. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44319. (typeof global !== "undefined" && global.clearImmediate) ||
  44320. (this && this.clearImmediate);
  44321. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44322. /***/ }),
  44323. /***/ "./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&":
  44324. /*!************************************************************************************************************************************************************************************************************!*\
  44325. !*** ./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& ***!
  44326. \************************************************************************************************************************************************************************************************************/
  44327. /*! exports provided: render, staticRenderFns */
  44328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44329. "use strict";
  44330. __webpack_require__.r(__webpack_exports__);
  44331. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44332. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44333. var render = function() {
  44334. var _vm = this
  44335. var _h = _vm.$createElement
  44336. var _c = _vm._self._c || _h
  44337. return _c(
  44338. "div",
  44339. [
  44340. _c("asset-info-edit-modal", {
  44341. attrs: {
  44342. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44343. "populate-with": _vm.asset
  44344. }
  44345. }),
  44346. _vm._v(" "),
  44347. _c("h4", { staticClass: "text-center" }, [
  44348. _vm._v(
  44349. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44350. ),
  44351. _c("small", { staticClass: "text-muted" }, [
  44352. _vm._v(_vm._s(this.asset.pcnickname))
  44353. ])
  44354. ]),
  44355. _vm._v(" "),
  44356. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44357. _vm._v(" "),
  44358. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44359. _vm._v(" "),
  44360. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44361. _vm._v(" "),
  44362. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44363. _vm._v(" "),
  44364. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44365. _vm._v(" "),
  44366. _c(
  44367. "button",
  44368. {
  44369. staticClass: "btn btn-primary",
  44370. attrs: {
  44371. type: "button",
  44372. "data-toggle": "modal",
  44373. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44374. }
  44375. },
  44376. [_vm._v("Edit")]
  44377. )
  44378. ],
  44379. 1
  44380. )
  44381. }
  44382. var staticRenderFns = []
  44383. render._withStripped = true
  44384. /***/ }),
  44385. /***/ "./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&":
  44386. /*!*********************************************************************************************************************************************************************************************************************!*\
  44387. !*** ./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& ***!
  44388. \*********************************************************************************************************************************************************************************************************************/
  44389. /*! exports provided: render, staticRenderFns */
  44390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44391. "use strict";
  44392. __webpack_require__.r(__webpack_exports__);
  44393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44395. var render = function() {
  44396. var _vm = this
  44397. var _h = _vm.$createElement
  44398. var _c = _vm._self._c || _h
  44399. return _c(
  44400. "modal",
  44401. {
  44402. attrs: {
  44403. id: _vm.modalId,
  44404. tabindex: "-1",
  44405. role: "dialog",
  44406. "aria-labelledby": _vm.modalId + "Label"
  44407. }
  44408. },
  44409. [
  44410. _c(
  44411. "h5",
  44412. {
  44413. staticClass: "modal-title",
  44414. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44415. slot: "header"
  44416. },
  44417. [_vm._v("\n Edit Work Order Information\n ")]
  44418. ),
  44419. _vm._v(" "),
  44420. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44421. _c("div", { staticClass: "form-group" }, [
  44422. _c("label", { attrs: { for: "manufacturer" } }, [
  44423. _vm._v("Manufacturer")
  44424. ]),
  44425. _vm._v(" "),
  44426. _c("input", {
  44427. directives: [
  44428. {
  44429. name: "model",
  44430. rawName: "v-model",
  44431. value: _vm.asset.pcmanu,
  44432. expression: "asset.pcmanu"
  44433. }
  44434. ],
  44435. staticClass: "form-control",
  44436. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44437. domProps: { value: _vm.asset.pcmanu },
  44438. on: {
  44439. input: function($event) {
  44440. if ($event.target.composing) {
  44441. return
  44442. }
  44443. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44444. }
  44445. }
  44446. })
  44447. ]),
  44448. _vm._v(" "),
  44449. _c("div", { staticClass: "form-group" }, [
  44450. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44451. _vm._v(" "),
  44452. _c("input", {
  44453. directives: [
  44454. {
  44455. name: "model",
  44456. rawName: "v-model",
  44457. value: _vm.asset.pcmake,
  44458. expression: "asset.pcmake"
  44459. }
  44460. ],
  44461. staticClass: "form-control",
  44462. attrs: { type: "text", name: "make", id: "make" },
  44463. domProps: { value: _vm.asset.pcmake },
  44464. on: {
  44465. input: function($event) {
  44466. if ($event.target.composing) {
  44467. return
  44468. }
  44469. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44470. }
  44471. }
  44472. })
  44473. ]),
  44474. _vm._v(" "),
  44475. _c("div", { staticClass: "form-group" }, [
  44476. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44477. _vm._v(" "),
  44478. _c("input", {
  44479. directives: [
  44480. {
  44481. name: "model",
  44482. rawName: "v-model",
  44483. value: _vm.asset.pcnickname,
  44484. expression: "asset.pcnickname"
  44485. }
  44486. ],
  44487. staticClass: "form-control",
  44488. attrs: { type: "text", name: "nickname", id: "nickname" },
  44489. domProps: { value: _vm.asset.pcnickname },
  44490. on: {
  44491. input: function($event) {
  44492. if ($event.target.composing) {
  44493. return
  44494. }
  44495. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44496. }
  44497. }
  44498. })
  44499. ]),
  44500. _vm._v(" "),
  44501. _c("div", { staticClass: "form-group" }, [
  44502. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44503. _vm._v(" "),
  44504. _c("input", {
  44505. directives: [
  44506. {
  44507. name: "model",
  44508. rawName: "v-model",
  44509. value: _vm.asset.pcextra[2],
  44510. expression: "asset.pcextra[2]"
  44511. }
  44512. ],
  44513. staticClass: "form-control",
  44514. attrs: { type: "text", name: "os", id: "os" },
  44515. domProps: { value: _vm.asset.pcextra[2] },
  44516. on: {
  44517. input: function($event) {
  44518. if ($event.target.composing) {
  44519. return
  44520. }
  44521. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44522. }
  44523. }
  44524. })
  44525. ]),
  44526. _vm._v(" "),
  44527. _c("div", { staticClass: "form-group" }, [
  44528. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44529. _vm._v(" "),
  44530. _c("input", {
  44531. directives: [
  44532. {
  44533. name: "model",
  44534. rawName: "v-model",
  44535. value: _vm.asset.pcextra[104],
  44536. expression: "asset.pcextra[104]"
  44537. }
  44538. ],
  44539. staticClass: "form-control",
  44540. attrs: { type: "text", id: "serial", name: "serial" },
  44541. domProps: { value: _vm.asset.pcextra[104] },
  44542. on: {
  44543. input: function($event) {
  44544. if ($event.target.composing) {
  44545. return
  44546. }
  44547. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44548. }
  44549. }
  44550. })
  44551. ]),
  44552. _vm._v(" "),
  44553. _c("div", { staticClass: "form-group" }, [
  44554. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44555. _vm._v(" "),
  44556. _c("input", {
  44557. directives: [
  44558. {
  44559. name: "model",
  44560. rawName: "v-model",
  44561. value: _vm.asset.pcextra[101],
  44562. expression: "asset.pcextra[101]"
  44563. }
  44564. ],
  44565. staticClass: "form-control",
  44566. attrs: { type: "text", id: "cpu", name: "cpu" },
  44567. domProps: { value: _vm.asset.pcextra[101] },
  44568. on: {
  44569. input: function($event) {
  44570. if ($event.target.composing) {
  44571. return
  44572. }
  44573. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44574. }
  44575. }
  44576. })
  44577. ]),
  44578. _vm._v(" "),
  44579. _c("div", { staticClass: "form-group" }, [
  44580. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44581. _vm._v(" "),
  44582. _c("input", {
  44583. directives: [
  44584. {
  44585. name: "model",
  44586. rawName: "v-model",
  44587. value: _vm.asset.pcextra[100],
  44588. expression: "asset.pcextra[100]"
  44589. }
  44590. ],
  44591. staticClass: "form-control",
  44592. attrs: { type: "text", name: "ram", id: "ram" },
  44593. domProps: { value: _vm.asset.pcextra[100] },
  44594. on: {
  44595. input: function($event) {
  44596. if ($event.target.composing) {
  44597. return
  44598. }
  44599. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44600. }
  44601. }
  44602. })
  44603. ]),
  44604. _vm._v(" "),
  44605. _c("div", { staticClass: "form-group" }, [
  44606. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44607. _vm._v(" "),
  44608. _c("input", {
  44609. directives: [
  44610. {
  44611. name: "model",
  44612. rawName: "v-model",
  44613. value: _vm.asset.pcextra[4],
  44614. expression: "asset.pcextra[4]"
  44615. }
  44616. ],
  44617. staticClass: "form-control",
  44618. attrs: { type: "text", name: "graphics", id: "grapics" },
  44619. domProps: { value: _vm.asset.pcextra[4] },
  44620. on: {
  44621. input: function($event) {
  44622. if ($event.target.composing) {
  44623. return
  44624. }
  44625. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44626. }
  44627. }
  44628. })
  44629. ])
  44630. ]),
  44631. _vm._v(" "),
  44632. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44633. _c(
  44634. "button",
  44635. {
  44636. staticClass: "btn btn-secondary",
  44637. attrs: { type: "button", "data-dismiss": "modal" }
  44638. },
  44639. [_vm._v("Close")]
  44640. ),
  44641. _vm._v(" "),
  44642. _c(
  44643. "button",
  44644. {
  44645. staticClass: "btn btn-primary",
  44646. attrs: { type: "button" },
  44647. on: {
  44648. click: function($event) {
  44649. return _vm.updateAsset()
  44650. }
  44651. }
  44652. },
  44653. [
  44654. !_vm.assetSaving
  44655. ? _c("div", [_vm._v("Save")])
  44656. : _c("circle-spinner", { attrs: { size: 2 } })
  44657. ],
  44658. 1
  44659. )
  44660. ])
  44661. ]
  44662. )
  44663. }
  44664. var staticRenderFns = []
  44665. render._withStripped = true
  44666. /***/ }),
  44667. /***/ "./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&":
  44668. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44669. !*** ./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& ***!
  44670. \*****************************************************************************************************************************************************************************************************************************/
  44671. /*! exports provided: render, staticRenderFns */
  44672. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44673. "use strict";
  44674. __webpack_require__.r(__webpack_exports__);
  44675. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44677. var render = function() {
  44678. var _vm = this
  44679. var _h = _vm.$createElement
  44680. var _c = _vm._self._c || _h
  44681. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44682. _c("div", { staticClass: "input-group" }, [
  44683. _c("input", {
  44684. directives: [
  44685. {
  44686. name: "model",
  44687. rawName: "v-model",
  44688. value: _vm.searchText,
  44689. expression: "searchText"
  44690. }
  44691. ],
  44692. staticClass: "form-control",
  44693. attrs: { type: "text" },
  44694. domProps: { value: _vm.searchText },
  44695. on: {
  44696. input: [
  44697. function($event) {
  44698. if ($event.target.composing) {
  44699. return
  44700. }
  44701. _vm.searchText = $event.target.value
  44702. },
  44703. _vm.searchChanged
  44704. ]
  44705. }
  44706. }),
  44707. _vm._v(" "),
  44708. _c("div", { staticClass: "form-group-append" }, [
  44709. _c(
  44710. "a",
  44711. {
  44712. staticClass: "toggle input-group-text bg-primary text-light",
  44713. on: {
  44714. mousedown: function($event) {
  44715. $event.preventDefault()
  44716. },
  44717. click: function($event) {
  44718. return _vm.setOpen(!_vm.open)
  44719. }
  44720. }
  44721. },
  44722. [
  44723. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44724. _vm._v(" "),
  44725. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44726. ]
  44727. )
  44728. ])
  44729. ]),
  44730. _vm._v(" "),
  44731. _c(
  44732. "ul",
  44733. { staticClass: "suggestion-list list-unstyled" },
  44734. _vm._l(_vm.matches, function(suggestion, index) {
  44735. return _c(
  44736. "li",
  44737. {
  44738. key: index,
  44739. on: {
  44740. mousedown: function($event) {
  44741. $event.preventDefault()
  44742. },
  44743. click: function($event) {
  44744. return _vm.suggestionSelected(suggestion)
  44745. }
  44746. }
  44747. },
  44748. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44749. )
  44750. }),
  44751. 0
  44752. )
  44753. ])
  44754. }
  44755. var staticRenderFns = []
  44756. render._withStripped = true
  44757. /***/ }),
  44758. /***/ "./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&":
  44759. /*!****************************************************************************************************************************************************************************************************************************!*\
  44760. !*** ./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& ***!
  44761. \****************************************************************************************************************************************************************************************************************************/
  44762. /*! exports provided: render, staticRenderFns */
  44763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44764. "use strict";
  44765. __webpack_require__.r(__webpack_exports__);
  44766. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44767. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44768. var render = function() {
  44769. var _vm = this
  44770. var _h = _vm.$createElement
  44771. var _c = _vm._self._c || _h
  44772. return _c(
  44773. "div",
  44774. {
  44775. staticClass: "loader",
  44776. style: {
  44777. fontSize: _vm.size + "px",
  44778. borderLeft: "1.1em solid " + _vm.color
  44779. }
  44780. },
  44781. [_vm._v("Loading...")]
  44782. )
  44783. }
  44784. var staticRenderFns = []
  44785. render._withStripped = true
  44786. /***/ }),
  44787. /***/ "./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&":
  44788. /*!*************************************************************************************************************************************************************************************************************!*\
  44789. !*** ./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& ***!
  44790. \*************************************************************************************************************************************************************************************************************/
  44791. /*! exports provided: render, staticRenderFns */
  44792. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44793. "use strict";
  44794. __webpack_require__.r(__webpack_exports__);
  44795. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44796. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44797. var render = function() {
  44798. var _vm = this
  44799. var _h = _vm.$createElement
  44800. var _c = _vm._self._c || _h
  44801. return _c(
  44802. "div",
  44803. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44804. [
  44805. _c("credential-form-modal", {
  44806. attrs: {
  44807. descriptions: _vm.creddescList,
  44808. "modal-id": "credential" + this.data.credid + "editModal",
  44809. populateWith: this.data
  44810. }
  44811. }),
  44812. _vm._v(" "),
  44813. _c(
  44814. "modal",
  44815. {
  44816. attrs: {
  44817. id: "credential" + this.data.credid + "deleteModal",
  44818. tabindex: "-1"
  44819. }
  44820. },
  44821. [
  44822. _c(
  44823. "h5",
  44824. {
  44825. staticClass: "modal-title",
  44826. attrs: {
  44827. slot: "header",
  44828. id: "credential" + this.data.credid + "deleteModalLabel"
  44829. },
  44830. slot: "header"
  44831. },
  44832. [_vm._v("\r\n Delete Credential\r\n ")]
  44833. ),
  44834. _vm._v(" "),
  44835. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44836. _vm._v("\r\n Are you sure?\r\n ")
  44837. ]),
  44838. _vm._v(" "),
  44839. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44840. _c(
  44841. "button",
  44842. {
  44843. staticClass: "btn btn-secondary",
  44844. attrs: { type: "button", "data-dismiss": "modal" }
  44845. },
  44846. [_vm._v("Cancel")]
  44847. ),
  44848. _vm._v(" "),
  44849. _c(
  44850. "button",
  44851. {
  44852. staticClass: "btn btn-danger",
  44853. attrs: { type: "button" },
  44854. on: {
  44855. click: function($event) {
  44856. return _vm.deleteCredential()
  44857. }
  44858. }
  44859. },
  44860. [_vm._v("Confirm")]
  44861. )
  44862. ])
  44863. ]
  44864. ),
  44865. _vm._v(" "),
  44866. _c("div", { staticClass: "row no-gutters" }, [
  44867. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44868. _vm._v(_vm._s(this.data.creddesc))
  44869. ]),
  44870. _vm._v(" "),
  44871. _c("div", { staticClass: "col-9 text-right" }, [
  44872. _vm._v(_vm._s(this.data.creddate))
  44873. ])
  44874. ]),
  44875. _vm._v(" "),
  44876. _c("div", { staticClass: "row" }, [
  44877. _c("div", { staticClass: "col-lg-9" }, [
  44878. _c("div", [
  44879. _vm._m(0),
  44880. _vm._v(" "),
  44881. _c("input", {
  44882. staticClass: "border-0 credential",
  44883. attrs: {
  44884. type: "text",
  44885. id: "username" + this.data.credid,
  44886. readonly: ""
  44887. },
  44888. domProps: { value: this.data.creduser }
  44889. }),
  44890. _vm._v(" "),
  44891. _c(
  44892. "button",
  44893. {
  44894. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44895. attrs: {
  44896. id: "btn-username" + this.data.credid,
  44897. "data-clipboard-target": "#username" + this.data.credid
  44898. }
  44899. },
  44900. [_c("i", { staticClass: "far fa-clone" })]
  44901. )
  44902. ]),
  44903. _vm._v(" "),
  44904. _c("div", [
  44905. _vm._m(1),
  44906. _vm._v(" "),
  44907. _c("input", {
  44908. staticClass: "border-0 credential",
  44909. attrs: {
  44910. type: "text",
  44911. id: "password" + this.data.credid,
  44912. readonly: ""
  44913. },
  44914. domProps: { value: this.data.credpass }
  44915. }),
  44916. _vm._v(" "),
  44917. _c(
  44918. "button",
  44919. {
  44920. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44921. attrs: {
  44922. id: "btn-password" + this.data.credid,
  44923. "data-clipboard-target": "#password" + this.data.credid
  44924. }
  44925. },
  44926. [_c("i", { staticClass: "far fa-clone" })]
  44927. )
  44928. ])
  44929. ]),
  44930. _vm._v(" "),
  44931. _c(
  44932. "div",
  44933. {
  44934. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44935. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44936. },
  44937. [
  44938. _c(
  44939. "button",
  44940. {
  44941. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44942. attrs: {
  44943. type: "button",
  44944. "data-toggle": "modal",
  44945. "data-target": "#credential" + this.data.credid + "editModal"
  44946. }
  44947. },
  44948. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44949. ),
  44950. _vm._v(" "),
  44951. _c(
  44952. "button",
  44953. {
  44954. staticClass: "btn btn-sm btn-danger p-lg-1",
  44955. attrs: {
  44956. type: "button",
  44957. "data-toggle": "modal",
  44958. "data-target":
  44959. "#credential" + this.data.credid + "deleteModal"
  44960. }
  44961. },
  44962. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44963. )
  44964. ]
  44965. )
  44966. ])
  44967. ],
  44968. 1
  44969. )
  44970. }
  44971. var staticRenderFns = [
  44972. function() {
  44973. var _vm = this
  44974. var _h = _vm.$createElement
  44975. var _c = _vm._self._c || _h
  44976. return _c("label", { attrs: { for: "username" } }, [
  44977. _c("i", { staticClass: "fas fa-fw fa-user" })
  44978. ])
  44979. },
  44980. function() {
  44981. var _vm = this
  44982. var _h = _vm.$createElement
  44983. var _c = _vm._self._c || _h
  44984. return _c("label", { attrs: { for: "password" } }, [
  44985. _c("i", { staticClass: "fas fa-fw fa-key" })
  44986. ])
  44987. }
  44988. ]
  44989. render._withStripped = true
  44990. /***/ }),
  44991. /***/ "./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&":
  44992. /*!**********************************************************************************************************************************************************************************************************************!*\
  44993. !*** ./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& ***!
  44994. \**********************************************************************************************************************************************************************************************************************/
  44995. /*! exports provided: render, staticRenderFns */
  44996. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44997. "use strict";
  44998. __webpack_require__.r(__webpack_exports__);
  44999. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45000. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45001. var render = function() {
  45002. var _vm = this
  45003. var _h = _vm.$createElement
  45004. var _c = _vm._self._c || _h
  45005. return _c(
  45006. "modal",
  45007. {
  45008. attrs: {
  45009. id: _vm.id,
  45010. tabindex: "-1",
  45011. role: "dialog",
  45012. "aria-labelledby": _vm.id + "Label"
  45013. }
  45014. },
  45015. [
  45016. _c(
  45017. "h5",
  45018. {
  45019. staticClass: "modal-title",
  45020. attrs: { slot: "header", id: _vm.id + "Label" },
  45021. slot: "header"
  45022. },
  45023. [_vm._v("\n Edit Credential\n ")]
  45024. ),
  45025. _vm._v(" "),
  45026. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45027. _c(
  45028. "div",
  45029. { staticClass: "form" },
  45030. [
  45031. _c("autocomplete-custom-dropdown", {
  45032. attrs: {
  45033. options: _vm.descriptions,
  45034. value: _vm.creddesc,
  45035. "allow-custom": true
  45036. },
  45037. model: {
  45038. value: _vm.creddesc,
  45039. callback: function($$v) {
  45040. _vm.creddesc = $$v
  45041. },
  45042. expression: "creddesc"
  45043. }
  45044. })
  45045. ],
  45046. 1
  45047. ),
  45048. _vm._v(" "),
  45049. _c("div", { staticClass: "form-group" }, [
  45050. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45051. _vm._v(" "),
  45052. _c("input", {
  45053. directives: [
  45054. {
  45055. name: "model",
  45056. rawName: "v-model",
  45057. value: _vm.data.creduser,
  45058. expression: "data.creduser"
  45059. }
  45060. ],
  45061. staticClass: "form-control credential",
  45062. attrs: {
  45063. type: "text",
  45064. name: "newusername" + _vm.data.credid,
  45065. id: "newusername" + _vm.data.credid
  45066. },
  45067. domProps: { value: _vm.data.creduser },
  45068. on: {
  45069. input: function($event) {
  45070. if ($event.target.composing) {
  45071. return
  45072. }
  45073. _vm.$set(_vm.data, "creduser", $event.target.value)
  45074. }
  45075. }
  45076. })
  45077. ]),
  45078. _vm._v(" "),
  45079. _c("div", { staticClass: "form-group" }, [
  45080. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45081. _vm._v(" "),
  45082. _c("input", {
  45083. directives: [
  45084. {
  45085. name: "model",
  45086. rawName: "v-model",
  45087. value: _vm.data.credpass,
  45088. expression: "data.credpass"
  45089. }
  45090. ],
  45091. staticClass: "form-control credential",
  45092. attrs: {
  45093. type: "text",
  45094. name: "newpassword" + _vm.data.credid,
  45095. id: "newpassword" + _vm.data.credid
  45096. },
  45097. domProps: { value: _vm.data.credpass },
  45098. on: {
  45099. input: function($event) {
  45100. if ($event.target.composing) {
  45101. return
  45102. }
  45103. _vm.$set(_vm.data, "credpass", $event.target.value)
  45104. }
  45105. }
  45106. }),
  45107. _vm._v(" "),
  45108. _c(
  45109. "button",
  45110. {
  45111. staticClass: "btn btn-secondary",
  45112. attrs: { type: "button" },
  45113. on: {
  45114. click: function($event) {
  45115. return _vm.getRandomPassword(_vm.data.credid)
  45116. }
  45117. }
  45118. },
  45119. [_vm._v("Generate Random")]
  45120. )
  45121. ]),
  45122. _vm._v(" "),
  45123. _c("div", { staticClass: "form-group" })
  45124. ]),
  45125. _vm._v(" "),
  45126. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45127. _c(
  45128. "button",
  45129. {
  45130. staticClass: "btn btn-secondary",
  45131. attrs: { type: "button", "data-dismiss": "modal" }
  45132. },
  45133. [_vm._v("Close")]
  45134. ),
  45135. _vm._v(" "),
  45136. _c(
  45137. "button",
  45138. {
  45139. staticClass: "btn btn-primary",
  45140. attrs: { type: "button" },
  45141. on: {
  45142. click: function($event) {
  45143. return _vm.updateCredential()
  45144. }
  45145. }
  45146. },
  45147. [
  45148. !_vm.credentialSaving
  45149. ? _c("div", [_vm._v("Save")])
  45150. : _c("circle-spinner", { attrs: { size: 2 } })
  45151. ],
  45152. 1
  45153. )
  45154. ])
  45155. ]
  45156. )
  45157. }
  45158. var staticRenderFns = []
  45159. render._withStripped = true
  45160. /***/ }),
  45161. /***/ "./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&":
  45162. /*!*****************************************************************************************************************************************************************************************************************!*\
  45163. !*** ./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& ***!
  45164. \*****************************************************************************************************************************************************************************************************************/
  45165. /*! exports provided: render, staticRenderFns */
  45166. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45167. "use strict";
  45168. __webpack_require__.r(__webpack_exports__);
  45169. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45170. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45171. var render = function() {
  45172. var _vm = this
  45173. var _h = _vm.$createElement
  45174. var _c = _vm._self._c || _h
  45175. return _c(
  45176. "div",
  45177. [
  45178. _c("credential-form-modal", {
  45179. attrs: {
  45180. "modal-id": "newCredentialModal",
  45181. descriptions: _vm.creddescList,
  45182. create: true,
  45183. pcid: _vm.pcid
  45184. }
  45185. }),
  45186. _vm._v(" "),
  45187. _c(
  45188. "button",
  45189. {
  45190. staticClass: "btn btn-primary",
  45191. attrs: {
  45192. type: "button",
  45193. "data-toggle": "modal",
  45194. "data-target": "#newCredentialModal"
  45195. }
  45196. },
  45197. [_vm._v("New Credential")]
  45198. ),
  45199. _vm._v(" "),
  45200. _vm._l(_vm.credentials, function(credential) {
  45201. return _c(
  45202. "div",
  45203. { key: credential.credid },
  45204. [
  45205. _c("credential", {
  45206. attrs: { credential: credential, descriptions: _vm.creddescList }
  45207. })
  45208. ],
  45209. 1
  45210. )
  45211. })
  45212. ],
  45213. 2
  45214. )
  45215. }
  45216. var staticRenderFns = []
  45217. render._withStripped = true
  45218. /***/ }),
  45219. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  45220. /*!************************************************************************************************************************************************************************************************************!*\
  45221. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  45222. \************************************************************************************************************************************************************************************************************/
  45223. /*! exports provided: render, staticRenderFns */
  45224. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45225. "use strict";
  45226. __webpack_require__.r(__webpack_exports__);
  45227. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45229. var render = function() {
  45230. var _vm = this
  45231. var _h = _vm.$createElement
  45232. var _c = _vm._self._c || _h
  45233. return _c(
  45234. "ul",
  45235. { staticClass: "list-unstyled" },
  45236. _vm._l(_vm.errorList, function(error) {
  45237. return _c("li", { key: error, staticClass: "text-danger" }, [
  45238. _vm._v(" " + _vm._s(error) + " ")
  45239. ])
  45240. }),
  45241. 0
  45242. )
  45243. }
  45244. var staticRenderFns = []
  45245. render._withStripped = true
  45246. /***/ }),
  45247. /***/ "./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&":
  45248. /*!********************************************************************************************************************************************************************************************************!*\
  45249. !*** ./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& ***!
  45250. \********************************************************************************************************************************************************************************************************/
  45251. /*! exports provided: render, staticRenderFns */
  45252. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45253. "use strict";
  45254. __webpack_require__.r(__webpack_exports__);
  45255. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45256. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45257. var render = function() {
  45258. var _vm = this
  45259. var _h = _vm.$createElement
  45260. var _c = _vm._self._c || _h
  45261. return _c("div", { staticClass: "modal fade" }, [
  45262. _c(
  45263. "div",
  45264. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45265. [
  45266. _c("div", { staticClass: "modal-content" }, [
  45267. _c(
  45268. "div",
  45269. { staticClass: "modal-header" },
  45270. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45271. 2
  45272. ),
  45273. _vm._v(" "),
  45274. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45275. _vm._v(" "),
  45276. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45277. ])
  45278. ]
  45279. )
  45280. ])
  45281. }
  45282. var staticRenderFns = [
  45283. function() {
  45284. var _vm = this
  45285. var _h = _vm.$createElement
  45286. var _c = _vm._self._c || _h
  45287. return _c(
  45288. "button",
  45289. {
  45290. staticClass: "close",
  45291. attrs: {
  45292. type: "button",
  45293. "data-dismiss": "modal",
  45294. "aria-label": "Close"
  45295. }
  45296. },
  45297. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45298. )
  45299. }
  45300. ]
  45301. render._withStripped = true
  45302. /***/ }),
  45303. /***/ "./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&":
  45304. /*!****************************************************************************************************************************************************************************************************************!*\
  45305. !*** ./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& ***!
  45306. \****************************************************************************************************************************************************************************************************************/
  45307. /*! exports provided: render, staticRenderFns */
  45308. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45309. "use strict";
  45310. __webpack_require__.r(__webpack_exports__);
  45311. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45312. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45313. var render = function() {
  45314. var _vm = this
  45315. var _h = _vm.$createElement
  45316. var _c = _vm._self._c || _h
  45317. return _c(
  45318. "modal",
  45319. {
  45320. attrs: {
  45321. id: _vm.modalId,
  45322. tabindex: "-1",
  45323. role: "dialog",
  45324. "aria-labelledby": _vm.modalId + "Label"
  45325. }
  45326. },
  45327. [
  45328. _c(
  45329. "h5",
  45330. {
  45331. staticClass: "modal-title",
  45332. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45333. slot: "header"
  45334. },
  45335. [_vm._v("\n Edit Note\n ")]
  45336. ),
  45337. _vm._v(" "),
  45338. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45339. _c("div", { staticClass: "form-group" }, [
  45340. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  45341. _vm._v(" "),
  45342. _c("textarea", {
  45343. directives: [
  45344. {
  45345. name: "model",
  45346. rawName: "v-model",
  45347. value: _vm.note.thenote,
  45348. expression: "note.thenote"
  45349. }
  45350. ],
  45351. staticClass: "form-control",
  45352. attrs: {
  45353. name: "content" + _vm.note.noteid,
  45354. id: "content" + _vm.note.noteid
  45355. },
  45356. domProps: { value: _vm.note.thenote },
  45357. on: {
  45358. input: function($event) {
  45359. if ($event.target.composing) {
  45360. return
  45361. }
  45362. _vm.$set(_vm.note, "thenote", $event.target.value)
  45363. }
  45364. }
  45365. })
  45366. ])
  45367. ]),
  45368. _vm._v(" "),
  45369. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45370. _c(
  45371. "button",
  45372. {
  45373. staticClass: "btn btn-secondary",
  45374. attrs: { type: "button", "data-dismiss": "modal" }
  45375. },
  45376. [_vm._v("Close")]
  45377. ),
  45378. _vm._v(" "),
  45379. _c(
  45380. "button",
  45381. {
  45382. staticClass: "btn btn-primary",
  45383. attrs: { type: "button" },
  45384. on: {
  45385. click: function($event) {
  45386. return _vm.updateNote(_vm.note)
  45387. }
  45388. }
  45389. },
  45390. [_vm._v("Save")]
  45391. )
  45392. ])
  45393. ]
  45394. )
  45395. }
  45396. var staticRenderFns = []
  45397. render._withStripped = true
  45398. /***/ }),
  45399. /***/ "./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&":
  45400. /*!********************************************************************************************************************************************************************************************************!*\
  45401. !*** ./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& ***!
  45402. \********************************************************************************************************************************************************************************************************/
  45403. /*! exports provided: render, staticRenderFns */
  45404. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45405. "use strict";
  45406. __webpack_require__.r(__webpack_exports__);
  45407. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45408. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45409. var render = function() {
  45410. var _vm = this
  45411. var _h = _vm.$createElement
  45412. var _c = _vm._self._c || _h
  45413. return _c(
  45414. "ul",
  45415. { staticClass: "list-unstyled" },
  45416. [
  45417. _c("div", { staticClass: "row" }, [
  45418. _c(
  45419. "div",
  45420. {
  45421. staticClass:
  45422. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45423. },
  45424. [
  45425. _c(
  45426. "button",
  45427. {
  45428. staticClass: "btn btn-primary m-2",
  45429. attrs: {
  45430. type: "button",
  45431. "data-toggle": "collapse",
  45432. "data-target": "#note" + _vm.noteType + "add"
  45433. }
  45434. },
  45435. [
  45436. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45437. _vm._v(" Add New Note")
  45438. ]
  45439. )
  45440. ]
  45441. ),
  45442. _vm._v(" "),
  45443. _c("div", { staticClass: "col-md-10" }, [
  45444. _c(
  45445. "div",
  45446. {
  45447. staticClass: "collapse",
  45448. attrs: { id: "note" + _vm.noteType + "add" }
  45449. },
  45450. [
  45451. _c(
  45452. "div",
  45453. {
  45454. staticClass:
  45455. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45456. },
  45457. [
  45458. _c("textarea", {
  45459. directives: [
  45460. {
  45461. name: "model",
  45462. rawName: "v-model",
  45463. value: _vm.newNote.thenote,
  45464. expression: "newNote.thenote"
  45465. }
  45466. ],
  45467. staticClass: "form-control",
  45468. attrs: {
  45469. name: "newnote" + _vm.noteType,
  45470. id: "newnote" + _vm.noteType
  45471. },
  45472. domProps: { value: _vm.newNote.thenote },
  45473. on: {
  45474. input: function($event) {
  45475. if ($event.target.composing) {
  45476. return
  45477. }
  45478. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45479. }
  45480. }
  45481. }),
  45482. _vm._v(" "),
  45483. _c(
  45484. "button",
  45485. {
  45486. staticClass: "btn btn-secondary m-2",
  45487. attrs: { type: "button" },
  45488. on: {
  45489. click: function($event) {
  45490. return _vm.createNote()
  45491. }
  45492. }
  45493. },
  45494. [_vm._v("Save")]
  45495. )
  45496. ]
  45497. )
  45498. ]
  45499. )
  45500. ])
  45501. ]),
  45502. _vm._v(" "),
  45503. _vm._l(this.notes, function(note, index) {
  45504. return _c(
  45505. "li",
  45506. { key: index, staticClass: "row no-gutters mb-2" },
  45507. [
  45508. _c("note-form-modal", {
  45509. attrs: {
  45510. "modal-id": "note" + note.noteid + "editModal",
  45511. "populate-with": note
  45512. }
  45513. }),
  45514. _vm._v(" "),
  45515. _c(
  45516. "div",
  45517. {
  45518. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45519. class: _vm.noteOrders[index]
  45520. },
  45521. [
  45522. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45523. _vm._v(_vm._s(note.noteuser))
  45524. ]),
  45525. _vm._v(" "),
  45526. _c(
  45527. "div",
  45528. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45529. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45530. ),
  45531. _vm._v(" "),
  45532. _c(
  45533. "div",
  45534. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45535. [
  45536. _vm.authusername === note.noteuser ||
  45537. _vm.authusername === "admin"
  45538. ? [
  45539. _c(
  45540. "button",
  45541. {
  45542. staticClass: "btn btn-sm btn-primary m-1",
  45543. attrs: {
  45544. "data-toggle": "modal",
  45545. "data-target":
  45546. "#note" + note.noteid + "editModal"
  45547. }
  45548. },
  45549. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45550. ),
  45551. _vm._v(" "),
  45552. _vm._m(0, true),
  45553. _vm._v(" "),
  45554. _vm._m(1, true)
  45555. ]
  45556. : _vm._e()
  45557. ],
  45558. 2
  45559. )
  45560. ]
  45561. ),
  45562. _vm._v(" "),
  45563. _c("div", { staticClass: "col-md-10" }, [
  45564. _c("div", { staticClass: "card m-2" }, [
  45565. _c("div", { staticClass: "card-body p-2" }, [
  45566. _vm._v(
  45567. "\n " +
  45568. _vm._s(note.thenote) +
  45569. "\n "
  45570. )
  45571. ])
  45572. ])
  45573. ])
  45574. ],
  45575. 1
  45576. )
  45577. })
  45578. ],
  45579. 2
  45580. )
  45581. }
  45582. var staticRenderFns = [
  45583. function() {
  45584. var _vm = this
  45585. var _h = _vm.$createElement
  45586. var _c = _vm._self._c || _h
  45587. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  45588. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  45589. ])
  45590. },
  45591. function() {
  45592. var _vm = this
  45593. var _h = _vm.$createElement
  45594. var _c = _vm._self._c || _h
  45595. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  45596. _c("i", { staticClass: "fa fa-fw fa-random" })
  45597. ])
  45598. }
  45599. ]
  45600. render._withStripped = true
  45601. /***/ }),
  45602. /***/ "./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&":
  45603. /*!******************************************************************************************************************************************************************************************************************!*\
  45604. !*** ./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& ***!
  45605. \******************************************************************************************************************************************************************************************************************/
  45606. /*! exports provided: render, staticRenderFns */
  45607. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45608. "use strict";
  45609. __webpack_require__.r(__webpack_exports__);
  45610. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45612. var render = function() {
  45613. var _vm = this
  45614. var _h = _vm.$createElement
  45615. var _c = _vm._self._c || _h
  45616. return _c(
  45617. "modal",
  45618. {
  45619. attrs: {
  45620. id: _vm.id,
  45621. tabindex: "-1",
  45622. role: "dialog",
  45623. "aria-labelledby": _vm.id + "Label"
  45624. }
  45625. },
  45626. [
  45627. _c(
  45628. "h5",
  45629. {
  45630. staticClass: "modal-title",
  45631. attrs: { slot: "header", id: _vm.id + "Label" },
  45632. slot: "header"
  45633. },
  45634. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45635. ),
  45636. _vm._v(" "),
  45637. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45638. _c(
  45639. "div",
  45640. { staticClass: "form-group" },
  45641. [
  45642. _c("label", { attrs: { for: "probdesc" } }, [
  45643. _vm._v("Problem Description")
  45644. ]),
  45645. _vm._v(" "),
  45646. _c("textarea", {
  45647. directives: [
  45648. {
  45649. name: "model",
  45650. rawName: "v-model",
  45651. value: _vm.data.probdesc,
  45652. expression: "data.probdesc"
  45653. }
  45654. ],
  45655. class: {
  45656. "form-control": true,
  45657. "is-invalid": _vm.errors.probdesc
  45658. },
  45659. attrs: { id: "probdesc", name: "probdesc" },
  45660. domProps: { value: _vm.data.probdesc },
  45661. on: {
  45662. input: function($event) {
  45663. if ($event.target.composing) {
  45664. return
  45665. }
  45666. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45667. }
  45668. }
  45669. }),
  45670. _vm._v(" "),
  45671. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45672. ],
  45673. 1
  45674. ),
  45675. _vm._v(" "),
  45676. _c(
  45677. "div",
  45678. { staticClass: "form-group" },
  45679. [
  45680. _c("label", { attrs: { for: "suggested" } }, [
  45681. _vm._v("Suggested Solution")
  45682. ]),
  45683. _vm._v(" "),
  45684. _c("textarea", {
  45685. directives: [
  45686. {
  45687. name: "model",
  45688. rawName: "v-model",
  45689. value: _vm.data.suggested,
  45690. expression: "data.suggested"
  45691. }
  45692. ],
  45693. class: {
  45694. "form-control": true,
  45695. "is-invalid": _vm.errors.suggested
  45696. },
  45697. attrs: { id: "suggested", name: "suggested" },
  45698. domProps: { value: _vm.data.suggested },
  45699. on: {
  45700. input: function($event) {
  45701. if ($event.target.composing) {
  45702. return
  45703. }
  45704. _vm.$set(_vm.data, "suggested", $event.target.value)
  45705. }
  45706. }
  45707. }),
  45708. _vm._v(" "),
  45709. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  45710. ],
  45711. 1
  45712. ),
  45713. _vm._v(" "),
  45714. _c(
  45715. "div",
  45716. { staticClass: "form-group" },
  45717. [
  45718. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45719. _vm._v(" "),
  45720. _c("autocomplete-custom-dropdown", {
  45721. attrs: { options: _vm.storeList, value: this.store },
  45722. model: {
  45723. value: _vm.store,
  45724. callback: function($$v) {
  45725. _vm.store = $$v
  45726. },
  45727. expression: "store"
  45728. }
  45729. })
  45730. ],
  45731. 1
  45732. )
  45733. ]),
  45734. _vm._v(" "),
  45735. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45736. _c(
  45737. "button",
  45738. {
  45739. staticClass: "btn btn-secondary",
  45740. attrs: { type: "button", "data-dismiss": "modal" }
  45741. },
  45742. [_vm._v("Close")]
  45743. ),
  45744. _vm._v(" "),
  45745. _c(
  45746. "button",
  45747. {
  45748. staticClass: "btn btn-primary",
  45749. attrs: { type: "button" },
  45750. on: {
  45751. click: function($event) {
  45752. return _vm.updateWorkOrder()
  45753. }
  45754. }
  45755. },
  45756. [
  45757. !_vm.woInfoSaving
  45758. ? _c("div", [_vm._v("Save")])
  45759. : _c("circle-spinner", { attrs: { size: 2 } })
  45760. ],
  45761. 1
  45762. )
  45763. ])
  45764. ]
  45765. )
  45766. }
  45767. var staticRenderFns = []
  45768. render._withStripped = true
  45769. /***/ }),
  45770. /***/ "./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&":
  45771. /*!****************************************************************************************************************************************************************************************************************!*\
  45772. !*** ./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& ***!
  45773. \****************************************************************************************************************************************************************************************************************/
  45774. /*! exports provided: render, staticRenderFns */
  45775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45776. "use strict";
  45777. __webpack_require__.r(__webpack_exports__);
  45778. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45779. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45780. var render = function() {
  45781. var _vm = this
  45782. var _h = _vm.$createElement
  45783. var _c = _vm._self._c || _h
  45784. return _c(
  45785. "div",
  45786. [
  45787. _c("wo-info-edit-modal", {
  45788. attrs: {
  45789. "modal-id": "workordereditModal",
  45790. "populate-with": _vm.workOrder,
  45791. "store-list": this.storeList
  45792. }
  45793. }),
  45794. _vm._v(" "),
  45795. _c("p", [
  45796. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45797. _vm._v(" "),
  45798. _c("span", {
  45799. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45800. })
  45801. ]),
  45802. _vm._v(" "),
  45803. _c("p", [
  45804. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45805. _vm._v(" "),
  45806. _c("span", {
  45807. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45808. })
  45809. ]),
  45810. _vm._v(" "),
  45811. _c("p", [
  45812. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45813. _vm._v(" "),
  45814. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45815. ]),
  45816. _vm._v(" "),
  45817. _c("p", [
  45818. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45819. _vm._v(" "),
  45820. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45821. ]),
  45822. _vm._v(" "),
  45823. _c("p", [
  45824. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45825. _vm._v(" "),
  45826. _c(
  45827. "span",
  45828. {
  45829. staticClass: "dashed-underline",
  45830. attrs: {
  45831. "data-toggle": "tooltip",
  45832. "data-placement": "bottom",
  45833. title: this.getHRDate(_vm.workOrder.dropdate)
  45834. }
  45835. },
  45836. [
  45837. _vm._v(
  45838. "\n " +
  45839. _vm._s(
  45840. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45841. ) +
  45842. " days ago\n "
  45843. )
  45844. ]
  45845. )
  45846. ]),
  45847. _vm._v(" "),
  45848. _c("p", [
  45849. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45850. _vm._v(" "),
  45851. !this.isZero(_vm.workOrder.pickupdate)
  45852. ? _c(
  45853. "span",
  45854. {
  45855. staticClass: "dashed-underline",
  45856. attrs: {
  45857. "data-toggle": "tooltip",
  45858. "data-placement": "bottom",
  45859. title: this.getHRDate(_vm.workOrder.pickupdate)
  45860. }
  45861. },
  45862. [
  45863. _vm._v(
  45864. "\n " +
  45865. _vm._s(
  45866. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45867. ) +
  45868. " days ago\n "
  45869. )
  45870. ]
  45871. )
  45872. : _vm._e()
  45873. ]),
  45874. _vm._v(" "),
  45875. _c(
  45876. "button",
  45877. {
  45878. staticClass: "btn btn-primary",
  45879. attrs: {
  45880. type: "button",
  45881. "data-toggle": "modal",
  45882. "data-target": "#workordereditModal"
  45883. }
  45884. },
  45885. [_vm._v("Edit")]
  45886. )
  45887. ],
  45888. 1
  45889. )
  45890. }
  45891. var staticRenderFns = []
  45892. render._withStripped = true
  45893. /***/ }),
  45894. /***/ "./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&":
  45895. /*!*************************************************************************************************************************************************************************************************!*\
  45896. !*** ./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& ***!
  45897. \*************************************************************************************************************************************************************************************************/
  45898. /*! exports provided: render, staticRenderFns */
  45899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45900. "use strict";
  45901. __webpack_require__.r(__webpack_exports__);
  45902. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45903. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45904. var render = function() {
  45905. var _vm = this
  45906. var _h = _vm.$createElement
  45907. var _c = _vm._self._c || _h
  45908. return _c("div", [
  45909. _c(
  45910. "nav",
  45911. {
  45912. staticClass:
  45913. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45914. },
  45915. [
  45916. _c(
  45917. "div",
  45918. { staticClass: "container-fluid" },
  45919. [
  45920. _c(
  45921. "router-link",
  45922. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45923. [_vm._v("\n UPCCRT\n ")]
  45924. ),
  45925. _vm._v(" "),
  45926. _vm._m(0),
  45927. _vm._v(" "),
  45928. _c(
  45929. "div",
  45930. {
  45931. staticClass: "collapse navbar-collapse",
  45932. attrs: { id: "navbarSupportedContent" }
  45933. },
  45934. [
  45935. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45936. _vm._m(1),
  45937. _vm._v(" "),
  45938. _vm._m(2),
  45939. _vm._v(" "),
  45940. _c(
  45941. "li",
  45942. { staticClass: "nav-item" },
  45943. [
  45944. _c(
  45945. "router-link",
  45946. {
  45947. staticClass: "nav-link",
  45948. attrs: { to: { name: "dashboard" } }
  45949. },
  45950. [
  45951. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45952. _vm._v(" "),
  45953. _c(
  45954. "span",
  45955. { staticClass: "d-none d-sm-block d-md-inline" },
  45956. [_vm._v("Dashboard")]
  45957. )
  45958. ]
  45959. )
  45960. ],
  45961. 1
  45962. ),
  45963. _vm._v(" "),
  45964. _vm._m(3)
  45965. ]),
  45966. _vm._v(" "),
  45967. _c(
  45968. "ul",
  45969. { staticClass: "navbar-nav ml-auto" },
  45970. [
  45971. !_vm.isLoggedIn
  45972. ? _c(
  45973. "router-link",
  45974. {
  45975. staticClass: "nav-link",
  45976. attrs: { to: { name: "login" } }
  45977. },
  45978. [_vm._v("Login")]
  45979. )
  45980. : _vm._e(),
  45981. _vm._v(" "),
  45982. _vm.isLoggedIn
  45983. ? _c("li", { staticClass: "nav-link" }, [
  45984. _vm._v(_vm._s(_vm.username))
  45985. ])
  45986. : _vm._e(),
  45987. _vm._v(" "),
  45988. _vm.isLoggedIn
  45989. ? _c(
  45990. "router-link",
  45991. {
  45992. staticClass: "nav-link",
  45993. attrs: { to: { name: "home" } }
  45994. },
  45995. [_vm._v("Home")]
  45996. )
  45997. : _vm._e()
  45998. ],
  45999. 1
  46000. )
  46001. ]
  46002. )
  46003. ],
  46004. 1
  46005. )
  46006. ]
  46007. ),
  46008. _vm._v(" "),
  46009. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  46010. ])
  46011. }
  46012. var staticRenderFns = [
  46013. function() {
  46014. var _vm = this
  46015. var _h = _vm.$createElement
  46016. var _c = _vm._self._c || _h
  46017. return _c(
  46018. "button",
  46019. {
  46020. staticClass: "navbar-toggler",
  46021. attrs: {
  46022. type: "button",
  46023. "data-toggle": "collapse",
  46024. "data-target": "#navbarSupportedContent",
  46025. "aria-controls": "navbarSupportedContent",
  46026. "aria-expanded": "false"
  46027. }
  46028. },
  46029. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46030. )
  46031. },
  46032. function() {
  46033. var _vm = this
  46034. var _h = _vm.$createElement
  46035. var _c = _vm._self._c || _h
  46036. return _c("li", { staticClass: "nav-item" }, [
  46037. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46038. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46039. _vm._v(" "),
  46040. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46041. _vm._v("Check-In")
  46042. ])
  46043. ])
  46044. ])
  46045. },
  46046. function() {
  46047. var _vm = this
  46048. var _h = _vm.$createElement
  46049. var _c = _vm._self._c || _h
  46050. return _c("li", { staticClass: "nav-item" }, [
  46051. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46052. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46053. _vm._v(" "),
  46054. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46055. _vm._v("Check-Out")
  46056. ])
  46057. ])
  46058. ])
  46059. },
  46060. function() {
  46061. var _vm = this
  46062. var _h = _vm.$createElement
  46063. var _c = _vm._self._c || _h
  46064. return _c("li", { staticClass: "nav-item" }, [
  46065. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46066. _c("i", { staticClass: "fas fa-chart-bar" }),
  46067. _vm._v(" "),
  46068. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46069. _vm._v("Reports")
  46070. ])
  46071. ])
  46072. ])
  46073. }
  46074. ]
  46075. render._withStripped = true
  46076. /***/ }),
  46077. /***/ "./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&":
  46078. /*!*******************************************************************************************************************************************************************************************************!*\
  46079. !*** ./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& ***!
  46080. \*******************************************************************************************************************************************************************************************************/
  46081. /*! exports provided: render, staticRenderFns */
  46082. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46083. "use strict";
  46084. __webpack_require__.r(__webpack_exports__);
  46085. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46086. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46087. var render = function() {
  46088. var _vm = this
  46089. var _h = _vm.$createElement
  46090. var _c = _vm._self._c || _h
  46091. return _c("div", { staticClass: "container" }, [
  46092. _c("div", { staticClass: "row justify-content-center" }, [
  46093. !_vm.isLoading
  46094. ? _c(
  46095. "div",
  46096. { staticClass: "col-md-12" },
  46097. _vm._l(_vm.workOrders, function(workOrder, index) {
  46098. return _c(
  46099. "div",
  46100. { key: workOrder.woid, staticClass: "col-md-4" },
  46101. [
  46102. _c("div", { staticClass: "card" }, [
  46103. _c(
  46104. "div",
  46105. { staticClass: "card-header" },
  46106. [
  46107. _c(
  46108. "router-link",
  46109. {
  46110. staticClass: "h4 card-title",
  46111. attrs: {
  46112. to: {
  46113. name: "workorders",
  46114. params: { id: workOrder.woid }
  46115. }
  46116. }
  46117. },
  46118. [_vm._v(_vm._s(workOrder.woid))]
  46119. )
  46120. ],
  46121. 1
  46122. ),
  46123. _vm._v(" "),
  46124. _c("div", { staticClass: "card-body card-body-dark" }, [
  46125. _c("div", [
  46126. _vm._v(
  46127. "\n " +
  46128. _vm._s(workOrder.probdesc) +
  46129. "\n "
  46130. )
  46131. ]),
  46132. _vm._v(" "),
  46133. _c("div", [
  46134. _vm._v(
  46135. "\n " +
  46136. _vm._s(workOrder.suggested) +
  46137. "\n "
  46138. )
  46139. ])
  46140. ])
  46141. ])
  46142. ]
  46143. )
  46144. }),
  46145. 0
  46146. )
  46147. : _c(
  46148. "div",
  46149. { staticClass: "col-md-12" },
  46150. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46151. 1
  46152. )
  46153. ])
  46154. ])
  46155. }
  46156. var staticRenderFns = []
  46157. render._withStripped = true
  46158. /***/ }),
  46159. /***/ "./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&":
  46160. /*!***************************************************************************************************************************************************************************************************!*\
  46161. !*** ./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& ***!
  46162. \***************************************************************************************************************************************************************************************************/
  46163. /*! exports provided: render, staticRenderFns */
  46164. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46165. "use strict";
  46166. __webpack_require__.r(__webpack_exports__);
  46167. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46168. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46169. var render = function() {
  46170. var _vm = this
  46171. var _h = _vm.$createElement
  46172. var _c = _vm._self._c || _h
  46173. return _c("div", { staticClass: "container" }, [
  46174. _c("div", { staticClass: "row justify-content-center" }, [
  46175. _c("div", { staticClass: "col-md-8" }, [
  46176. _c("div", { staticClass: "card card-default" }, [
  46177. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46178. _vm._v(" "),
  46179. _c("div", { staticClass: "card-body" }, [
  46180. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46181. _c("div", { staticClass: "form-group row" }, [
  46182. _c(
  46183. "label",
  46184. {
  46185. staticClass: "col-sm-4 col-form-label text-md-right",
  46186. attrs: { for: "username" }
  46187. },
  46188. [_vm._v("Username")]
  46189. ),
  46190. _vm._v(" "),
  46191. _c("div", { staticClass: "col-md-6" }, [
  46192. _c("input", {
  46193. directives: [
  46194. {
  46195. name: "model",
  46196. rawName: "v-model",
  46197. value: _vm.username,
  46198. expression: "username"
  46199. }
  46200. ],
  46201. staticClass: "form-control",
  46202. attrs: {
  46203. id: "username",
  46204. type: "username",
  46205. required: "",
  46206. autofocus: ""
  46207. },
  46208. domProps: { value: _vm.username },
  46209. on: {
  46210. input: function($event) {
  46211. if ($event.target.composing) {
  46212. return
  46213. }
  46214. _vm.username = $event.target.value
  46215. }
  46216. }
  46217. })
  46218. ])
  46219. ]),
  46220. _vm._v(" "),
  46221. _c("div", { staticClass: "form-group row" }, [
  46222. _c(
  46223. "label",
  46224. {
  46225. staticClass: "col-md-4 col-form-label text-md-right",
  46226. attrs: { for: "password" }
  46227. },
  46228. [_vm._v("Password")]
  46229. ),
  46230. _vm._v(" "),
  46231. _c("div", { staticClass: "col-md-6" }, [
  46232. _c("input", {
  46233. directives: [
  46234. {
  46235. name: "model",
  46236. rawName: "v-model",
  46237. value: _vm.password,
  46238. expression: "password"
  46239. }
  46240. ],
  46241. staticClass: "form-control",
  46242. attrs: { id: "password", type: "password", required: "" },
  46243. domProps: { value: _vm.password },
  46244. on: {
  46245. input: function($event) {
  46246. if ($event.target.composing) {
  46247. return
  46248. }
  46249. _vm.password = $event.target.value
  46250. }
  46251. }
  46252. })
  46253. ])
  46254. ]),
  46255. _vm._v(" "),
  46256. _c("div", { staticClass: "form-group row mb-0" }, [
  46257. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46258. _c(
  46259. "button",
  46260. {
  46261. staticClass: "btn btn-primary",
  46262. attrs: { type: "submit" },
  46263. on: { click: _vm.handleSubmit }
  46264. },
  46265. [
  46266. _vm._v(
  46267. "\n Login\n "
  46268. )
  46269. ]
  46270. )
  46271. ])
  46272. ])
  46273. ])
  46274. ])
  46275. ])
  46276. ])
  46277. ])
  46278. ])
  46279. }
  46280. var staticRenderFns = []
  46281. render._withStripped = true
  46282. /***/ }),
  46283. /***/ "./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&":
  46284. /*!*****************************************************************************************************************************************************************************************************************!*\
  46285. !*** ./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& ***!
  46286. \*****************************************************************************************************************************************************************************************************************/
  46287. /*! exports provided: render, staticRenderFns */
  46288. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46289. "use strict";
  46290. __webpack_require__.r(__webpack_exports__);
  46291. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46293. var render = function() {
  46294. var _vm = this
  46295. var _h = _vm.$createElement
  46296. var _c = _vm._self._c || _h
  46297. return _vm._m(0)
  46298. }
  46299. var staticRenderFns = [
  46300. function() {
  46301. var _vm = this
  46302. var _h = _vm.$createElement
  46303. var _c = _vm._self._c || _h
  46304. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46305. _c("div", { staticClass: "content" }, [
  46306. _c("div", { staticClass: "m-b-md" }, [
  46307. _c("h2", { staticClass: "title m-b-md" }, [
  46308. _vm._v("\n UPCCRT\n ")
  46309. ]),
  46310. _vm._v(" "),
  46311. _c("h3", [
  46312. _vm._v(
  46313. "\n University PC Care Repair Tracker\n "
  46314. )
  46315. ])
  46316. ])
  46317. ])
  46318. ])
  46319. }
  46320. ]
  46321. render._withStripped = true
  46322. /***/ }),
  46323. /***/ "./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&":
  46324. /*!*******************************************************************************************************************************************************************************************************!*\
  46325. !*** ./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& ***!
  46326. \*******************************************************************************************************************************************************************************************************/
  46327. /*! exports provided: render, staticRenderFns */
  46328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46329. "use strict";
  46330. __webpack_require__.r(__webpack_exports__);
  46331. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46332. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46333. var render = function() {
  46334. var _vm = this
  46335. var _h = _vm.$createElement
  46336. var _c = _vm._self._c || _h
  46337. return _c("div", { staticClass: "container-fluid" }, [
  46338. _c("div", { staticClass: "row my-3" }, [
  46339. _c("div", { staticClass: "col-lg-6" }, [
  46340. _c("div", { staticClass: "card h-100" }, [
  46341. _vm._m(0),
  46342. _vm._v(" "),
  46343. _c("div", { staticClass: "card-body" }, [
  46344. _c("div", { staticClass: "tab-content" }, [
  46345. _c(
  46346. "div",
  46347. {
  46348. staticClass: "tab-pane active",
  46349. attrs: {
  46350. id: "assetinfo",
  46351. role: "tabpanel",
  46352. "aria-labelledby": "assetinfo-tab"
  46353. }
  46354. },
  46355. [
  46356. !_vm.assetLoading
  46357. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46358. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46359. ],
  46360. 1
  46361. ),
  46362. _vm._v(" "),
  46363. _c(
  46364. "div",
  46365. {
  46366. staticClass: "tab-pane",
  46367. attrs: {
  46368. id: "credentials",
  46369. role: "tabpanel",
  46370. "aria-labelledby": "credentials-tab"
  46371. }
  46372. },
  46373. [
  46374. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46375. ? _c("credential-list", {
  46376. attrs: {
  46377. credentials: _vm.credentials,
  46378. descriptions: _vm.credentialDescriptions,
  46379. pcid: _vm.asset.pcid
  46380. }
  46381. })
  46382. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46383. ],
  46384. 1
  46385. )
  46386. ])
  46387. ])
  46388. ])
  46389. ]),
  46390. _vm._v(" "),
  46391. _c("div", { staticClass: "col-lg-6" }, [
  46392. _c("div", { staticClass: "card h-100" }, [
  46393. _vm._m(1),
  46394. _vm._v(" "),
  46395. _c("div", { staticClass: "card-body" }, [
  46396. _c("div", { staticClass: "tab-content" }, [
  46397. _c(
  46398. "div",
  46399. {
  46400. staticClass: "tab-pane active",
  46401. attrs: {
  46402. id: "workordersumm",
  46403. role: "tabpanel",
  46404. "aria-labelledby": "workordersumm-tab"
  46405. }
  46406. },
  46407. [
  46408. !_vm.woLoading && !_vm.storesLoading
  46409. ? _c("work-order-info", {
  46410. attrs: {
  46411. "work-order": _vm.workOrder,
  46412. stores: _vm.stores
  46413. }
  46414. })
  46415. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46416. ],
  46417. 1
  46418. ),
  46419. _vm._v(" "),
  46420. _c(
  46421. "div",
  46422. {
  46423. staticClass: "tab-pane",
  46424. attrs: {
  46425. id: "attachments",
  46426. role: "tabpanel",
  46427. "aria-labelledby": "attachments-tab"
  46428. }
  46429. },
  46430. [
  46431. _vm._v(
  46432. "\n TODO 2\n "
  46433. )
  46434. ]
  46435. )
  46436. ])
  46437. ])
  46438. ])
  46439. ])
  46440. ]),
  46441. _vm._v(" "),
  46442. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46443. _c("div", { staticClass: "col-12" }, [
  46444. _c("div", { staticClass: "card" }, [
  46445. _c(
  46446. "div",
  46447. { staticClass: "card-body" },
  46448. [
  46449. _c("h5", { staticClass: "card-title" }, [
  46450. _vm._v("Customer Notes")
  46451. ]),
  46452. _vm._v(" "),
  46453. !_vm.workOrderNotesLoading
  46454. ? _c("notes", {
  46455. attrs: {
  46456. notes: _vm.publicNotes,
  46457. authusername: _vm.authUser,
  46458. "note-type": 0,
  46459. woid: _vm.id
  46460. }
  46461. })
  46462. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46463. ],
  46464. 1
  46465. )
  46466. ])
  46467. ])
  46468. ]),
  46469. _vm._v(" "),
  46470. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46471. _c("div", { staticClass: "col-12" }, [
  46472. _c("div", { staticClass: "card" }, [
  46473. _c(
  46474. "div",
  46475. { staticClass: "card-body" },
  46476. [
  46477. _c("h5", { staticClass: "card-title" }, [
  46478. _vm._v("Private/Billing Notes")
  46479. ]),
  46480. _vm._v(" "),
  46481. !_vm.workOrderNotesLoading
  46482. ? _c("notes", {
  46483. attrs: {
  46484. notes: _vm.privateNotes,
  46485. authusername: _vm.authUser,
  46486. "note-type": 1,
  46487. woid: _vm.id
  46488. }
  46489. })
  46490. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46491. ],
  46492. 1
  46493. )
  46494. ])
  46495. ])
  46496. ])
  46497. ])
  46498. }
  46499. var staticRenderFns = [
  46500. function() {
  46501. var _vm = this
  46502. var _h = _vm.$createElement
  46503. var _c = _vm._self._c || _h
  46504. return _c("div", { staticClass: "card-header text-right" }, [
  46505. _c(
  46506. "button",
  46507. {
  46508. staticClass: "btn btn-default xs-toggle",
  46509. attrs: {
  46510. type: "button",
  46511. "data-toggle": "collapse",
  46512. "data-target": "#assetTab"
  46513. }
  46514. },
  46515. [
  46516. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46517. _vm._v(" "),
  46518. _c("span", { staticClass: "icon-bar" }),
  46519. _vm._v(" "),
  46520. _c("span", { staticClass: "icon-bar" }),
  46521. _vm._v(" "),
  46522. _c("span", { staticClass: "icon-bar" })
  46523. ]
  46524. ),
  46525. _vm._v(" "),
  46526. _c(
  46527. "ul",
  46528. {
  46529. staticClass:
  46530. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46531. attrs: { id: "assetTab", role: "tablist" }
  46532. },
  46533. [
  46534. _c("li", { staticClass: "nav-item" }, [
  46535. _c(
  46536. "a",
  46537. {
  46538. staticClass: "nav-link active",
  46539. attrs: {
  46540. id: "assetinfo-tab",
  46541. "data-toggle": "pill",
  46542. href: "#assetinfo",
  46543. role: "tab",
  46544. "aria-controls": "assetinfo",
  46545. "aria-selected": "true"
  46546. }
  46547. },
  46548. [_vm._v("Hardware")]
  46549. )
  46550. ]),
  46551. _vm._v(" "),
  46552. _c("li", { staticClass: "nav-item" }, [
  46553. _c(
  46554. "a",
  46555. {
  46556. staticClass: "nav-link",
  46557. attrs: {
  46558. id: "credentials-tab",
  46559. "data-toggle": "pill",
  46560. href: "#credentials",
  46561. role: "tab",
  46562. "aria-controls": "credentials",
  46563. "aria-selected": "false"
  46564. }
  46565. },
  46566. [_vm._v("Credentials")]
  46567. )
  46568. ])
  46569. ]
  46570. )
  46571. ])
  46572. },
  46573. function() {
  46574. var _vm = this
  46575. var _h = _vm.$createElement
  46576. var _c = _vm._self._c || _h
  46577. return _c("div", { staticClass: "card-header text-right" }, [
  46578. _c(
  46579. "button",
  46580. {
  46581. staticClass: "btn btn-default xs-toggle",
  46582. attrs: {
  46583. type: "button",
  46584. "data-toggle": "collapse",
  46585. "data-target": "#workorderTab"
  46586. }
  46587. },
  46588. [
  46589. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46590. _vm._v(" "),
  46591. _c("span", { staticClass: "icon-bar" }),
  46592. _vm._v(" "),
  46593. _c("span", { staticClass: "icon-bar" }),
  46594. _vm._v(" "),
  46595. _c("span", { staticClass: "icon-bar" })
  46596. ]
  46597. ),
  46598. _vm._v(" "),
  46599. _c(
  46600. "ul",
  46601. {
  46602. staticClass:
  46603. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46604. attrs: { id: "workorderTab", role: "tablist" }
  46605. },
  46606. [
  46607. _c("li", { staticClass: "nav-item" }, [
  46608. _c(
  46609. "a",
  46610. {
  46611. staticClass: "nav-link active",
  46612. attrs: {
  46613. id: "workordersumm-tab",
  46614. "data-toggle": "pill",
  46615. href: "#workordersumm",
  46616. role: "tab",
  46617. "aria-controls": "workordersumm",
  46618. "aria-selected": "true"
  46619. }
  46620. },
  46621. [_vm._v("Summary")]
  46622. )
  46623. ]),
  46624. _vm._v(" "),
  46625. _c("li", { staticClass: "nav-item" }, [
  46626. _c(
  46627. "a",
  46628. {
  46629. staticClass: "nav-link",
  46630. attrs: {
  46631. id: "attachments-tab",
  46632. "data-toggle": "pill",
  46633. href: "#attachments",
  46634. role: "tab",
  46635. "aria-controls": "attachments",
  46636. "aria-selected": "false"
  46637. }
  46638. },
  46639. [_vm._v("Attachments")]
  46640. )
  46641. ])
  46642. ]
  46643. )
  46644. ])
  46645. }
  46646. ]
  46647. render._withStripped = true
  46648. /***/ }),
  46649. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46650. /*!********************************************************************!*\
  46651. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46652. \********************************************************************/
  46653. /*! exports provided: default */
  46654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46655. "use strict";
  46656. __webpack_require__.r(__webpack_exports__);
  46657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46658. /* globals __VUE_SSR_CONTEXT__ */
  46659. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46660. // This module is a runtime utility for cleaner component module output and will
  46661. // be included in the final webpack user bundle.
  46662. function normalizeComponent (
  46663. scriptExports,
  46664. render,
  46665. staticRenderFns,
  46666. functionalTemplate,
  46667. injectStyles,
  46668. scopeId,
  46669. moduleIdentifier, /* server only */
  46670. shadowMode /* vue-cli only */
  46671. ) {
  46672. // Vue.extend constructor export interop
  46673. var options = typeof scriptExports === 'function'
  46674. ? scriptExports.options
  46675. : scriptExports
  46676. // render functions
  46677. if (render) {
  46678. options.render = render
  46679. options.staticRenderFns = staticRenderFns
  46680. options._compiled = true
  46681. }
  46682. // functional template
  46683. if (functionalTemplate) {
  46684. options.functional = true
  46685. }
  46686. // scopedId
  46687. if (scopeId) {
  46688. options._scopeId = 'data-v-' + scopeId
  46689. }
  46690. var hook
  46691. if (moduleIdentifier) { // server build
  46692. hook = function (context) {
  46693. // 2.3 injection
  46694. context =
  46695. context || // cached call
  46696. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46697. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46698. // 2.2 with runInNewContext: true
  46699. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46700. context = __VUE_SSR_CONTEXT__
  46701. }
  46702. // inject component styles
  46703. if (injectStyles) {
  46704. injectStyles.call(this, context)
  46705. }
  46706. // register component module identifier for async chunk inferrence
  46707. if (context && context._registeredComponents) {
  46708. context._registeredComponents.add(moduleIdentifier)
  46709. }
  46710. }
  46711. // used by ssr in case component is cached and beforeCreate
  46712. // never gets called
  46713. options._ssrRegister = hook
  46714. } else if (injectStyles) {
  46715. hook = shadowMode
  46716. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46717. : injectStyles
  46718. }
  46719. if (hook) {
  46720. if (options.functional) {
  46721. // for template-only hot-reload because in that case the render fn doesn't
  46722. // go through the normalizer
  46723. options._injectStyles = hook
  46724. // register for functioal component in vue file
  46725. var originalRender = options.render
  46726. options.render = function renderWithStyleInjection (h, context) {
  46727. hook.call(context)
  46728. return originalRender(h, context)
  46729. }
  46730. } else {
  46731. // inject component registration as beforeCreate hook
  46732. var existing = options.beforeCreate
  46733. options.beforeCreate = existing
  46734. ? [].concat(existing, hook)
  46735. : [hook]
  46736. }
  46737. }
  46738. return {
  46739. exports: scriptExports,
  46740. options: options
  46741. }
  46742. }
  46743. /***/ }),
  46744. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46745. /*!********************************************************!*\
  46746. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46747. \********************************************************/
  46748. /*! exports provided: default */
  46749. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46750. "use strict";
  46751. __webpack_require__.r(__webpack_exports__);
  46752. /*!
  46753. * vue-router v3.1.6
  46754. * (c) 2020 Evan You
  46755. * @license MIT
  46756. */
  46757. /* */
  46758. function assert (condition, message) {
  46759. if (!condition) {
  46760. throw new Error(("[vue-router] " + message))
  46761. }
  46762. }
  46763. function warn (condition, message) {
  46764. if ( true && !condition) {
  46765. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46766. }
  46767. }
  46768. function isError (err) {
  46769. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46770. }
  46771. function isExtendedError (constructor, err) {
  46772. return (
  46773. err instanceof constructor ||
  46774. // _name is to support IE9 too
  46775. (err && (err.name === constructor.name || err._name === constructor._name))
  46776. )
  46777. }
  46778. function extend (a, b) {
  46779. for (var key in b) {
  46780. a[key] = b[key];
  46781. }
  46782. return a
  46783. }
  46784. var View = {
  46785. name: 'RouterView',
  46786. functional: true,
  46787. props: {
  46788. name: {
  46789. type: String,
  46790. default: 'default'
  46791. }
  46792. },
  46793. render: function render (_, ref) {
  46794. var props = ref.props;
  46795. var children = ref.children;
  46796. var parent = ref.parent;
  46797. var data = ref.data;
  46798. // used by devtools to display a router-view badge
  46799. data.routerView = true;
  46800. // directly use parent context's createElement() function
  46801. // so that components rendered by router-view can resolve named slots
  46802. var h = parent.$createElement;
  46803. var name = props.name;
  46804. var route = parent.$route;
  46805. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46806. // determine current view depth, also check to see if the tree
  46807. // has been toggled inactive but kept-alive.
  46808. var depth = 0;
  46809. var inactive = false;
  46810. while (parent && parent._routerRoot !== parent) {
  46811. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46812. if (vnodeData.routerView) {
  46813. depth++;
  46814. }
  46815. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46816. inactive = true;
  46817. }
  46818. parent = parent.$parent;
  46819. }
  46820. data.routerViewDepth = depth;
  46821. // render previous view if the tree is inactive and kept-alive
  46822. if (inactive) {
  46823. var cachedData = cache[name];
  46824. var cachedComponent = cachedData && cachedData.component;
  46825. if (cachedComponent) {
  46826. // #2301
  46827. // pass props
  46828. if (cachedData.configProps) {
  46829. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46830. }
  46831. return h(cachedComponent, data, children)
  46832. } else {
  46833. // render previous empty view
  46834. return h()
  46835. }
  46836. }
  46837. var matched = route.matched[depth];
  46838. var component = matched && matched.components[name];
  46839. // render empty node if no matched route or no config component
  46840. if (!matched || !component) {
  46841. cache[name] = null;
  46842. return h()
  46843. }
  46844. // cache component
  46845. cache[name] = { component: component };
  46846. // attach instance registration hook
  46847. // this will be called in the instance's injected lifecycle hooks
  46848. data.registerRouteInstance = function (vm, val) {
  46849. // val could be undefined for unregistration
  46850. var current = matched.instances[name];
  46851. if (
  46852. (val && current !== vm) ||
  46853. (!val && current === vm)
  46854. ) {
  46855. matched.instances[name] = val;
  46856. }
  46857. }
  46858. // also register instance in prepatch hook
  46859. // in case the same component instance is reused across different routes
  46860. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46861. matched.instances[name] = vnode.componentInstance;
  46862. };
  46863. // register instance in init hook
  46864. // in case kept-alive component be actived when routes changed
  46865. data.hook.init = function (vnode) {
  46866. if (vnode.data.keepAlive &&
  46867. vnode.componentInstance &&
  46868. vnode.componentInstance !== matched.instances[name]
  46869. ) {
  46870. matched.instances[name] = vnode.componentInstance;
  46871. }
  46872. };
  46873. var configProps = matched.props && matched.props[name];
  46874. // save route and configProps in cachce
  46875. if (configProps) {
  46876. extend(cache[name], {
  46877. route: route,
  46878. configProps: configProps
  46879. });
  46880. fillPropsinData(component, data, route, configProps);
  46881. }
  46882. return h(component, data, children)
  46883. }
  46884. };
  46885. function fillPropsinData (component, data, route, configProps) {
  46886. // resolve props
  46887. var propsToPass = data.props = resolveProps(route, configProps);
  46888. if (propsToPass) {
  46889. // clone to prevent mutation
  46890. propsToPass = data.props = extend({}, propsToPass);
  46891. // pass non-declared props as attrs
  46892. var attrs = data.attrs = data.attrs || {};
  46893. for (var key in propsToPass) {
  46894. if (!component.props || !(key in component.props)) {
  46895. attrs[key] = propsToPass[key];
  46896. delete propsToPass[key];
  46897. }
  46898. }
  46899. }
  46900. }
  46901. function resolveProps (route, config) {
  46902. switch (typeof config) {
  46903. case 'undefined':
  46904. return
  46905. case 'object':
  46906. return config
  46907. case 'function':
  46908. return config(route)
  46909. case 'boolean':
  46910. return config ? route.params : undefined
  46911. default:
  46912. if (true) {
  46913. warn(
  46914. false,
  46915. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46916. "expecting an object, function or boolean."
  46917. );
  46918. }
  46919. }
  46920. }
  46921. /* */
  46922. var encodeReserveRE = /[!'()*]/g;
  46923. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46924. var commaRE = /%2C/g;
  46925. // fixed encodeURIComponent which is more conformant to RFC3986:
  46926. // - escapes [!'()*]
  46927. // - preserve commas
  46928. var encode = function (str) { return encodeURIComponent(str)
  46929. .replace(encodeReserveRE, encodeReserveReplacer)
  46930. .replace(commaRE, ','); };
  46931. var decode = decodeURIComponent;
  46932. function resolveQuery (
  46933. query,
  46934. extraQuery,
  46935. _parseQuery
  46936. ) {
  46937. if ( extraQuery === void 0 ) extraQuery = {};
  46938. var parse = _parseQuery || parseQuery;
  46939. var parsedQuery;
  46940. try {
  46941. parsedQuery = parse(query || '');
  46942. } catch (e) {
  46943. true && warn(false, e.message);
  46944. parsedQuery = {};
  46945. }
  46946. for (var key in extraQuery) {
  46947. parsedQuery[key] = extraQuery[key];
  46948. }
  46949. return parsedQuery
  46950. }
  46951. function parseQuery (query) {
  46952. var res = {};
  46953. query = query.trim().replace(/^(\?|#|&)/, '');
  46954. if (!query) {
  46955. return res
  46956. }
  46957. query.split('&').forEach(function (param) {
  46958. var parts = param.replace(/\+/g, ' ').split('=');
  46959. var key = decode(parts.shift());
  46960. var val = parts.length > 0
  46961. ? decode(parts.join('='))
  46962. : null;
  46963. if (res[key] === undefined) {
  46964. res[key] = val;
  46965. } else if (Array.isArray(res[key])) {
  46966. res[key].push(val);
  46967. } else {
  46968. res[key] = [res[key], val];
  46969. }
  46970. });
  46971. return res
  46972. }
  46973. function stringifyQuery (obj) {
  46974. var res = obj ? Object.keys(obj).map(function (key) {
  46975. var val = obj[key];
  46976. if (val === undefined) {
  46977. return ''
  46978. }
  46979. if (val === null) {
  46980. return encode(key)
  46981. }
  46982. if (Array.isArray(val)) {
  46983. var result = [];
  46984. val.forEach(function (val2) {
  46985. if (val2 === undefined) {
  46986. return
  46987. }
  46988. if (val2 === null) {
  46989. result.push(encode(key));
  46990. } else {
  46991. result.push(encode(key) + '=' + encode(val2));
  46992. }
  46993. });
  46994. return result.join('&')
  46995. }
  46996. return encode(key) + '=' + encode(val)
  46997. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  46998. return res ? ("?" + res) : ''
  46999. }
  47000. /* */
  47001. var trailingSlashRE = /\/?$/;
  47002. function createRoute (
  47003. record,
  47004. location,
  47005. redirectedFrom,
  47006. router
  47007. ) {
  47008. var stringifyQuery = router && router.options.stringifyQuery;
  47009. var query = location.query || {};
  47010. try {
  47011. query = clone(query);
  47012. } catch (e) {}
  47013. var route = {
  47014. name: location.name || (record && record.name),
  47015. meta: (record && record.meta) || {},
  47016. path: location.path || '/',
  47017. hash: location.hash || '',
  47018. query: query,
  47019. params: location.params || {},
  47020. fullPath: getFullPath(location, stringifyQuery),
  47021. matched: record ? formatMatch(record) : []
  47022. };
  47023. if (redirectedFrom) {
  47024. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47025. }
  47026. return Object.freeze(route)
  47027. }
  47028. function clone (value) {
  47029. if (Array.isArray(value)) {
  47030. return value.map(clone)
  47031. } else if (value && typeof value === 'object') {
  47032. var res = {};
  47033. for (var key in value) {
  47034. res[key] = clone(value[key]);
  47035. }
  47036. return res
  47037. } else {
  47038. return value
  47039. }
  47040. }
  47041. // the starting route that represents the initial state
  47042. var START = createRoute(null, {
  47043. path: '/'
  47044. });
  47045. function formatMatch (record) {
  47046. var res = [];
  47047. while (record) {
  47048. res.unshift(record);
  47049. record = record.parent;
  47050. }
  47051. return res
  47052. }
  47053. function getFullPath (
  47054. ref,
  47055. _stringifyQuery
  47056. ) {
  47057. var path = ref.path;
  47058. var query = ref.query; if ( query === void 0 ) query = {};
  47059. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47060. var stringify = _stringifyQuery || stringifyQuery;
  47061. return (path || '/') + stringify(query) + hash
  47062. }
  47063. function isSameRoute (a, b) {
  47064. if (b === START) {
  47065. return a === b
  47066. } else if (!b) {
  47067. return false
  47068. } else if (a.path && b.path) {
  47069. return (
  47070. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47071. a.hash === b.hash &&
  47072. isObjectEqual(a.query, b.query)
  47073. )
  47074. } else if (a.name && b.name) {
  47075. return (
  47076. a.name === b.name &&
  47077. a.hash === b.hash &&
  47078. isObjectEqual(a.query, b.query) &&
  47079. isObjectEqual(a.params, b.params)
  47080. )
  47081. } else {
  47082. return false
  47083. }
  47084. }
  47085. function isObjectEqual (a, b) {
  47086. if ( a === void 0 ) a = {};
  47087. if ( b === void 0 ) b = {};
  47088. // handle null value #1566
  47089. if (!a || !b) { return a === b }
  47090. var aKeys = Object.keys(a);
  47091. var bKeys = Object.keys(b);
  47092. if (aKeys.length !== bKeys.length) {
  47093. return false
  47094. }
  47095. return aKeys.every(function (key) {
  47096. var aVal = a[key];
  47097. var bVal = b[key];
  47098. // check nested equality
  47099. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47100. return isObjectEqual(aVal, bVal)
  47101. }
  47102. return String(aVal) === String(bVal)
  47103. })
  47104. }
  47105. function isIncludedRoute (current, target) {
  47106. return (
  47107. current.path.replace(trailingSlashRE, '/').indexOf(
  47108. target.path.replace(trailingSlashRE, '/')
  47109. ) === 0 &&
  47110. (!target.hash || current.hash === target.hash) &&
  47111. queryIncludes(current.query, target.query)
  47112. )
  47113. }
  47114. function queryIncludes (current, target) {
  47115. for (var key in target) {
  47116. if (!(key in current)) {
  47117. return false
  47118. }
  47119. }
  47120. return true
  47121. }
  47122. /* */
  47123. function resolvePath (
  47124. relative,
  47125. base,
  47126. append
  47127. ) {
  47128. var firstChar = relative.charAt(0);
  47129. if (firstChar === '/') {
  47130. return relative
  47131. }
  47132. if (firstChar === '?' || firstChar === '#') {
  47133. return base + relative
  47134. }
  47135. var stack = base.split('/');
  47136. // remove trailing segment if:
  47137. // - not appending
  47138. // - appending to trailing slash (last segment is empty)
  47139. if (!append || !stack[stack.length - 1]) {
  47140. stack.pop();
  47141. }
  47142. // resolve relative path
  47143. var segments = relative.replace(/^\//, '').split('/');
  47144. for (var i = 0; i < segments.length; i++) {
  47145. var segment = segments[i];
  47146. if (segment === '..') {
  47147. stack.pop();
  47148. } else if (segment !== '.') {
  47149. stack.push(segment);
  47150. }
  47151. }
  47152. // ensure leading slash
  47153. if (stack[0] !== '') {
  47154. stack.unshift('');
  47155. }
  47156. return stack.join('/')
  47157. }
  47158. function parsePath (path) {
  47159. var hash = '';
  47160. var query = '';
  47161. var hashIndex = path.indexOf('#');
  47162. if (hashIndex >= 0) {
  47163. hash = path.slice(hashIndex);
  47164. path = path.slice(0, hashIndex);
  47165. }
  47166. var queryIndex = path.indexOf('?');
  47167. if (queryIndex >= 0) {
  47168. query = path.slice(queryIndex + 1);
  47169. path = path.slice(0, queryIndex);
  47170. }
  47171. return {
  47172. path: path,
  47173. query: query,
  47174. hash: hash
  47175. }
  47176. }
  47177. function cleanPath (path) {
  47178. return path.replace(/\/\//g, '/')
  47179. }
  47180. var isarray = Array.isArray || function (arr) {
  47181. return Object.prototype.toString.call(arr) == '[object Array]';
  47182. };
  47183. /**
  47184. * Expose `pathToRegexp`.
  47185. */
  47186. var pathToRegexp_1 = pathToRegexp;
  47187. var parse_1 = parse;
  47188. var compile_1 = compile;
  47189. var tokensToFunction_1 = tokensToFunction;
  47190. var tokensToRegExp_1 = tokensToRegExp;
  47191. /**
  47192. * The main path matching regexp utility.
  47193. *
  47194. * @type {RegExp}
  47195. */
  47196. var PATH_REGEXP = new RegExp([
  47197. // Match escaped characters that would otherwise appear in future matches.
  47198. // This allows the user to escape special characters that won't transform.
  47199. '(\\\\.)',
  47200. // Match Express-style parameters and un-named parameters with a prefix
  47201. // and optional suffixes. Matches appear as:
  47202. //
  47203. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47204. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47205. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47206. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47207. ].join('|'), 'g');
  47208. /**
  47209. * Parse a string for the raw tokens.
  47210. *
  47211. * @param {string} str
  47212. * @param {Object=} options
  47213. * @return {!Array}
  47214. */
  47215. function parse (str, options) {
  47216. var tokens = [];
  47217. var key = 0;
  47218. var index = 0;
  47219. var path = '';
  47220. var defaultDelimiter = options && options.delimiter || '/';
  47221. var res;
  47222. while ((res = PATH_REGEXP.exec(str)) != null) {
  47223. var m = res[0];
  47224. var escaped = res[1];
  47225. var offset = res.index;
  47226. path += str.slice(index, offset);
  47227. index = offset + m.length;
  47228. // Ignore already escaped sequences.
  47229. if (escaped) {
  47230. path += escaped[1];
  47231. continue
  47232. }
  47233. var next = str[index];
  47234. var prefix = res[2];
  47235. var name = res[3];
  47236. var capture = res[4];
  47237. var group = res[5];
  47238. var modifier = res[6];
  47239. var asterisk = res[7];
  47240. // Push the current path onto the tokens.
  47241. if (path) {
  47242. tokens.push(path);
  47243. path = '';
  47244. }
  47245. var partial = prefix != null && next != null && next !== prefix;
  47246. var repeat = modifier === '+' || modifier === '*';
  47247. var optional = modifier === '?' || modifier === '*';
  47248. var delimiter = res[2] || defaultDelimiter;
  47249. var pattern = capture || group;
  47250. tokens.push({
  47251. name: name || key++,
  47252. prefix: prefix || '',
  47253. delimiter: delimiter,
  47254. optional: optional,
  47255. repeat: repeat,
  47256. partial: partial,
  47257. asterisk: !!asterisk,
  47258. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47259. });
  47260. }
  47261. // Match any characters still remaining.
  47262. if (index < str.length) {
  47263. path += str.substr(index);
  47264. }
  47265. // If the path exists, push it onto the end.
  47266. if (path) {
  47267. tokens.push(path);
  47268. }
  47269. return tokens
  47270. }
  47271. /**
  47272. * Compile a string to a template function for the path.
  47273. *
  47274. * @param {string} str
  47275. * @param {Object=} options
  47276. * @return {!function(Object=, Object=)}
  47277. */
  47278. function compile (str, options) {
  47279. return tokensToFunction(parse(str, options))
  47280. }
  47281. /**
  47282. * Prettier encoding of URI path segments.
  47283. *
  47284. * @param {string}
  47285. * @return {string}
  47286. */
  47287. function encodeURIComponentPretty (str) {
  47288. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47289. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47290. })
  47291. }
  47292. /**
  47293. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47294. *
  47295. * @param {string}
  47296. * @return {string}
  47297. */
  47298. function encodeAsterisk (str) {
  47299. return encodeURI(str).replace(/[?#]/g, function (c) {
  47300. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47301. })
  47302. }
  47303. /**
  47304. * Expose a method for transforming tokens into the path function.
  47305. */
  47306. function tokensToFunction (tokens) {
  47307. // Compile all the tokens into regexps.
  47308. var matches = new Array(tokens.length);
  47309. // Compile all the patterns before compilation.
  47310. for (var i = 0; i < tokens.length; i++) {
  47311. if (typeof tokens[i] === 'object') {
  47312. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47313. }
  47314. }
  47315. return function (obj, opts) {
  47316. var path = '';
  47317. var data = obj || {};
  47318. var options = opts || {};
  47319. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47320. for (var i = 0; i < tokens.length; i++) {
  47321. var token = tokens[i];
  47322. if (typeof token === 'string') {
  47323. path += token;
  47324. continue
  47325. }
  47326. var value = data[token.name];
  47327. var segment;
  47328. if (value == null) {
  47329. if (token.optional) {
  47330. // Prepend partial segment prefixes.
  47331. if (token.partial) {
  47332. path += token.prefix;
  47333. }
  47334. continue
  47335. } else {
  47336. throw new TypeError('Expected "' + token.name + '" to be defined')
  47337. }
  47338. }
  47339. if (isarray(value)) {
  47340. if (!token.repeat) {
  47341. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47342. }
  47343. if (value.length === 0) {
  47344. if (token.optional) {
  47345. continue
  47346. } else {
  47347. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47348. }
  47349. }
  47350. for (var j = 0; j < value.length; j++) {
  47351. segment = encode(value[j]);
  47352. if (!matches[i].test(segment)) {
  47353. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47354. }
  47355. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47356. }
  47357. continue
  47358. }
  47359. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47360. if (!matches[i].test(segment)) {
  47361. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47362. }
  47363. path += token.prefix + segment;
  47364. }
  47365. return path
  47366. }
  47367. }
  47368. /**
  47369. * Escape a regular expression string.
  47370. *
  47371. * @param {string} str
  47372. * @return {string}
  47373. */
  47374. function escapeString (str) {
  47375. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47376. }
  47377. /**
  47378. * Escape the capturing group by escaping special characters and meaning.
  47379. *
  47380. * @param {string} group
  47381. * @return {string}
  47382. */
  47383. function escapeGroup (group) {
  47384. return group.replace(/([=!:$\/()])/g, '\\$1')
  47385. }
  47386. /**
  47387. * Attach the keys as a property of the regexp.
  47388. *
  47389. * @param {!RegExp} re
  47390. * @param {Array} keys
  47391. * @return {!RegExp}
  47392. */
  47393. function attachKeys (re, keys) {
  47394. re.keys = keys;
  47395. return re
  47396. }
  47397. /**
  47398. * Get the flags for a regexp from the options.
  47399. *
  47400. * @param {Object} options
  47401. * @return {string}
  47402. */
  47403. function flags (options) {
  47404. return options.sensitive ? '' : 'i'
  47405. }
  47406. /**
  47407. * Pull out keys from a regexp.
  47408. *
  47409. * @param {!RegExp} path
  47410. * @param {!Array} keys
  47411. * @return {!RegExp}
  47412. */
  47413. function regexpToRegexp (path, keys) {
  47414. // Use a negative lookahead to match only capturing groups.
  47415. var groups = path.source.match(/\((?!\?)/g);
  47416. if (groups) {
  47417. for (var i = 0; i < groups.length; i++) {
  47418. keys.push({
  47419. name: i,
  47420. prefix: null,
  47421. delimiter: null,
  47422. optional: false,
  47423. repeat: false,
  47424. partial: false,
  47425. asterisk: false,
  47426. pattern: null
  47427. });
  47428. }
  47429. }
  47430. return attachKeys(path, keys)
  47431. }
  47432. /**
  47433. * Transform an array into a regexp.
  47434. *
  47435. * @param {!Array} path
  47436. * @param {Array} keys
  47437. * @param {!Object} options
  47438. * @return {!RegExp}
  47439. */
  47440. function arrayToRegexp (path, keys, options) {
  47441. var parts = [];
  47442. for (var i = 0; i < path.length; i++) {
  47443. parts.push(pathToRegexp(path[i], keys, options).source);
  47444. }
  47445. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47446. return attachKeys(regexp, keys)
  47447. }
  47448. /**
  47449. * Create a path regexp from string input.
  47450. *
  47451. * @param {string} path
  47452. * @param {!Array} keys
  47453. * @param {!Object} options
  47454. * @return {!RegExp}
  47455. */
  47456. function stringToRegexp (path, keys, options) {
  47457. return tokensToRegExp(parse(path, options), keys, options)
  47458. }
  47459. /**
  47460. * Expose a function for taking tokens and returning a RegExp.
  47461. *
  47462. * @param {!Array} tokens
  47463. * @param {(Array|Object)=} keys
  47464. * @param {Object=} options
  47465. * @return {!RegExp}
  47466. */
  47467. function tokensToRegExp (tokens, keys, options) {
  47468. if (!isarray(keys)) {
  47469. options = /** @type {!Object} */ (keys || options);
  47470. keys = [];
  47471. }
  47472. options = options || {};
  47473. var strict = options.strict;
  47474. var end = options.end !== false;
  47475. var route = '';
  47476. // Iterate over the tokens and create our regexp string.
  47477. for (var i = 0; i < tokens.length; i++) {
  47478. var token = tokens[i];
  47479. if (typeof token === 'string') {
  47480. route += escapeString(token);
  47481. } else {
  47482. var prefix = escapeString(token.prefix);
  47483. var capture = '(?:' + token.pattern + ')';
  47484. keys.push(token);
  47485. if (token.repeat) {
  47486. capture += '(?:' + prefix + capture + ')*';
  47487. }
  47488. if (token.optional) {
  47489. if (!token.partial) {
  47490. capture = '(?:' + prefix + '(' + capture + '))?';
  47491. } else {
  47492. capture = prefix + '(' + capture + ')?';
  47493. }
  47494. } else {
  47495. capture = prefix + '(' + capture + ')';
  47496. }
  47497. route += capture;
  47498. }
  47499. }
  47500. var delimiter = escapeString(options.delimiter || '/');
  47501. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47502. // In non-strict mode we allow a slash at the end of match. If the path to
  47503. // match already ends with a slash, we remove it for consistency. The slash
  47504. // is valid at the end of a path match, not in the middle. This is important
  47505. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47506. if (!strict) {
  47507. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47508. }
  47509. if (end) {
  47510. route += '$';
  47511. } else {
  47512. // In non-ending mode, we need the capturing groups to match as much as
  47513. // possible by using a positive lookahead to the end or next path segment.
  47514. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47515. }
  47516. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47517. }
  47518. /**
  47519. * Normalize the given path string, returning a regular expression.
  47520. *
  47521. * An empty array can be passed in for the keys, which will hold the
  47522. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47523. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47524. *
  47525. * @param {(string|RegExp|Array)} path
  47526. * @param {(Array|Object)=} keys
  47527. * @param {Object=} options
  47528. * @return {!RegExp}
  47529. */
  47530. function pathToRegexp (path, keys, options) {
  47531. if (!isarray(keys)) {
  47532. options = /** @type {!Object} */ (keys || options);
  47533. keys = [];
  47534. }
  47535. options = options || {};
  47536. if (path instanceof RegExp) {
  47537. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47538. }
  47539. if (isarray(path)) {
  47540. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47541. }
  47542. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47543. }
  47544. pathToRegexp_1.parse = parse_1;
  47545. pathToRegexp_1.compile = compile_1;
  47546. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47547. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47548. /* */
  47549. // $flow-disable-line
  47550. var regexpCompileCache = Object.create(null);
  47551. function fillParams (
  47552. path,
  47553. params,
  47554. routeMsg
  47555. ) {
  47556. params = params || {};
  47557. try {
  47558. var filler =
  47559. regexpCompileCache[path] ||
  47560. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47561. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47562. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47563. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47564. return filler(params, { pretty: true })
  47565. } catch (e) {
  47566. if (true) {
  47567. // Fix #3072 no warn if `pathMatch` is string
  47568. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47569. }
  47570. return ''
  47571. } finally {
  47572. // delete the 0 if it was added
  47573. delete params[0];
  47574. }
  47575. }
  47576. /* */
  47577. function normalizeLocation (
  47578. raw,
  47579. current,
  47580. append,
  47581. router
  47582. ) {
  47583. var next = typeof raw === 'string' ? { path: raw } : raw;
  47584. // named target
  47585. if (next._normalized) {
  47586. return next
  47587. } else if (next.name) {
  47588. next = extend({}, raw);
  47589. var params = next.params;
  47590. if (params && typeof params === 'object') {
  47591. next.params = extend({}, params);
  47592. }
  47593. return next
  47594. }
  47595. // relative params
  47596. if (!next.path && next.params && current) {
  47597. next = extend({}, next);
  47598. next._normalized = true;
  47599. var params$1 = extend(extend({}, current.params), next.params);
  47600. if (current.name) {
  47601. next.name = current.name;
  47602. next.params = params$1;
  47603. } else if (current.matched.length) {
  47604. var rawPath = current.matched[current.matched.length - 1].path;
  47605. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47606. } else if (true) {
  47607. warn(false, "relative params navigation requires a current route.");
  47608. }
  47609. return next
  47610. }
  47611. var parsedPath = parsePath(next.path || '');
  47612. var basePath = (current && current.path) || '/';
  47613. var path = parsedPath.path
  47614. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47615. : basePath;
  47616. var query = resolveQuery(
  47617. parsedPath.query,
  47618. next.query,
  47619. router && router.options.parseQuery
  47620. );
  47621. var hash = next.hash || parsedPath.hash;
  47622. if (hash && hash.charAt(0) !== '#') {
  47623. hash = "#" + hash;
  47624. }
  47625. return {
  47626. _normalized: true,
  47627. path: path,
  47628. query: query,
  47629. hash: hash
  47630. }
  47631. }
  47632. /* */
  47633. // work around weird flow bug
  47634. var toTypes = [String, Object];
  47635. var eventTypes = [String, Array];
  47636. var noop = function () {};
  47637. var Link = {
  47638. name: 'RouterLink',
  47639. props: {
  47640. to: {
  47641. type: toTypes,
  47642. required: true
  47643. },
  47644. tag: {
  47645. type: String,
  47646. default: 'a'
  47647. },
  47648. exact: Boolean,
  47649. append: Boolean,
  47650. replace: Boolean,
  47651. activeClass: String,
  47652. exactActiveClass: String,
  47653. event: {
  47654. type: eventTypes,
  47655. default: 'click'
  47656. }
  47657. },
  47658. render: function render (h) {
  47659. var this$1 = this;
  47660. var router = this.$router;
  47661. var current = this.$route;
  47662. var ref = router.resolve(
  47663. this.to,
  47664. current,
  47665. this.append
  47666. );
  47667. var location = ref.location;
  47668. var route = ref.route;
  47669. var href = ref.href;
  47670. var classes = {};
  47671. var globalActiveClass = router.options.linkActiveClass;
  47672. var globalExactActiveClass = router.options.linkExactActiveClass;
  47673. // Support global empty active class
  47674. var activeClassFallback =
  47675. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47676. var exactActiveClassFallback =
  47677. globalExactActiveClass == null
  47678. ? 'router-link-exact-active'
  47679. : globalExactActiveClass;
  47680. var activeClass =
  47681. this.activeClass == null ? activeClassFallback : this.activeClass;
  47682. var exactActiveClass =
  47683. this.exactActiveClass == null
  47684. ? exactActiveClassFallback
  47685. : this.exactActiveClass;
  47686. var compareTarget = route.redirectedFrom
  47687. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47688. : route;
  47689. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47690. classes[activeClass] = this.exact
  47691. ? classes[exactActiveClass]
  47692. : isIncludedRoute(current, compareTarget);
  47693. var handler = function (e) {
  47694. if (guardEvent(e)) {
  47695. if (this$1.replace) {
  47696. router.replace(location, noop);
  47697. } else {
  47698. router.push(location, noop);
  47699. }
  47700. }
  47701. };
  47702. var on = { click: guardEvent };
  47703. if (Array.isArray(this.event)) {
  47704. this.event.forEach(function (e) {
  47705. on[e] = handler;
  47706. });
  47707. } else {
  47708. on[this.event] = handler;
  47709. }
  47710. var data = { class: classes };
  47711. var scopedSlot =
  47712. !this.$scopedSlots.$hasNormal &&
  47713. this.$scopedSlots.default &&
  47714. this.$scopedSlots.default({
  47715. href: href,
  47716. route: route,
  47717. navigate: handler,
  47718. isActive: classes[activeClass],
  47719. isExactActive: classes[exactActiveClass]
  47720. });
  47721. if (scopedSlot) {
  47722. if (scopedSlot.length === 1) {
  47723. return scopedSlot[0]
  47724. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47725. if (true) {
  47726. warn(
  47727. false,
  47728. ("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.")
  47729. );
  47730. }
  47731. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47732. }
  47733. }
  47734. if (this.tag === 'a') {
  47735. data.on = on;
  47736. data.attrs = { href: href };
  47737. } else {
  47738. // find the first <a> child and apply listener and href
  47739. var a = findAnchor(this.$slots.default);
  47740. if (a) {
  47741. // in case the <a> is a static node
  47742. a.isStatic = false;
  47743. var aData = (a.data = extend({}, a.data));
  47744. aData.on = aData.on || {};
  47745. // transform existing events in both objects into arrays so we can push later
  47746. for (var event in aData.on) {
  47747. var handler$1 = aData.on[event];
  47748. if (event in on) {
  47749. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47750. }
  47751. }
  47752. // append new listeners for router-link
  47753. for (var event$1 in on) {
  47754. if (event$1 in aData.on) {
  47755. // on[event] is always a function
  47756. aData.on[event$1].push(on[event$1]);
  47757. } else {
  47758. aData.on[event$1] = handler;
  47759. }
  47760. }
  47761. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47762. aAttrs.href = href;
  47763. } else {
  47764. // doesn't have <a> child, apply listener to self
  47765. data.on = on;
  47766. }
  47767. }
  47768. return h(this.tag, data, this.$slots.default)
  47769. }
  47770. };
  47771. function guardEvent (e) {
  47772. // don't redirect with control keys
  47773. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47774. // don't redirect when preventDefault called
  47775. if (e.defaultPrevented) { return }
  47776. // don't redirect on right click
  47777. if (e.button !== undefined && e.button !== 0) { return }
  47778. // don't redirect if `target="_blank"`
  47779. if (e.currentTarget && e.currentTarget.getAttribute) {
  47780. var target = e.currentTarget.getAttribute('target');
  47781. if (/\b_blank\b/i.test(target)) { return }
  47782. }
  47783. // this may be a Weex event which doesn't have this method
  47784. if (e.preventDefault) {
  47785. e.preventDefault();
  47786. }
  47787. return true
  47788. }
  47789. function findAnchor (children) {
  47790. if (children) {
  47791. var child;
  47792. for (var i = 0; i < children.length; i++) {
  47793. child = children[i];
  47794. if (child.tag === 'a') {
  47795. return child
  47796. }
  47797. if (child.children && (child = findAnchor(child.children))) {
  47798. return child
  47799. }
  47800. }
  47801. }
  47802. }
  47803. var _Vue;
  47804. function install (Vue) {
  47805. if (install.installed && _Vue === Vue) { return }
  47806. install.installed = true;
  47807. _Vue = Vue;
  47808. var isDef = function (v) { return v !== undefined; };
  47809. var registerInstance = function (vm, callVal) {
  47810. var i = vm.$options._parentVnode;
  47811. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47812. i(vm, callVal);
  47813. }
  47814. };
  47815. Vue.mixin({
  47816. beforeCreate: function beforeCreate () {
  47817. if (isDef(this.$options.router)) {
  47818. this._routerRoot = this;
  47819. this._router = this.$options.router;
  47820. this._router.init(this);
  47821. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47822. } else {
  47823. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47824. }
  47825. registerInstance(this, this);
  47826. },
  47827. destroyed: function destroyed () {
  47828. registerInstance(this);
  47829. }
  47830. });
  47831. Object.defineProperty(Vue.prototype, '$router', {
  47832. get: function get () { return this._routerRoot._router }
  47833. });
  47834. Object.defineProperty(Vue.prototype, '$route', {
  47835. get: function get () { return this._routerRoot._route }
  47836. });
  47837. Vue.component('RouterView', View);
  47838. Vue.component('RouterLink', Link);
  47839. var strats = Vue.config.optionMergeStrategies;
  47840. // use the same hook merging strategy for route hooks
  47841. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47842. }
  47843. /* */
  47844. var inBrowser = typeof window !== 'undefined';
  47845. /* */
  47846. function createRouteMap (
  47847. routes,
  47848. oldPathList,
  47849. oldPathMap,
  47850. oldNameMap
  47851. ) {
  47852. // the path list is used to control path matching priority
  47853. var pathList = oldPathList || [];
  47854. // $flow-disable-line
  47855. var pathMap = oldPathMap || Object.create(null);
  47856. // $flow-disable-line
  47857. var nameMap = oldNameMap || Object.create(null);
  47858. routes.forEach(function (route) {
  47859. addRouteRecord(pathList, pathMap, nameMap, route);
  47860. });
  47861. // ensure wildcard routes are always at the end
  47862. for (var i = 0, l = pathList.length; i < l; i++) {
  47863. if (pathList[i] === '*') {
  47864. pathList.push(pathList.splice(i, 1)[0]);
  47865. l--;
  47866. i--;
  47867. }
  47868. }
  47869. if (true) {
  47870. // warn if routes do not include leading slashes
  47871. var found = pathList
  47872. // check for missing leading slash
  47873. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47874. if (found.length > 0) {
  47875. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47876. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47877. }
  47878. }
  47879. return {
  47880. pathList: pathList,
  47881. pathMap: pathMap,
  47882. nameMap: nameMap
  47883. }
  47884. }
  47885. function addRouteRecord (
  47886. pathList,
  47887. pathMap,
  47888. nameMap,
  47889. route,
  47890. parent,
  47891. matchAs
  47892. ) {
  47893. var path = route.path;
  47894. var name = route.name;
  47895. if (true) {
  47896. assert(path != null, "\"path\" is required in a route configuration.");
  47897. assert(
  47898. typeof route.component !== 'string',
  47899. "route config \"component\" for path: " + (String(
  47900. path || name
  47901. )) + " cannot be a " + "string id. Use an actual component instead."
  47902. );
  47903. }
  47904. var pathToRegexpOptions =
  47905. route.pathToRegexpOptions || {};
  47906. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47907. if (typeof route.caseSensitive === 'boolean') {
  47908. pathToRegexpOptions.sensitive = route.caseSensitive;
  47909. }
  47910. var record = {
  47911. path: normalizedPath,
  47912. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47913. components: route.components || { default: route.component },
  47914. instances: {},
  47915. name: name,
  47916. parent: parent,
  47917. matchAs: matchAs,
  47918. redirect: route.redirect,
  47919. beforeEnter: route.beforeEnter,
  47920. meta: route.meta || {},
  47921. props:
  47922. route.props == null
  47923. ? {}
  47924. : route.components
  47925. ? route.props
  47926. : { default: route.props }
  47927. };
  47928. if (route.children) {
  47929. // Warn if route is named, does not redirect and has a default child route.
  47930. // If users navigate to this route by name, the default child will
  47931. // not be rendered (GH Issue #629)
  47932. if (true) {
  47933. if (
  47934. route.name &&
  47935. !route.redirect &&
  47936. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47937. ) {
  47938. warn(
  47939. false,
  47940. "Named Route '" + (route.name) + "' has a default child route. " +
  47941. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47942. "the default child route will not be rendered. Remove the name from " +
  47943. "this route and use the name of the default child route for named " +
  47944. "links instead."
  47945. );
  47946. }
  47947. }
  47948. route.children.forEach(function (child) {
  47949. var childMatchAs = matchAs
  47950. ? cleanPath((matchAs + "/" + (child.path)))
  47951. : undefined;
  47952. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47953. });
  47954. }
  47955. if (!pathMap[record.path]) {
  47956. pathList.push(record.path);
  47957. pathMap[record.path] = record;
  47958. }
  47959. if (route.alias !== undefined) {
  47960. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47961. for (var i = 0; i < aliases.length; ++i) {
  47962. var alias = aliases[i];
  47963. if ( true && alias === path) {
  47964. warn(
  47965. false,
  47966. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47967. );
  47968. // skip in dev to make it work
  47969. continue
  47970. }
  47971. var aliasRoute = {
  47972. path: alias,
  47973. children: route.children
  47974. };
  47975. addRouteRecord(
  47976. pathList,
  47977. pathMap,
  47978. nameMap,
  47979. aliasRoute,
  47980. parent,
  47981. record.path || '/' // matchAs
  47982. );
  47983. }
  47984. }
  47985. if (name) {
  47986. if (!nameMap[name]) {
  47987. nameMap[name] = record;
  47988. } else if ( true && !matchAs) {
  47989. warn(
  47990. false,
  47991. "Duplicate named routes definition: " +
  47992. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  47993. );
  47994. }
  47995. }
  47996. }
  47997. function compileRouteRegex (
  47998. path,
  47999. pathToRegexpOptions
  48000. ) {
  48001. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  48002. if (true) {
  48003. var keys = Object.create(null);
  48004. regex.keys.forEach(function (key) {
  48005. warn(
  48006. !keys[key.name],
  48007. ("Duplicate param keys in route with path: \"" + path + "\"")
  48008. );
  48009. keys[key.name] = true;
  48010. });
  48011. }
  48012. return regex
  48013. }
  48014. function normalizePath (
  48015. path,
  48016. parent,
  48017. strict
  48018. ) {
  48019. if (!strict) { path = path.replace(/\/$/, ''); }
  48020. if (path[0] === '/') { return path }
  48021. if (parent == null) { return path }
  48022. return cleanPath(((parent.path) + "/" + path))
  48023. }
  48024. /* */
  48025. function createMatcher (
  48026. routes,
  48027. router
  48028. ) {
  48029. var ref = createRouteMap(routes);
  48030. var pathList = ref.pathList;
  48031. var pathMap = ref.pathMap;
  48032. var nameMap = ref.nameMap;
  48033. function addRoutes (routes) {
  48034. createRouteMap(routes, pathList, pathMap, nameMap);
  48035. }
  48036. function match (
  48037. raw,
  48038. currentRoute,
  48039. redirectedFrom
  48040. ) {
  48041. var location = normalizeLocation(raw, currentRoute, false, router);
  48042. var name = location.name;
  48043. if (name) {
  48044. var record = nameMap[name];
  48045. if (true) {
  48046. warn(record, ("Route with name '" + name + "' does not exist"));
  48047. }
  48048. if (!record) { return _createRoute(null, location) }
  48049. var paramNames = record.regex.keys
  48050. .filter(function (key) { return !key.optional; })
  48051. .map(function (key) { return key.name; });
  48052. if (typeof location.params !== 'object') {
  48053. location.params = {};
  48054. }
  48055. if (currentRoute && typeof currentRoute.params === 'object') {
  48056. for (var key in currentRoute.params) {
  48057. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48058. location.params[key] = currentRoute.params[key];
  48059. }
  48060. }
  48061. }
  48062. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48063. return _createRoute(record, location, redirectedFrom)
  48064. } else if (location.path) {
  48065. location.params = {};
  48066. for (var i = 0; i < pathList.length; i++) {
  48067. var path = pathList[i];
  48068. var record$1 = pathMap[path];
  48069. if (matchRoute(record$1.regex, location.path, location.params)) {
  48070. return _createRoute(record$1, location, redirectedFrom)
  48071. }
  48072. }
  48073. }
  48074. // no match
  48075. return _createRoute(null, location)
  48076. }
  48077. function redirect (
  48078. record,
  48079. location
  48080. ) {
  48081. var originalRedirect = record.redirect;
  48082. var redirect = typeof originalRedirect === 'function'
  48083. ? originalRedirect(createRoute(record, location, null, router))
  48084. : originalRedirect;
  48085. if (typeof redirect === 'string') {
  48086. redirect = { path: redirect };
  48087. }
  48088. if (!redirect || typeof redirect !== 'object') {
  48089. if (true) {
  48090. warn(
  48091. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48092. );
  48093. }
  48094. return _createRoute(null, location)
  48095. }
  48096. var re = redirect;
  48097. var name = re.name;
  48098. var path = re.path;
  48099. var query = location.query;
  48100. var hash = location.hash;
  48101. var params = location.params;
  48102. query = re.hasOwnProperty('query') ? re.query : query;
  48103. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48104. params = re.hasOwnProperty('params') ? re.params : params;
  48105. if (name) {
  48106. // resolved named direct
  48107. var targetRecord = nameMap[name];
  48108. if (true) {
  48109. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48110. }
  48111. return match({
  48112. _normalized: true,
  48113. name: name,
  48114. query: query,
  48115. hash: hash,
  48116. params: params
  48117. }, undefined, location)
  48118. } else if (path) {
  48119. // 1. resolve relative redirect
  48120. var rawPath = resolveRecordPath(path, record);
  48121. // 2. resolve params
  48122. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48123. // 3. rematch with existing query and hash
  48124. return match({
  48125. _normalized: true,
  48126. path: resolvedPath,
  48127. query: query,
  48128. hash: hash
  48129. }, undefined, location)
  48130. } else {
  48131. if (true) {
  48132. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48133. }
  48134. return _createRoute(null, location)
  48135. }
  48136. }
  48137. function alias (
  48138. record,
  48139. location,
  48140. matchAs
  48141. ) {
  48142. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48143. var aliasedMatch = match({
  48144. _normalized: true,
  48145. path: aliasedPath
  48146. });
  48147. if (aliasedMatch) {
  48148. var matched = aliasedMatch.matched;
  48149. var aliasedRecord = matched[matched.length - 1];
  48150. location.params = aliasedMatch.params;
  48151. return _createRoute(aliasedRecord, location)
  48152. }
  48153. return _createRoute(null, location)
  48154. }
  48155. function _createRoute (
  48156. record,
  48157. location,
  48158. redirectedFrom
  48159. ) {
  48160. if (record && record.redirect) {
  48161. return redirect(record, redirectedFrom || location)
  48162. }
  48163. if (record && record.matchAs) {
  48164. return alias(record, location, record.matchAs)
  48165. }
  48166. return createRoute(record, location, redirectedFrom, router)
  48167. }
  48168. return {
  48169. match: match,
  48170. addRoutes: addRoutes
  48171. }
  48172. }
  48173. function matchRoute (
  48174. regex,
  48175. path,
  48176. params
  48177. ) {
  48178. var m = path.match(regex);
  48179. if (!m) {
  48180. return false
  48181. } else if (!params) {
  48182. return true
  48183. }
  48184. for (var i = 1, len = m.length; i < len; ++i) {
  48185. var key = regex.keys[i - 1];
  48186. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48187. if (key) {
  48188. // Fix #1994: using * with props: true generates a param named 0
  48189. params[key.name || 'pathMatch'] = val;
  48190. }
  48191. }
  48192. return true
  48193. }
  48194. function resolveRecordPath (path, record) {
  48195. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48196. }
  48197. /* */
  48198. // use User Timing api (if present) for more accurate key precision
  48199. var Time =
  48200. inBrowser && window.performance && window.performance.now
  48201. ? window.performance
  48202. : Date;
  48203. function genStateKey () {
  48204. return Time.now().toFixed(3)
  48205. }
  48206. var _key = genStateKey();
  48207. function getStateKey () {
  48208. return _key
  48209. }
  48210. function setStateKey (key) {
  48211. return (_key = key)
  48212. }
  48213. /* */
  48214. var positionStore = Object.create(null);
  48215. function setupScroll () {
  48216. // Fix for #1585 for Firefox
  48217. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48218. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48219. // window.location.protocol + '//' + window.location.host
  48220. // location.host contains the port and location.hostname doesn't
  48221. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48222. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48223. // preserve existing history state as it could be overriden by the user
  48224. var stateCopy = extend({}, window.history.state);
  48225. stateCopy.key = getStateKey();
  48226. window.history.replaceState(stateCopy, '', absolutePath);
  48227. window.addEventListener('popstate', function (e) {
  48228. saveScrollPosition();
  48229. if (e.state && e.state.key) {
  48230. setStateKey(e.state.key);
  48231. }
  48232. });
  48233. }
  48234. function handleScroll (
  48235. router,
  48236. to,
  48237. from,
  48238. isPop
  48239. ) {
  48240. if (!router.app) {
  48241. return
  48242. }
  48243. var behavior = router.options.scrollBehavior;
  48244. if (!behavior) {
  48245. return
  48246. }
  48247. if (true) {
  48248. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48249. }
  48250. // wait until re-render finishes before scrolling
  48251. router.app.$nextTick(function () {
  48252. var position = getScrollPosition();
  48253. var shouldScroll = behavior.call(
  48254. router,
  48255. to,
  48256. from,
  48257. isPop ? position : null
  48258. );
  48259. if (!shouldScroll) {
  48260. return
  48261. }
  48262. if (typeof shouldScroll.then === 'function') {
  48263. shouldScroll
  48264. .then(function (shouldScroll) {
  48265. scrollToPosition((shouldScroll), position);
  48266. })
  48267. .catch(function (err) {
  48268. if (true) {
  48269. assert(false, err.toString());
  48270. }
  48271. });
  48272. } else {
  48273. scrollToPosition(shouldScroll, position);
  48274. }
  48275. });
  48276. }
  48277. function saveScrollPosition () {
  48278. var key = getStateKey();
  48279. if (key) {
  48280. positionStore[key] = {
  48281. x: window.pageXOffset,
  48282. y: window.pageYOffset
  48283. };
  48284. }
  48285. }
  48286. function getScrollPosition () {
  48287. var key = getStateKey();
  48288. if (key) {
  48289. return positionStore[key]
  48290. }
  48291. }
  48292. function getElementPosition (el, offset) {
  48293. var docEl = document.documentElement;
  48294. var docRect = docEl.getBoundingClientRect();
  48295. var elRect = el.getBoundingClientRect();
  48296. return {
  48297. x: elRect.left - docRect.left - offset.x,
  48298. y: elRect.top - docRect.top - offset.y
  48299. }
  48300. }
  48301. function isValidPosition (obj) {
  48302. return isNumber(obj.x) || isNumber(obj.y)
  48303. }
  48304. function normalizePosition (obj) {
  48305. return {
  48306. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48307. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48308. }
  48309. }
  48310. function normalizeOffset (obj) {
  48311. return {
  48312. x: isNumber(obj.x) ? obj.x : 0,
  48313. y: isNumber(obj.y) ? obj.y : 0
  48314. }
  48315. }
  48316. function isNumber (v) {
  48317. return typeof v === 'number'
  48318. }
  48319. var hashStartsWithNumberRE = /^#\d/;
  48320. function scrollToPosition (shouldScroll, position) {
  48321. var isObject = typeof shouldScroll === 'object';
  48322. if (isObject && typeof shouldScroll.selector === 'string') {
  48323. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48324. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48325. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48326. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48327. : document.querySelector(shouldScroll.selector);
  48328. if (el) {
  48329. var offset =
  48330. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48331. ? shouldScroll.offset
  48332. : {};
  48333. offset = normalizeOffset(offset);
  48334. position = getElementPosition(el, offset);
  48335. } else if (isValidPosition(shouldScroll)) {
  48336. position = normalizePosition(shouldScroll);
  48337. }
  48338. } else if (isObject && isValidPosition(shouldScroll)) {
  48339. position = normalizePosition(shouldScroll);
  48340. }
  48341. if (position) {
  48342. window.scrollTo(position.x, position.y);
  48343. }
  48344. }
  48345. /* */
  48346. var supportsPushState =
  48347. inBrowser &&
  48348. (function () {
  48349. var ua = window.navigator.userAgent;
  48350. if (
  48351. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48352. ua.indexOf('Mobile Safari') !== -1 &&
  48353. ua.indexOf('Chrome') === -1 &&
  48354. ua.indexOf('Windows Phone') === -1
  48355. ) {
  48356. return false
  48357. }
  48358. return window.history && 'pushState' in window.history
  48359. })();
  48360. function pushState (url, replace) {
  48361. saveScrollPosition();
  48362. // try...catch the pushState call to get around Safari
  48363. // DOM Exception 18 where it limits to 100 pushState calls
  48364. var history = window.history;
  48365. try {
  48366. if (replace) {
  48367. // preserve existing history state as it could be overriden by the user
  48368. var stateCopy = extend({}, history.state);
  48369. stateCopy.key = getStateKey();
  48370. history.replaceState(stateCopy, '', url);
  48371. } else {
  48372. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48373. }
  48374. } catch (e) {
  48375. window.location[replace ? 'replace' : 'assign'](url);
  48376. }
  48377. }
  48378. function replaceState (url) {
  48379. pushState(url, true);
  48380. }
  48381. /* */
  48382. function runQueue (queue, fn, cb) {
  48383. var step = function (index) {
  48384. if (index >= queue.length) {
  48385. cb();
  48386. } else {
  48387. if (queue[index]) {
  48388. fn(queue[index], function () {
  48389. step(index + 1);
  48390. });
  48391. } else {
  48392. step(index + 1);
  48393. }
  48394. }
  48395. };
  48396. step(0);
  48397. }
  48398. /* */
  48399. function resolveAsyncComponents (matched) {
  48400. return function (to, from, next) {
  48401. var hasAsync = false;
  48402. var pending = 0;
  48403. var error = null;
  48404. flatMapComponents(matched, function (def, _, match, key) {
  48405. // if it's a function and doesn't have cid attached,
  48406. // assume it's an async component resolve function.
  48407. // we are not using Vue's default async resolving mechanism because
  48408. // we want to halt the navigation until the incoming component has been
  48409. // resolved.
  48410. if (typeof def === 'function' && def.cid === undefined) {
  48411. hasAsync = true;
  48412. pending++;
  48413. var resolve = once(function (resolvedDef) {
  48414. if (isESModule(resolvedDef)) {
  48415. resolvedDef = resolvedDef.default;
  48416. }
  48417. // save resolved on async factory in case it's used elsewhere
  48418. def.resolved = typeof resolvedDef === 'function'
  48419. ? resolvedDef
  48420. : _Vue.extend(resolvedDef);
  48421. match.components[key] = resolvedDef;
  48422. pending--;
  48423. if (pending <= 0) {
  48424. next();
  48425. }
  48426. });
  48427. var reject = once(function (reason) {
  48428. var msg = "Failed to resolve async component " + key + ": " + reason;
  48429. true && warn(false, msg);
  48430. if (!error) {
  48431. error = isError(reason)
  48432. ? reason
  48433. : new Error(msg);
  48434. next(error);
  48435. }
  48436. });
  48437. var res;
  48438. try {
  48439. res = def(resolve, reject);
  48440. } catch (e) {
  48441. reject(e);
  48442. }
  48443. if (res) {
  48444. if (typeof res.then === 'function') {
  48445. res.then(resolve, reject);
  48446. } else {
  48447. // new syntax in Vue 2.3
  48448. var comp = res.component;
  48449. if (comp && typeof comp.then === 'function') {
  48450. comp.then(resolve, reject);
  48451. }
  48452. }
  48453. }
  48454. }
  48455. });
  48456. if (!hasAsync) { next(); }
  48457. }
  48458. }
  48459. function flatMapComponents (
  48460. matched,
  48461. fn
  48462. ) {
  48463. return flatten(matched.map(function (m) {
  48464. return Object.keys(m.components).map(function (key) { return fn(
  48465. m.components[key],
  48466. m.instances[key],
  48467. m, key
  48468. ); })
  48469. }))
  48470. }
  48471. function flatten (arr) {
  48472. return Array.prototype.concat.apply([], arr)
  48473. }
  48474. var hasSymbol =
  48475. typeof Symbol === 'function' &&
  48476. typeof Symbol.toStringTag === 'symbol';
  48477. function isESModule (obj) {
  48478. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48479. }
  48480. // in Webpack 2, require.ensure now also returns a Promise
  48481. // so the resolve/reject functions may get called an extra time
  48482. // if the user uses an arrow function shorthand that happens to
  48483. // return that Promise.
  48484. function once (fn) {
  48485. var called = false;
  48486. return function () {
  48487. var args = [], len = arguments.length;
  48488. while ( len-- ) args[ len ] = arguments[ len ];
  48489. if (called) { return }
  48490. called = true;
  48491. return fn.apply(this, args)
  48492. }
  48493. }
  48494. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48495. function NavigationDuplicated (normalizedLocation) {
  48496. Error.call(this);
  48497. this.name = this._name = 'NavigationDuplicated';
  48498. // passing the message to super() doesn't seem to work in the transpiled version
  48499. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48500. // add a stack property so services like Sentry can correctly display it
  48501. Object.defineProperty(this, 'stack', {
  48502. value: new Error().stack,
  48503. writable: true,
  48504. configurable: true
  48505. });
  48506. // we could also have used
  48507. // Error.captureStackTrace(this, this.constructor)
  48508. // but it only exists on node and chrome
  48509. }
  48510. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48511. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48512. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48513. return NavigationDuplicated;
  48514. }(Error));
  48515. // support IE9
  48516. NavigationDuplicated._name = 'NavigationDuplicated';
  48517. /* */
  48518. var History = function History (router, base) {
  48519. this.router = router;
  48520. this.base = normalizeBase(base);
  48521. // start with a route object that stands for "nowhere"
  48522. this.current = START;
  48523. this.pending = null;
  48524. this.ready = false;
  48525. this.readyCbs = [];
  48526. this.readyErrorCbs = [];
  48527. this.errorCbs = [];
  48528. };
  48529. History.prototype.listen = function listen (cb) {
  48530. this.cb = cb;
  48531. };
  48532. History.prototype.onReady = function onReady (cb, errorCb) {
  48533. if (this.ready) {
  48534. cb();
  48535. } else {
  48536. this.readyCbs.push(cb);
  48537. if (errorCb) {
  48538. this.readyErrorCbs.push(errorCb);
  48539. }
  48540. }
  48541. };
  48542. History.prototype.onError = function onError (errorCb) {
  48543. this.errorCbs.push(errorCb);
  48544. };
  48545. History.prototype.transitionTo = function transitionTo (
  48546. location,
  48547. onComplete,
  48548. onAbort
  48549. ) {
  48550. var this$1 = this;
  48551. var route = this.router.match(location, this.current);
  48552. this.confirmTransition(
  48553. route,
  48554. function () {
  48555. this$1.updateRoute(route);
  48556. onComplete && onComplete(route);
  48557. this$1.ensureURL();
  48558. // fire ready cbs once
  48559. if (!this$1.ready) {
  48560. this$1.ready = true;
  48561. this$1.readyCbs.forEach(function (cb) {
  48562. cb(route);
  48563. });
  48564. }
  48565. },
  48566. function (err) {
  48567. if (onAbort) {
  48568. onAbort(err);
  48569. }
  48570. if (err && !this$1.ready) {
  48571. this$1.ready = true;
  48572. this$1.readyErrorCbs.forEach(function (cb) {
  48573. cb(err);
  48574. });
  48575. }
  48576. }
  48577. );
  48578. };
  48579. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48580. var this$1 = this;
  48581. var current = this.current;
  48582. var abort = function (err) {
  48583. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48584. // When the user navigates through history through back/forward buttons
  48585. // we do not want to throw the error. We only throw it if directly calling
  48586. // push/replace. That's why it's not included in isError
  48587. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48588. if (this$1.errorCbs.length) {
  48589. this$1.errorCbs.forEach(function (cb) {
  48590. cb(err);
  48591. });
  48592. } else {
  48593. warn(false, 'uncaught error during route navigation:');
  48594. console.error(err);
  48595. }
  48596. }
  48597. onAbort && onAbort(err);
  48598. };
  48599. if (
  48600. isSameRoute(route, current) &&
  48601. // in the case the route map has been dynamically appended to
  48602. route.matched.length === current.matched.length
  48603. ) {
  48604. this.ensureURL();
  48605. return abort(new NavigationDuplicated(route))
  48606. }
  48607. var ref = resolveQueue(
  48608. this.current.matched,
  48609. route.matched
  48610. );
  48611. var updated = ref.updated;
  48612. var deactivated = ref.deactivated;
  48613. var activated = ref.activated;
  48614. var queue = [].concat(
  48615. // in-component leave guards
  48616. extractLeaveGuards(deactivated),
  48617. // global before hooks
  48618. this.router.beforeHooks,
  48619. // in-component update hooks
  48620. extractUpdateHooks(updated),
  48621. // in-config enter guards
  48622. activated.map(function (m) { return m.beforeEnter; }),
  48623. // async components
  48624. resolveAsyncComponents(activated)
  48625. );
  48626. this.pending = route;
  48627. var iterator = function (hook, next) {
  48628. if (this$1.pending !== route) {
  48629. return abort()
  48630. }
  48631. try {
  48632. hook(route, current, function (to) {
  48633. if (to === false || isError(to)) {
  48634. // next(false) -> abort navigation, ensure current URL
  48635. this$1.ensureURL(true);
  48636. abort(to);
  48637. } else if (
  48638. typeof to === 'string' ||
  48639. (typeof to === 'object' &&
  48640. (typeof to.path === 'string' || typeof to.name === 'string'))
  48641. ) {
  48642. // next('/') or next({ path: '/' }) -> redirect
  48643. abort();
  48644. if (typeof to === 'object' && to.replace) {
  48645. this$1.replace(to);
  48646. } else {
  48647. this$1.push(to);
  48648. }
  48649. } else {
  48650. // confirm transition and pass on the value
  48651. next(to);
  48652. }
  48653. });
  48654. } catch (e) {
  48655. abort(e);
  48656. }
  48657. };
  48658. runQueue(queue, iterator, function () {
  48659. var postEnterCbs = [];
  48660. var isValid = function () { return this$1.current === route; };
  48661. // wait until async components are resolved before
  48662. // extracting in-component enter guards
  48663. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48664. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48665. runQueue(queue, iterator, function () {
  48666. if (this$1.pending !== route) {
  48667. return abort()
  48668. }
  48669. this$1.pending = null;
  48670. onComplete(route);
  48671. if (this$1.router.app) {
  48672. this$1.router.app.$nextTick(function () {
  48673. postEnterCbs.forEach(function (cb) {
  48674. cb();
  48675. });
  48676. });
  48677. }
  48678. });
  48679. });
  48680. };
  48681. History.prototype.updateRoute = function updateRoute (route) {
  48682. var prev = this.current;
  48683. this.current = route;
  48684. this.cb && this.cb(route);
  48685. this.router.afterHooks.forEach(function (hook) {
  48686. hook && hook(route, prev);
  48687. });
  48688. };
  48689. function normalizeBase (base) {
  48690. if (!base) {
  48691. if (inBrowser) {
  48692. // respect <base> tag
  48693. var baseEl = document.querySelector('base');
  48694. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48695. // strip full URL origin
  48696. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48697. } else {
  48698. base = '/';
  48699. }
  48700. }
  48701. // make sure there's the starting slash
  48702. if (base.charAt(0) !== '/') {
  48703. base = '/' + base;
  48704. }
  48705. // remove trailing slash
  48706. return base.replace(/\/$/, '')
  48707. }
  48708. function resolveQueue (
  48709. current,
  48710. next
  48711. ) {
  48712. var i;
  48713. var max = Math.max(current.length, next.length);
  48714. for (i = 0; i < max; i++) {
  48715. if (current[i] !== next[i]) {
  48716. break
  48717. }
  48718. }
  48719. return {
  48720. updated: next.slice(0, i),
  48721. activated: next.slice(i),
  48722. deactivated: current.slice(i)
  48723. }
  48724. }
  48725. function extractGuards (
  48726. records,
  48727. name,
  48728. bind,
  48729. reverse
  48730. ) {
  48731. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48732. var guard = extractGuard(def, name);
  48733. if (guard) {
  48734. return Array.isArray(guard)
  48735. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48736. : bind(guard, instance, match, key)
  48737. }
  48738. });
  48739. return flatten(reverse ? guards.reverse() : guards)
  48740. }
  48741. function extractGuard (
  48742. def,
  48743. key
  48744. ) {
  48745. if (typeof def !== 'function') {
  48746. // extend now so that global mixins are applied.
  48747. def = _Vue.extend(def);
  48748. }
  48749. return def.options[key]
  48750. }
  48751. function extractLeaveGuards (deactivated) {
  48752. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48753. }
  48754. function extractUpdateHooks (updated) {
  48755. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48756. }
  48757. function bindGuard (guard, instance) {
  48758. if (instance) {
  48759. return function boundRouteGuard () {
  48760. return guard.apply(instance, arguments)
  48761. }
  48762. }
  48763. }
  48764. function extractEnterGuards (
  48765. activated,
  48766. cbs,
  48767. isValid
  48768. ) {
  48769. return extractGuards(
  48770. activated,
  48771. 'beforeRouteEnter',
  48772. function (guard, _, match, key) {
  48773. return bindEnterGuard(guard, match, key, cbs, isValid)
  48774. }
  48775. )
  48776. }
  48777. function bindEnterGuard (
  48778. guard,
  48779. match,
  48780. key,
  48781. cbs,
  48782. isValid
  48783. ) {
  48784. return function routeEnterGuard (to, from, next) {
  48785. return guard(to, from, function (cb) {
  48786. if (typeof cb === 'function') {
  48787. cbs.push(function () {
  48788. // #750
  48789. // if a router-view is wrapped with an out-in transition,
  48790. // the instance may not have been registered at this time.
  48791. // we will need to poll for registration until current route
  48792. // is no longer valid.
  48793. poll(cb, match.instances, key, isValid);
  48794. });
  48795. }
  48796. next(cb);
  48797. })
  48798. }
  48799. }
  48800. function poll (
  48801. cb, // somehow flow cannot infer this is a function
  48802. instances,
  48803. key,
  48804. isValid
  48805. ) {
  48806. if (
  48807. instances[key] &&
  48808. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48809. ) {
  48810. cb(instances[key]);
  48811. } else if (isValid()) {
  48812. setTimeout(function () {
  48813. poll(cb, instances, key, isValid);
  48814. }, 16);
  48815. }
  48816. }
  48817. /* */
  48818. var HTML5History = /*@__PURE__*/(function (History) {
  48819. function HTML5History (router, base) {
  48820. var this$1 = this;
  48821. History.call(this, router, base);
  48822. var expectScroll = router.options.scrollBehavior;
  48823. var supportsScroll = supportsPushState && expectScroll;
  48824. if (supportsScroll) {
  48825. setupScroll();
  48826. }
  48827. var initLocation = getLocation(this.base);
  48828. window.addEventListener('popstate', function (e) {
  48829. var current = this$1.current;
  48830. // Avoiding first `popstate` event dispatched in some browsers but first
  48831. // history route not updated since async guard at the same time.
  48832. var location = getLocation(this$1.base);
  48833. if (this$1.current === START && location === initLocation) {
  48834. return
  48835. }
  48836. this$1.transitionTo(location, function (route) {
  48837. if (supportsScroll) {
  48838. handleScroll(router, route, current, true);
  48839. }
  48840. });
  48841. });
  48842. }
  48843. if ( History ) HTML5History.__proto__ = History;
  48844. HTML5History.prototype = Object.create( History && History.prototype );
  48845. HTML5History.prototype.constructor = HTML5History;
  48846. HTML5History.prototype.go = function go (n) {
  48847. window.history.go(n);
  48848. };
  48849. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48850. var this$1 = this;
  48851. var ref = this;
  48852. var fromRoute = ref.current;
  48853. this.transitionTo(location, function (route) {
  48854. pushState(cleanPath(this$1.base + route.fullPath));
  48855. handleScroll(this$1.router, route, fromRoute, false);
  48856. onComplete && onComplete(route);
  48857. }, onAbort);
  48858. };
  48859. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48860. var this$1 = this;
  48861. var ref = this;
  48862. var fromRoute = ref.current;
  48863. this.transitionTo(location, function (route) {
  48864. replaceState(cleanPath(this$1.base + route.fullPath));
  48865. handleScroll(this$1.router, route, fromRoute, false);
  48866. onComplete && onComplete(route);
  48867. }, onAbort);
  48868. };
  48869. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48870. if (getLocation(this.base) !== this.current.fullPath) {
  48871. var current = cleanPath(this.base + this.current.fullPath);
  48872. push ? pushState(current) : replaceState(current);
  48873. }
  48874. };
  48875. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48876. return getLocation(this.base)
  48877. };
  48878. return HTML5History;
  48879. }(History));
  48880. function getLocation (base) {
  48881. var path = decodeURI(window.location.pathname);
  48882. if (base && path.indexOf(base) === 0) {
  48883. path = path.slice(base.length);
  48884. }
  48885. return (path || '/') + window.location.search + window.location.hash
  48886. }
  48887. /* */
  48888. var HashHistory = /*@__PURE__*/(function (History) {
  48889. function HashHistory (router, base, fallback) {
  48890. History.call(this, router, base);
  48891. // check history fallback deeplinking
  48892. if (fallback && checkFallback(this.base)) {
  48893. return
  48894. }
  48895. ensureSlash();
  48896. }
  48897. if ( History ) HashHistory.__proto__ = History;
  48898. HashHistory.prototype = Object.create( History && History.prototype );
  48899. HashHistory.prototype.constructor = HashHistory;
  48900. // this is delayed until the app mounts
  48901. // to avoid the hashchange listener being fired too early
  48902. HashHistory.prototype.setupListeners = function setupListeners () {
  48903. var this$1 = this;
  48904. var router = this.router;
  48905. var expectScroll = router.options.scrollBehavior;
  48906. var supportsScroll = supportsPushState && expectScroll;
  48907. if (supportsScroll) {
  48908. setupScroll();
  48909. }
  48910. window.addEventListener(
  48911. supportsPushState ? 'popstate' : 'hashchange',
  48912. function () {
  48913. var current = this$1.current;
  48914. if (!ensureSlash()) {
  48915. return
  48916. }
  48917. this$1.transitionTo(getHash(), function (route) {
  48918. if (supportsScroll) {
  48919. handleScroll(this$1.router, route, current, true);
  48920. }
  48921. if (!supportsPushState) {
  48922. replaceHash(route.fullPath);
  48923. }
  48924. });
  48925. }
  48926. );
  48927. };
  48928. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48929. var this$1 = this;
  48930. var ref = this;
  48931. var fromRoute = ref.current;
  48932. this.transitionTo(
  48933. location,
  48934. function (route) {
  48935. pushHash(route.fullPath);
  48936. handleScroll(this$1.router, route, fromRoute, false);
  48937. onComplete && onComplete(route);
  48938. },
  48939. onAbort
  48940. );
  48941. };
  48942. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48943. var this$1 = this;
  48944. var ref = this;
  48945. var fromRoute = ref.current;
  48946. this.transitionTo(
  48947. location,
  48948. function (route) {
  48949. replaceHash(route.fullPath);
  48950. handleScroll(this$1.router, route, fromRoute, false);
  48951. onComplete && onComplete(route);
  48952. },
  48953. onAbort
  48954. );
  48955. };
  48956. HashHistory.prototype.go = function go (n) {
  48957. window.history.go(n);
  48958. };
  48959. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48960. var current = this.current.fullPath;
  48961. if (getHash() !== current) {
  48962. push ? pushHash(current) : replaceHash(current);
  48963. }
  48964. };
  48965. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48966. return getHash()
  48967. };
  48968. return HashHistory;
  48969. }(History));
  48970. function checkFallback (base) {
  48971. var location = getLocation(base);
  48972. if (!/^\/#/.test(location)) {
  48973. window.location.replace(cleanPath(base + '/#' + location));
  48974. return true
  48975. }
  48976. }
  48977. function ensureSlash () {
  48978. var path = getHash();
  48979. if (path.charAt(0) === '/') {
  48980. return true
  48981. }
  48982. replaceHash('/' + path);
  48983. return false
  48984. }
  48985. function getHash () {
  48986. // We can't use window.location.hash here because it's not
  48987. // consistent across browsers - Firefox will pre-decode it!
  48988. var href = window.location.href;
  48989. var index = href.indexOf('#');
  48990. // empty path
  48991. if (index < 0) { return '' }
  48992. href = href.slice(index + 1);
  48993. // decode the hash but not the search or hash
  48994. // as search(query) is already decoded
  48995. // https://github.com/vuejs/vue-router/issues/2708
  48996. var searchIndex = href.indexOf('?');
  48997. if (searchIndex < 0) {
  48998. var hashIndex = href.indexOf('#');
  48999. if (hashIndex > -1) {
  49000. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  49001. } else { href = decodeURI(href); }
  49002. } else {
  49003. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  49004. }
  49005. return href
  49006. }
  49007. function getUrl (path) {
  49008. var href = window.location.href;
  49009. var i = href.indexOf('#');
  49010. var base = i >= 0 ? href.slice(0, i) : href;
  49011. return (base + "#" + path)
  49012. }
  49013. function pushHash (path) {
  49014. if (supportsPushState) {
  49015. pushState(getUrl(path));
  49016. } else {
  49017. window.location.hash = path;
  49018. }
  49019. }
  49020. function replaceHash (path) {
  49021. if (supportsPushState) {
  49022. replaceState(getUrl(path));
  49023. } else {
  49024. window.location.replace(getUrl(path));
  49025. }
  49026. }
  49027. /* */
  49028. var AbstractHistory = /*@__PURE__*/(function (History) {
  49029. function AbstractHistory (router, base) {
  49030. History.call(this, router, base);
  49031. this.stack = [];
  49032. this.index = -1;
  49033. }
  49034. if ( History ) AbstractHistory.__proto__ = History;
  49035. AbstractHistory.prototype = Object.create( History && History.prototype );
  49036. AbstractHistory.prototype.constructor = AbstractHistory;
  49037. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49038. var this$1 = this;
  49039. this.transitionTo(
  49040. location,
  49041. function (route) {
  49042. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49043. this$1.index++;
  49044. onComplete && onComplete(route);
  49045. },
  49046. onAbort
  49047. );
  49048. };
  49049. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49050. var this$1 = this;
  49051. this.transitionTo(
  49052. location,
  49053. function (route) {
  49054. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49055. onComplete && onComplete(route);
  49056. },
  49057. onAbort
  49058. );
  49059. };
  49060. AbstractHistory.prototype.go = function go (n) {
  49061. var this$1 = this;
  49062. var targetIndex = this.index + n;
  49063. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49064. return
  49065. }
  49066. var route = this.stack[targetIndex];
  49067. this.confirmTransition(
  49068. route,
  49069. function () {
  49070. this$1.index = targetIndex;
  49071. this$1.updateRoute(route);
  49072. },
  49073. function (err) {
  49074. if (isExtendedError(NavigationDuplicated, err)) {
  49075. this$1.index = targetIndex;
  49076. }
  49077. }
  49078. );
  49079. };
  49080. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49081. var current = this.stack[this.stack.length - 1];
  49082. return current ? current.fullPath : '/'
  49083. };
  49084. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49085. // noop
  49086. };
  49087. return AbstractHistory;
  49088. }(History));
  49089. /* */
  49090. var VueRouter = function VueRouter (options) {
  49091. if ( options === void 0 ) options = {};
  49092. this.app = null;
  49093. this.apps = [];
  49094. this.options = options;
  49095. this.beforeHooks = [];
  49096. this.resolveHooks = [];
  49097. this.afterHooks = [];
  49098. this.matcher = createMatcher(options.routes || [], this);
  49099. var mode = options.mode || 'hash';
  49100. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49101. if (this.fallback) {
  49102. mode = 'hash';
  49103. }
  49104. if (!inBrowser) {
  49105. mode = 'abstract';
  49106. }
  49107. this.mode = mode;
  49108. switch (mode) {
  49109. case 'history':
  49110. this.history = new HTML5History(this, options.base);
  49111. break
  49112. case 'hash':
  49113. this.history = new HashHistory(this, options.base, this.fallback);
  49114. break
  49115. case 'abstract':
  49116. this.history = new AbstractHistory(this, options.base);
  49117. break
  49118. default:
  49119. if (true) {
  49120. assert(false, ("invalid mode: " + mode));
  49121. }
  49122. }
  49123. };
  49124. var prototypeAccessors = { currentRoute: { configurable: true } };
  49125. VueRouter.prototype.match = function match (
  49126. raw,
  49127. current,
  49128. redirectedFrom
  49129. ) {
  49130. return this.matcher.match(raw, current, redirectedFrom)
  49131. };
  49132. prototypeAccessors.currentRoute.get = function () {
  49133. return this.history && this.history.current
  49134. };
  49135. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49136. var this$1 = this;
  49137. true && assert(
  49138. install.installed,
  49139. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49140. "before creating root instance."
  49141. );
  49142. this.apps.push(app);
  49143. // set up app destroyed handler
  49144. // https://github.com/vuejs/vue-router/issues/2639
  49145. app.$once('hook:destroyed', function () {
  49146. // clean out app from this.apps array once destroyed
  49147. var index = this$1.apps.indexOf(app);
  49148. if (index > -1) { this$1.apps.splice(index, 1); }
  49149. // ensure we still have a main app or null if no apps
  49150. // we do not release the router so it can be reused
  49151. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49152. });
  49153. // main app previously initialized
  49154. // return as we don't need to set up new history listener
  49155. if (this.app) {
  49156. return
  49157. }
  49158. this.app = app;
  49159. var history = this.history;
  49160. if (history instanceof HTML5History) {
  49161. history.transitionTo(history.getCurrentLocation());
  49162. } else if (history instanceof HashHistory) {
  49163. var setupHashListener = function () {
  49164. history.setupListeners();
  49165. };
  49166. history.transitionTo(
  49167. history.getCurrentLocation(),
  49168. setupHashListener,
  49169. setupHashListener
  49170. );
  49171. }
  49172. history.listen(function (route) {
  49173. this$1.apps.forEach(function (app) {
  49174. app._route = route;
  49175. });
  49176. });
  49177. };
  49178. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49179. return registerHook(this.beforeHooks, fn)
  49180. };
  49181. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49182. return registerHook(this.resolveHooks, fn)
  49183. };
  49184. VueRouter.prototype.afterEach = function afterEach (fn) {
  49185. return registerHook(this.afterHooks, fn)
  49186. };
  49187. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49188. this.history.onReady(cb, errorCb);
  49189. };
  49190. VueRouter.prototype.onError = function onError (errorCb) {
  49191. this.history.onError(errorCb);
  49192. };
  49193. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49194. var this$1 = this;
  49195. // $flow-disable-line
  49196. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49197. return new Promise(function (resolve, reject) {
  49198. this$1.history.push(location, resolve, reject);
  49199. })
  49200. } else {
  49201. this.history.push(location, onComplete, onAbort);
  49202. }
  49203. };
  49204. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49205. var this$1 = this;
  49206. // $flow-disable-line
  49207. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49208. return new Promise(function (resolve, reject) {
  49209. this$1.history.replace(location, resolve, reject);
  49210. })
  49211. } else {
  49212. this.history.replace(location, onComplete, onAbort);
  49213. }
  49214. };
  49215. VueRouter.prototype.go = function go (n) {
  49216. this.history.go(n);
  49217. };
  49218. VueRouter.prototype.back = function back () {
  49219. this.go(-1);
  49220. };
  49221. VueRouter.prototype.forward = function forward () {
  49222. this.go(1);
  49223. };
  49224. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49225. var route = to
  49226. ? to.matched
  49227. ? to
  49228. : this.resolve(to).route
  49229. : this.currentRoute;
  49230. if (!route) {
  49231. return []
  49232. }
  49233. return [].concat.apply([], route.matched.map(function (m) {
  49234. return Object.keys(m.components).map(function (key) {
  49235. return m.components[key]
  49236. })
  49237. }))
  49238. };
  49239. VueRouter.prototype.resolve = function resolve (
  49240. to,
  49241. current,
  49242. append
  49243. ) {
  49244. current = current || this.history.current;
  49245. var location = normalizeLocation(
  49246. to,
  49247. current,
  49248. append,
  49249. this
  49250. );
  49251. var route = this.match(location, current);
  49252. var fullPath = route.redirectedFrom || route.fullPath;
  49253. var base = this.history.base;
  49254. var href = createHref(base, fullPath, this.mode);
  49255. return {
  49256. location: location,
  49257. route: route,
  49258. href: href,
  49259. // for backwards compat
  49260. normalizedTo: location,
  49261. resolved: route
  49262. }
  49263. };
  49264. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49265. this.matcher.addRoutes(routes);
  49266. if (this.history.current !== START) {
  49267. this.history.transitionTo(this.history.getCurrentLocation());
  49268. }
  49269. };
  49270. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49271. function registerHook (list, fn) {
  49272. list.push(fn);
  49273. return function () {
  49274. var i = list.indexOf(fn);
  49275. if (i > -1) { list.splice(i, 1); }
  49276. }
  49277. }
  49278. function createHref (base, fullPath, mode) {
  49279. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49280. return base ? cleanPath(base + '/' + path) : path
  49281. }
  49282. VueRouter.install = install;
  49283. VueRouter.version = '3.1.6';
  49284. if (inBrowser && window.Vue) {
  49285. window.Vue.use(VueRouter);
  49286. }
  49287. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49288. /***/ }),
  49289. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49290. /*!*************************************************!*\
  49291. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49292. \*************************************************/
  49293. /*! no static exports found */
  49294. /***/ (function(module, exports, __webpack_require__) {
  49295. "use strict";
  49296. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49297. * Vue.js v2.6.11
  49298. * (c) 2014-2019 Evan You
  49299. * Released under the MIT License.
  49300. */
  49301. /* */
  49302. var emptyObject = Object.freeze({});
  49303. // These helpers produce better VM code in JS engines due to their
  49304. // explicitness and function inlining.
  49305. function isUndef (v) {
  49306. return v === undefined || v === null
  49307. }
  49308. function isDef (v) {
  49309. return v !== undefined && v !== null
  49310. }
  49311. function isTrue (v) {
  49312. return v === true
  49313. }
  49314. function isFalse (v) {
  49315. return v === false
  49316. }
  49317. /**
  49318. * Check if value is primitive.
  49319. */
  49320. function isPrimitive (value) {
  49321. return (
  49322. typeof value === 'string' ||
  49323. typeof value === 'number' ||
  49324. // $flow-disable-line
  49325. typeof value === 'symbol' ||
  49326. typeof value === 'boolean'
  49327. )
  49328. }
  49329. /**
  49330. * Quick object check - this is primarily used to tell
  49331. * Objects from primitive values when we know the value
  49332. * is a JSON-compliant type.
  49333. */
  49334. function isObject (obj) {
  49335. return obj !== null && typeof obj === 'object'
  49336. }
  49337. /**
  49338. * Get the raw type string of a value, e.g., [object Object].
  49339. */
  49340. var _toString = Object.prototype.toString;
  49341. function toRawType (value) {
  49342. return _toString.call(value).slice(8, -1)
  49343. }
  49344. /**
  49345. * Strict object type check. Only returns true
  49346. * for plain JavaScript objects.
  49347. */
  49348. function isPlainObject (obj) {
  49349. return _toString.call(obj) === '[object Object]'
  49350. }
  49351. function isRegExp (v) {
  49352. return _toString.call(v) === '[object RegExp]'
  49353. }
  49354. /**
  49355. * Check if val is a valid array index.
  49356. */
  49357. function isValidArrayIndex (val) {
  49358. var n = parseFloat(String(val));
  49359. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49360. }
  49361. function isPromise (val) {
  49362. return (
  49363. isDef(val) &&
  49364. typeof val.then === 'function' &&
  49365. typeof val.catch === 'function'
  49366. )
  49367. }
  49368. /**
  49369. * Convert a value to a string that is actually rendered.
  49370. */
  49371. function toString (val) {
  49372. return val == null
  49373. ? ''
  49374. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49375. ? JSON.stringify(val, null, 2)
  49376. : String(val)
  49377. }
  49378. /**
  49379. * Convert an input value to a number for persistence.
  49380. * If the conversion fails, return original string.
  49381. */
  49382. function toNumber (val) {
  49383. var n = parseFloat(val);
  49384. return isNaN(n) ? val : n
  49385. }
  49386. /**
  49387. * Make a map and return a function for checking if a key
  49388. * is in that map.
  49389. */
  49390. function makeMap (
  49391. str,
  49392. expectsLowerCase
  49393. ) {
  49394. var map = Object.create(null);
  49395. var list = str.split(',');
  49396. for (var i = 0; i < list.length; i++) {
  49397. map[list[i]] = true;
  49398. }
  49399. return expectsLowerCase
  49400. ? function (val) { return map[val.toLowerCase()]; }
  49401. : function (val) { return map[val]; }
  49402. }
  49403. /**
  49404. * Check if a tag is a built-in tag.
  49405. */
  49406. var isBuiltInTag = makeMap('slot,component', true);
  49407. /**
  49408. * Check if an attribute is a reserved attribute.
  49409. */
  49410. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49411. /**
  49412. * Remove an item from an array.
  49413. */
  49414. function remove (arr, item) {
  49415. if (arr.length) {
  49416. var index = arr.indexOf(item);
  49417. if (index > -1) {
  49418. return arr.splice(index, 1)
  49419. }
  49420. }
  49421. }
  49422. /**
  49423. * Check whether an object has the property.
  49424. */
  49425. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49426. function hasOwn (obj, key) {
  49427. return hasOwnProperty.call(obj, key)
  49428. }
  49429. /**
  49430. * Create a cached version of a pure function.
  49431. */
  49432. function cached (fn) {
  49433. var cache = Object.create(null);
  49434. return (function cachedFn (str) {
  49435. var hit = cache[str];
  49436. return hit || (cache[str] = fn(str))
  49437. })
  49438. }
  49439. /**
  49440. * Camelize a hyphen-delimited string.
  49441. */
  49442. var camelizeRE = /-(\w)/g;
  49443. var camelize = cached(function (str) {
  49444. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49445. });
  49446. /**
  49447. * Capitalize a string.
  49448. */
  49449. var capitalize = cached(function (str) {
  49450. return str.charAt(0).toUpperCase() + str.slice(1)
  49451. });
  49452. /**
  49453. * Hyphenate a camelCase string.
  49454. */
  49455. var hyphenateRE = /\B([A-Z])/g;
  49456. var hyphenate = cached(function (str) {
  49457. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49458. });
  49459. /**
  49460. * Simple bind polyfill for environments that do not support it,
  49461. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49462. * since native bind is now performant enough in most browsers.
  49463. * But removing it would mean breaking code that was able to run in
  49464. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49465. */
  49466. /* istanbul ignore next */
  49467. function polyfillBind (fn, ctx) {
  49468. function boundFn (a) {
  49469. var l = arguments.length;
  49470. return l
  49471. ? l > 1
  49472. ? fn.apply(ctx, arguments)
  49473. : fn.call(ctx, a)
  49474. : fn.call(ctx)
  49475. }
  49476. boundFn._length = fn.length;
  49477. return boundFn
  49478. }
  49479. function nativeBind (fn, ctx) {
  49480. return fn.bind(ctx)
  49481. }
  49482. var bind = Function.prototype.bind
  49483. ? nativeBind
  49484. : polyfillBind;
  49485. /**
  49486. * Convert an Array-like object to a real Array.
  49487. */
  49488. function toArray (list, start) {
  49489. start = start || 0;
  49490. var i = list.length - start;
  49491. var ret = new Array(i);
  49492. while (i--) {
  49493. ret[i] = list[i + start];
  49494. }
  49495. return ret
  49496. }
  49497. /**
  49498. * Mix properties into target object.
  49499. */
  49500. function extend (to, _from) {
  49501. for (var key in _from) {
  49502. to[key] = _from[key];
  49503. }
  49504. return to
  49505. }
  49506. /**
  49507. * Merge an Array of Objects into a single Object.
  49508. */
  49509. function toObject (arr) {
  49510. var res = {};
  49511. for (var i = 0; i < arr.length; i++) {
  49512. if (arr[i]) {
  49513. extend(res, arr[i]);
  49514. }
  49515. }
  49516. return res
  49517. }
  49518. /* eslint-disable no-unused-vars */
  49519. /**
  49520. * Perform no operation.
  49521. * Stubbing args to make Flow happy without leaving useless transpiled code
  49522. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49523. */
  49524. function noop (a, b, c) {}
  49525. /**
  49526. * Always return false.
  49527. */
  49528. var no = function (a, b, c) { return false; };
  49529. /* eslint-enable no-unused-vars */
  49530. /**
  49531. * Return the same value.
  49532. */
  49533. var identity = function (_) { return _; };
  49534. /**
  49535. * Generate a string containing static keys from compiler modules.
  49536. */
  49537. function genStaticKeys (modules) {
  49538. return modules.reduce(function (keys, m) {
  49539. return keys.concat(m.staticKeys || [])
  49540. }, []).join(',')
  49541. }
  49542. /**
  49543. * Check if two values are loosely equal - that is,
  49544. * if they are plain objects, do they have the same shape?
  49545. */
  49546. function looseEqual (a, b) {
  49547. if (a === b) { return true }
  49548. var isObjectA = isObject(a);
  49549. var isObjectB = isObject(b);
  49550. if (isObjectA && isObjectB) {
  49551. try {
  49552. var isArrayA = Array.isArray(a);
  49553. var isArrayB = Array.isArray(b);
  49554. if (isArrayA && isArrayB) {
  49555. return a.length === b.length && a.every(function (e, i) {
  49556. return looseEqual(e, b[i])
  49557. })
  49558. } else if (a instanceof Date && b instanceof Date) {
  49559. return a.getTime() === b.getTime()
  49560. } else if (!isArrayA && !isArrayB) {
  49561. var keysA = Object.keys(a);
  49562. var keysB = Object.keys(b);
  49563. return keysA.length === keysB.length && keysA.every(function (key) {
  49564. return looseEqual(a[key], b[key])
  49565. })
  49566. } else {
  49567. /* istanbul ignore next */
  49568. return false
  49569. }
  49570. } catch (e) {
  49571. /* istanbul ignore next */
  49572. return false
  49573. }
  49574. } else if (!isObjectA && !isObjectB) {
  49575. return String(a) === String(b)
  49576. } else {
  49577. return false
  49578. }
  49579. }
  49580. /**
  49581. * Return the first index at which a loosely equal value can be
  49582. * found in the array (if value is a plain object, the array must
  49583. * contain an object of the same shape), or -1 if it is not present.
  49584. */
  49585. function looseIndexOf (arr, val) {
  49586. for (var i = 0; i < arr.length; i++) {
  49587. if (looseEqual(arr[i], val)) { return i }
  49588. }
  49589. return -1
  49590. }
  49591. /**
  49592. * Ensure a function is called only once.
  49593. */
  49594. function once (fn) {
  49595. var called = false;
  49596. return function () {
  49597. if (!called) {
  49598. called = true;
  49599. fn.apply(this, arguments);
  49600. }
  49601. }
  49602. }
  49603. var SSR_ATTR = 'data-server-rendered';
  49604. var ASSET_TYPES = [
  49605. 'component',
  49606. 'directive',
  49607. 'filter'
  49608. ];
  49609. var LIFECYCLE_HOOKS = [
  49610. 'beforeCreate',
  49611. 'created',
  49612. 'beforeMount',
  49613. 'mounted',
  49614. 'beforeUpdate',
  49615. 'updated',
  49616. 'beforeDestroy',
  49617. 'destroyed',
  49618. 'activated',
  49619. 'deactivated',
  49620. 'errorCaptured',
  49621. 'serverPrefetch'
  49622. ];
  49623. /* */
  49624. var config = ({
  49625. /**
  49626. * Option merge strategies (used in core/util/options)
  49627. */
  49628. // $flow-disable-line
  49629. optionMergeStrategies: Object.create(null),
  49630. /**
  49631. * Whether to suppress warnings.
  49632. */
  49633. silent: false,
  49634. /**
  49635. * Show production mode tip message on boot?
  49636. */
  49637. productionTip: "development" !== 'production',
  49638. /**
  49639. * Whether to enable devtools
  49640. */
  49641. devtools: "development" !== 'production',
  49642. /**
  49643. * Whether to record perf
  49644. */
  49645. performance: false,
  49646. /**
  49647. * Error handler for watcher errors
  49648. */
  49649. errorHandler: null,
  49650. /**
  49651. * Warn handler for watcher warns
  49652. */
  49653. warnHandler: null,
  49654. /**
  49655. * Ignore certain custom elements
  49656. */
  49657. ignoredElements: [],
  49658. /**
  49659. * Custom user key aliases for v-on
  49660. */
  49661. // $flow-disable-line
  49662. keyCodes: Object.create(null),
  49663. /**
  49664. * Check if a tag is reserved so that it cannot be registered as a
  49665. * component. This is platform-dependent and may be overwritten.
  49666. */
  49667. isReservedTag: no,
  49668. /**
  49669. * Check if an attribute is reserved so that it cannot be used as a component
  49670. * prop. This is platform-dependent and may be overwritten.
  49671. */
  49672. isReservedAttr: no,
  49673. /**
  49674. * Check if a tag is an unknown element.
  49675. * Platform-dependent.
  49676. */
  49677. isUnknownElement: no,
  49678. /**
  49679. * Get the namespace of an element
  49680. */
  49681. getTagNamespace: noop,
  49682. /**
  49683. * Parse the real tag name for the specific platform.
  49684. */
  49685. parsePlatformTagName: identity,
  49686. /**
  49687. * Check if an attribute must be bound using property, e.g. value
  49688. * Platform-dependent.
  49689. */
  49690. mustUseProp: no,
  49691. /**
  49692. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49693. * This will significantly reduce performance if set to false.
  49694. */
  49695. async: true,
  49696. /**
  49697. * Exposed for legacy reasons
  49698. */
  49699. _lifecycleHooks: LIFECYCLE_HOOKS
  49700. });
  49701. /* */
  49702. /**
  49703. * unicode letters used for parsing html tags, component names and property paths.
  49704. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49705. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49706. */
  49707. 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/;
  49708. /**
  49709. * Check if a string starts with $ or _
  49710. */
  49711. function isReserved (str) {
  49712. var c = (str + '').charCodeAt(0);
  49713. return c === 0x24 || c === 0x5F
  49714. }
  49715. /**
  49716. * Define a property.
  49717. */
  49718. function def (obj, key, val, enumerable) {
  49719. Object.defineProperty(obj, key, {
  49720. value: val,
  49721. enumerable: !!enumerable,
  49722. writable: true,
  49723. configurable: true
  49724. });
  49725. }
  49726. /**
  49727. * Parse simple path.
  49728. */
  49729. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49730. function parsePath (path) {
  49731. if (bailRE.test(path)) {
  49732. return
  49733. }
  49734. var segments = path.split('.');
  49735. return function (obj) {
  49736. for (var i = 0; i < segments.length; i++) {
  49737. if (!obj) { return }
  49738. obj = obj[segments[i]];
  49739. }
  49740. return obj
  49741. }
  49742. }
  49743. /* */
  49744. // can we use __proto__?
  49745. var hasProto = '__proto__' in {};
  49746. // Browser environment sniffing
  49747. var inBrowser = typeof window !== 'undefined';
  49748. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49749. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49750. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49751. var isIE = UA && /msie|trident/.test(UA);
  49752. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49753. var isEdge = UA && UA.indexOf('edge/') > 0;
  49754. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49755. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49756. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49757. var isPhantomJS = UA && /phantomjs/.test(UA);
  49758. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49759. // Firefox has a "watch" function on Object.prototype...
  49760. var nativeWatch = ({}).watch;
  49761. var supportsPassive = false;
  49762. if (inBrowser) {
  49763. try {
  49764. var opts = {};
  49765. Object.defineProperty(opts, 'passive', ({
  49766. get: function get () {
  49767. /* istanbul ignore next */
  49768. supportsPassive = true;
  49769. }
  49770. })); // https://github.com/facebook/flow/issues/285
  49771. window.addEventListener('test-passive', null, opts);
  49772. } catch (e) {}
  49773. }
  49774. // this needs to be lazy-evaled because vue may be required before
  49775. // vue-server-renderer can set VUE_ENV
  49776. var _isServer;
  49777. var isServerRendering = function () {
  49778. if (_isServer === undefined) {
  49779. /* istanbul ignore if */
  49780. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49781. // detect presence of vue-server-renderer and avoid
  49782. // Webpack shimming the process
  49783. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49784. } else {
  49785. _isServer = false;
  49786. }
  49787. }
  49788. return _isServer
  49789. };
  49790. // detect devtools
  49791. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49792. /* istanbul ignore next */
  49793. function isNative (Ctor) {
  49794. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49795. }
  49796. var hasSymbol =
  49797. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49798. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49799. var _Set;
  49800. /* istanbul ignore if */ // $flow-disable-line
  49801. if (typeof Set !== 'undefined' && isNative(Set)) {
  49802. // use native Set when available.
  49803. _Set = Set;
  49804. } else {
  49805. // a non-standard Set polyfill that only works with primitive keys.
  49806. _Set = /*@__PURE__*/(function () {
  49807. function Set () {
  49808. this.set = Object.create(null);
  49809. }
  49810. Set.prototype.has = function has (key) {
  49811. return this.set[key] === true
  49812. };
  49813. Set.prototype.add = function add (key) {
  49814. this.set[key] = true;
  49815. };
  49816. Set.prototype.clear = function clear () {
  49817. this.set = Object.create(null);
  49818. };
  49819. return Set;
  49820. }());
  49821. }
  49822. /* */
  49823. var warn = noop;
  49824. var tip = noop;
  49825. var generateComponentTrace = (noop); // work around flow check
  49826. var formatComponentName = (noop);
  49827. {
  49828. var hasConsole = typeof console !== 'undefined';
  49829. var classifyRE = /(?:^|[-_])(\w)/g;
  49830. var classify = function (str) { return str
  49831. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49832. .replace(/[-_]/g, ''); };
  49833. warn = function (msg, vm) {
  49834. var trace = vm ? generateComponentTrace(vm) : '';
  49835. if (config.warnHandler) {
  49836. config.warnHandler.call(null, msg, vm, trace);
  49837. } else if (hasConsole && (!config.silent)) {
  49838. console.error(("[Vue warn]: " + msg + trace));
  49839. }
  49840. };
  49841. tip = function (msg, vm) {
  49842. if (hasConsole && (!config.silent)) {
  49843. console.warn("[Vue tip]: " + msg + (
  49844. vm ? generateComponentTrace(vm) : ''
  49845. ));
  49846. }
  49847. };
  49848. formatComponentName = function (vm, includeFile) {
  49849. if (vm.$root === vm) {
  49850. return '<Root>'
  49851. }
  49852. var options = typeof vm === 'function' && vm.cid != null
  49853. ? vm.options
  49854. : vm._isVue
  49855. ? vm.$options || vm.constructor.options
  49856. : vm;
  49857. var name = options.name || options._componentTag;
  49858. var file = options.__file;
  49859. if (!name && file) {
  49860. var match = file.match(/([^/\\]+)\.vue$/);
  49861. name = match && match[1];
  49862. }
  49863. return (
  49864. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49865. (file && includeFile !== false ? (" at " + file) : '')
  49866. )
  49867. };
  49868. var repeat = function (str, n) {
  49869. var res = '';
  49870. while (n) {
  49871. if (n % 2 === 1) { res += str; }
  49872. if (n > 1) { str += str; }
  49873. n >>= 1;
  49874. }
  49875. return res
  49876. };
  49877. generateComponentTrace = function (vm) {
  49878. if (vm._isVue && vm.$parent) {
  49879. var tree = [];
  49880. var currentRecursiveSequence = 0;
  49881. while (vm) {
  49882. if (tree.length > 0) {
  49883. var last = tree[tree.length - 1];
  49884. if (last.constructor === vm.constructor) {
  49885. currentRecursiveSequence++;
  49886. vm = vm.$parent;
  49887. continue
  49888. } else if (currentRecursiveSequence > 0) {
  49889. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49890. currentRecursiveSequence = 0;
  49891. }
  49892. }
  49893. tree.push(vm);
  49894. vm = vm.$parent;
  49895. }
  49896. return '\n\nfound in\n\n' + tree
  49897. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49898. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49899. : formatComponentName(vm))); })
  49900. .join('\n')
  49901. } else {
  49902. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49903. }
  49904. };
  49905. }
  49906. /* */
  49907. var uid = 0;
  49908. /**
  49909. * A dep is an observable that can have multiple
  49910. * directives subscribing to it.
  49911. */
  49912. var Dep = function Dep () {
  49913. this.id = uid++;
  49914. this.subs = [];
  49915. };
  49916. Dep.prototype.addSub = function addSub (sub) {
  49917. this.subs.push(sub);
  49918. };
  49919. Dep.prototype.removeSub = function removeSub (sub) {
  49920. remove(this.subs, sub);
  49921. };
  49922. Dep.prototype.depend = function depend () {
  49923. if (Dep.target) {
  49924. Dep.target.addDep(this);
  49925. }
  49926. };
  49927. Dep.prototype.notify = function notify () {
  49928. // stabilize the subscriber list first
  49929. var subs = this.subs.slice();
  49930. if (!config.async) {
  49931. // subs aren't sorted in scheduler if not running async
  49932. // we need to sort them now to make sure they fire in correct
  49933. // order
  49934. subs.sort(function (a, b) { return a.id - b.id; });
  49935. }
  49936. for (var i = 0, l = subs.length; i < l; i++) {
  49937. subs[i].update();
  49938. }
  49939. };
  49940. // The current target watcher being evaluated.
  49941. // This is globally unique because only one watcher
  49942. // can be evaluated at a time.
  49943. Dep.target = null;
  49944. var targetStack = [];
  49945. function pushTarget (target) {
  49946. targetStack.push(target);
  49947. Dep.target = target;
  49948. }
  49949. function popTarget () {
  49950. targetStack.pop();
  49951. Dep.target = targetStack[targetStack.length - 1];
  49952. }
  49953. /* */
  49954. var VNode = function VNode (
  49955. tag,
  49956. data,
  49957. children,
  49958. text,
  49959. elm,
  49960. context,
  49961. componentOptions,
  49962. asyncFactory
  49963. ) {
  49964. this.tag = tag;
  49965. this.data = data;
  49966. this.children = children;
  49967. this.text = text;
  49968. this.elm = elm;
  49969. this.ns = undefined;
  49970. this.context = context;
  49971. this.fnContext = undefined;
  49972. this.fnOptions = undefined;
  49973. this.fnScopeId = undefined;
  49974. this.key = data && data.key;
  49975. this.componentOptions = componentOptions;
  49976. this.componentInstance = undefined;
  49977. this.parent = undefined;
  49978. this.raw = false;
  49979. this.isStatic = false;
  49980. this.isRootInsert = true;
  49981. this.isComment = false;
  49982. this.isCloned = false;
  49983. this.isOnce = false;
  49984. this.asyncFactory = asyncFactory;
  49985. this.asyncMeta = undefined;
  49986. this.isAsyncPlaceholder = false;
  49987. };
  49988. var prototypeAccessors = { child: { configurable: true } };
  49989. // DEPRECATED: alias for componentInstance for backwards compat.
  49990. /* istanbul ignore next */
  49991. prototypeAccessors.child.get = function () {
  49992. return this.componentInstance
  49993. };
  49994. Object.defineProperties( VNode.prototype, prototypeAccessors );
  49995. var createEmptyVNode = function (text) {
  49996. if ( text === void 0 ) text = '';
  49997. var node = new VNode();
  49998. node.text = text;
  49999. node.isComment = true;
  50000. return node
  50001. };
  50002. function createTextVNode (val) {
  50003. return new VNode(undefined, undefined, undefined, String(val))
  50004. }
  50005. // optimized shallow clone
  50006. // used for static nodes and slot nodes because they may be reused across
  50007. // multiple renders, cloning them avoids errors when DOM manipulations rely
  50008. // on their elm reference.
  50009. function cloneVNode (vnode) {
  50010. var cloned = new VNode(
  50011. vnode.tag,
  50012. vnode.data,
  50013. // #7975
  50014. // clone children array to avoid mutating original in case of cloning
  50015. // a child.
  50016. vnode.children && vnode.children.slice(),
  50017. vnode.text,
  50018. vnode.elm,
  50019. vnode.context,
  50020. vnode.componentOptions,
  50021. vnode.asyncFactory
  50022. );
  50023. cloned.ns = vnode.ns;
  50024. cloned.isStatic = vnode.isStatic;
  50025. cloned.key = vnode.key;
  50026. cloned.isComment = vnode.isComment;
  50027. cloned.fnContext = vnode.fnContext;
  50028. cloned.fnOptions = vnode.fnOptions;
  50029. cloned.fnScopeId = vnode.fnScopeId;
  50030. cloned.asyncMeta = vnode.asyncMeta;
  50031. cloned.isCloned = true;
  50032. return cloned
  50033. }
  50034. /*
  50035. * not type checking this file because flow doesn't play well with
  50036. * dynamically accessing methods on Array prototype
  50037. */
  50038. var arrayProto = Array.prototype;
  50039. var arrayMethods = Object.create(arrayProto);
  50040. var methodsToPatch = [
  50041. 'push',
  50042. 'pop',
  50043. 'shift',
  50044. 'unshift',
  50045. 'splice',
  50046. 'sort',
  50047. 'reverse'
  50048. ];
  50049. /**
  50050. * Intercept mutating methods and emit events
  50051. */
  50052. methodsToPatch.forEach(function (method) {
  50053. // cache original method
  50054. var original = arrayProto[method];
  50055. def(arrayMethods, method, function mutator () {
  50056. var args = [], len = arguments.length;
  50057. while ( len-- ) args[ len ] = arguments[ len ];
  50058. var result = original.apply(this, args);
  50059. var ob = this.__ob__;
  50060. var inserted;
  50061. switch (method) {
  50062. case 'push':
  50063. case 'unshift':
  50064. inserted = args;
  50065. break
  50066. case 'splice':
  50067. inserted = args.slice(2);
  50068. break
  50069. }
  50070. if (inserted) { ob.observeArray(inserted); }
  50071. // notify change
  50072. ob.dep.notify();
  50073. return result
  50074. });
  50075. });
  50076. /* */
  50077. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50078. /**
  50079. * In some cases we may want to disable observation inside a component's
  50080. * update computation.
  50081. */
  50082. var shouldObserve = true;
  50083. function toggleObserving (value) {
  50084. shouldObserve = value;
  50085. }
  50086. /**
  50087. * Observer class that is attached to each observed
  50088. * object. Once attached, the observer converts the target
  50089. * object's property keys into getter/setters that
  50090. * collect dependencies and dispatch updates.
  50091. */
  50092. var Observer = function Observer (value) {
  50093. this.value = value;
  50094. this.dep = new Dep();
  50095. this.vmCount = 0;
  50096. def(value, '__ob__', this);
  50097. if (Array.isArray(value)) {
  50098. if (hasProto) {
  50099. protoAugment(value, arrayMethods);
  50100. } else {
  50101. copyAugment(value, arrayMethods, arrayKeys);
  50102. }
  50103. this.observeArray(value);
  50104. } else {
  50105. this.walk(value);
  50106. }
  50107. };
  50108. /**
  50109. * Walk through all properties and convert them into
  50110. * getter/setters. This method should only be called when
  50111. * value type is Object.
  50112. */
  50113. Observer.prototype.walk = function walk (obj) {
  50114. var keys = Object.keys(obj);
  50115. for (var i = 0; i < keys.length; i++) {
  50116. defineReactive$$1(obj, keys[i]);
  50117. }
  50118. };
  50119. /**
  50120. * Observe a list of Array items.
  50121. */
  50122. Observer.prototype.observeArray = function observeArray (items) {
  50123. for (var i = 0, l = items.length; i < l; i++) {
  50124. observe(items[i]);
  50125. }
  50126. };
  50127. // helpers
  50128. /**
  50129. * Augment a target Object or Array by intercepting
  50130. * the prototype chain using __proto__
  50131. */
  50132. function protoAugment (target, src) {
  50133. /* eslint-disable no-proto */
  50134. target.__proto__ = src;
  50135. /* eslint-enable no-proto */
  50136. }
  50137. /**
  50138. * Augment a target Object or Array by defining
  50139. * hidden properties.
  50140. */
  50141. /* istanbul ignore next */
  50142. function copyAugment (target, src, keys) {
  50143. for (var i = 0, l = keys.length; i < l; i++) {
  50144. var key = keys[i];
  50145. def(target, key, src[key]);
  50146. }
  50147. }
  50148. /**
  50149. * Attempt to create an observer instance for a value,
  50150. * returns the new observer if successfully observed,
  50151. * or the existing observer if the value already has one.
  50152. */
  50153. function observe (value, asRootData) {
  50154. if (!isObject(value) || value instanceof VNode) {
  50155. return
  50156. }
  50157. var ob;
  50158. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50159. ob = value.__ob__;
  50160. } else if (
  50161. shouldObserve &&
  50162. !isServerRendering() &&
  50163. (Array.isArray(value) || isPlainObject(value)) &&
  50164. Object.isExtensible(value) &&
  50165. !value._isVue
  50166. ) {
  50167. ob = new Observer(value);
  50168. }
  50169. if (asRootData && ob) {
  50170. ob.vmCount++;
  50171. }
  50172. return ob
  50173. }
  50174. /**
  50175. * Define a reactive property on an Object.
  50176. */
  50177. function defineReactive$$1 (
  50178. obj,
  50179. key,
  50180. val,
  50181. customSetter,
  50182. shallow
  50183. ) {
  50184. var dep = new Dep();
  50185. var property = Object.getOwnPropertyDescriptor(obj, key);
  50186. if (property && property.configurable === false) {
  50187. return
  50188. }
  50189. // cater for pre-defined getter/setters
  50190. var getter = property && property.get;
  50191. var setter = property && property.set;
  50192. if ((!getter || setter) && arguments.length === 2) {
  50193. val = obj[key];
  50194. }
  50195. var childOb = !shallow && observe(val);
  50196. Object.defineProperty(obj, key, {
  50197. enumerable: true,
  50198. configurable: true,
  50199. get: function reactiveGetter () {
  50200. var value = getter ? getter.call(obj) : val;
  50201. if (Dep.target) {
  50202. dep.depend();
  50203. if (childOb) {
  50204. childOb.dep.depend();
  50205. if (Array.isArray(value)) {
  50206. dependArray(value);
  50207. }
  50208. }
  50209. }
  50210. return value
  50211. },
  50212. set: function reactiveSetter (newVal) {
  50213. var value = getter ? getter.call(obj) : val;
  50214. /* eslint-disable no-self-compare */
  50215. if (newVal === value || (newVal !== newVal && value !== value)) {
  50216. return
  50217. }
  50218. /* eslint-enable no-self-compare */
  50219. if (customSetter) {
  50220. customSetter();
  50221. }
  50222. // #7981: for accessor properties without setter
  50223. if (getter && !setter) { return }
  50224. if (setter) {
  50225. setter.call(obj, newVal);
  50226. } else {
  50227. val = newVal;
  50228. }
  50229. childOb = !shallow && observe(newVal);
  50230. dep.notify();
  50231. }
  50232. });
  50233. }
  50234. /**
  50235. * Set a property on an object. Adds the new property and
  50236. * triggers change notification if the property doesn't
  50237. * already exist.
  50238. */
  50239. function set (target, key, val) {
  50240. if (isUndef(target) || isPrimitive(target)
  50241. ) {
  50242. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50243. }
  50244. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50245. target.length = Math.max(target.length, key);
  50246. target.splice(key, 1, val);
  50247. return val
  50248. }
  50249. if (key in target && !(key in Object.prototype)) {
  50250. target[key] = val;
  50251. return val
  50252. }
  50253. var ob = (target).__ob__;
  50254. if (target._isVue || (ob && ob.vmCount)) {
  50255. warn(
  50256. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50257. 'at runtime - declare it upfront in the data option.'
  50258. );
  50259. return val
  50260. }
  50261. if (!ob) {
  50262. target[key] = val;
  50263. return val
  50264. }
  50265. defineReactive$$1(ob.value, key, val);
  50266. ob.dep.notify();
  50267. return val
  50268. }
  50269. /**
  50270. * Delete a property and trigger change if necessary.
  50271. */
  50272. function del (target, key) {
  50273. if (isUndef(target) || isPrimitive(target)
  50274. ) {
  50275. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50276. }
  50277. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50278. target.splice(key, 1);
  50279. return
  50280. }
  50281. var ob = (target).__ob__;
  50282. if (target._isVue || (ob && ob.vmCount)) {
  50283. warn(
  50284. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50285. '- just set it to null.'
  50286. );
  50287. return
  50288. }
  50289. if (!hasOwn(target, key)) {
  50290. return
  50291. }
  50292. delete target[key];
  50293. if (!ob) {
  50294. return
  50295. }
  50296. ob.dep.notify();
  50297. }
  50298. /**
  50299. * Collect dependencies on array elements when the array is touched, since
  50300. * we cannot intercept array element access like property getters.
  50301. */
  50302. function dependArray (value) {
  50303. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50304. e = value[i];
  50305. e && e.__ob__ && e.__ob__.dep.depend();
  50306. if (Array.isArray(e)) {
  50307. dependArray(e);
  50308. }
  50309. }
  50310. }
  50311. /* */
  50312. /**
  50313. * Option overwriting strategies are functions that handle
  50314. * how to merge a parent option value and a child option
  50315. * value into the final value.
  50316. */
  50317. var strats = config.optionMergeStrategies;
  50318. /**
  50319. * Options with restrictions
  50320. */
  50321. {
  50322. strats.el = strats.propsData = function (parent, child, vm, key) {
  50323. if (!vm) {
  50324. warn(
  50325. "option \"" + key + "\" can only be used during instance " +
  50326. 'creation with the `new` keyword.'
  50327. );
  50328. }
  50329. return defaultStrat(parent, child)
  50330. };
  50331. }
  50332. /**
  50333. * Helper that recursively merges two data objects together.
  50334. */
  50335. function mergeData (to, from) {
  50336. if (!from) { return to }
  50337. var key, toVal, fromVal;
  50338. var keys = hasSymbol
  50339. ? Reflect.ownKeys(from)
  50340. : Object.keys(from);
  50341. for (var i = 0; i < keys.length; i++) {
  50342. key = keys[i];
  50343. // in case the object is already observed...
  50344. if (key === '__ob__') { continue }
  50345. toVal = to[key];
  50346. fromVal = from[key];
  50347. if (!hasOwn(to, key)) {
  50348. set(to, key, fromVal);
  50349. } else if (
  50350. toVal !== fromVal &&
  50351. isPlainObject(toVal) &&
  50352. isPlainObject(fromVal)
  50353. ) {
  50354. mergeData(toVal, fromVal);
  50355. }
  50356. }
  50357. return to
  50358. }
  50359. /**
  50360. * Data
  50361. */
  50362. function mergeDataOrFn (
  50363. parentVal,
  50364. childVal,
  50365. vm
  50366. ) {
  50367. if (!vm) {
  50368. // in a Vue.extend merge, both should be functions
  50369. if (!childVal) {
  50370. return parentVal
  50371. }
  50372. if (!parentVal) {
  50373. return childVal
  50374. }
  50375. // when parentVal & childVal are both present,
  50376. // we need to return a function that returns the
  50377. // merged result of both functions... no need to
  50378. // check if parentVal is a function here because
  50379. // it has to be a function to pass previous merges.
  50380. return function mergedDataFn () {
  50381. return mergeData(
  50382. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50383. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50384. )
  50385. }
  50386. } else {
  50387. return function mergedInstanceDataFn () {
  50388. // instance merge
  50389. var instanceData = typeof childVal === 'function'
  50390. ? childVal.call(vm, vm)
  50391. : childVal;
  50392. var defaultData = typeof parentVal === 'function'
  50393. ? parentVal.call(vm, vm)
  50394. : parentVal;
  50395. if (instanceData) {
  50396. return mergeData(instanceData, defaultData)
  50397. } else {
  50398. return defaultData
  50399. }
  50400. }
  50401. }
  50402. }
  50403. strats.data = function (
  50404. parentVal,
  50405. childVal,
  50406. vm
  50407. ) {
  50408. if (!vm) {
  50409. if (childVal && typeof childVal !== 'function') {
  50410. warn(
  50411. 'The "data" option should be a function ' +
  50412. 'that returns a per-instance value in component ' +
  50413. 'definitions.',
  50414. vm
  50415. );
  50416. return parentVal
  50417. }
  50418. return mergeDataOrFn(parentVal, childVal)
  50419. }
  50420. return mergeDataOrFn(parentVal, childVal, vm)
  50421. };
  50422. /**
  50423. * Hooks and props are merged as arrays.
  50424. */
  50425. function mergeHook (
  50426. parentVal,
  50427. childVal
  50428. ) {
  50429. var res = childVal
  50430. ? parentVal
  50431. ? parentVal.concat(childVal)
  50432. : Array.isArray(childVal)
  50433. ? childVal
  50434. : [childVal]
  50435. : parentVal;
  50436. return res
  50437. ? dedupeHooks(res)
  50438. : res
  50439. }
  50440. function dedupeHooks (hooks) {
  50441. var res = [];
  50442. for (var i = 0; i < hooks.length; i++) {
  50443. if (res.indexOf(hooks[i]) === -1) {
  50444. res.push(hooks[i]);
  50445. }
  50446. }
  50447. return res
  50448. }
  50449. LIFECYCLE_HOOKS.forEach(function (hook) {
  50450. strats[hook] = mergeHook;
  50451. });
  50452. /**
  50453. * Assets
  50454. *
  50455. * When a vm is present (instance creation), we need to do
  50456. * a three-way merge between constructor options, instance
  50457. * options and parent options.
  50458. */
  50459. function mergeAssets (
  50460. parentVal,
  50461. childVal,
  50462. vm,
  50463. key
  50464. ) {
  50465. var res = Object.create(parentVal || null);
  50466. if (childVal) {
  50467. assertObjectType(key, childVal, vm);
  50468. return extend(res, childVal)
  50469. } else {
  50470. return res
  50471. }
  50472. }
  50473. ASSET_TYPES.forEach(function (type) {
  50474. strats[type + 's'] = mergeAssets;
  50475. });
  50476. /**
  50477. * Watchers.
  50478. *
  50479. * Watchers hashes should not overwrite one
  50480. * another, so we merge them as arrays.
  50481. */
  50482. strats.watch = function (
  50483. parentVal,
  50484. childVal,
  50485. vm,
  50486. key
  50487. ) {
  50488. // work around Firefox's Object.prototype.watch...
  50489. if (parentVal === nativeWatch) { parentVal = undefined; }
  50490. if (childVal === nativeWatch) { childVal = undefined; }
  50491. /* istanbul ignore if */
  50492. if (!childVal) { return Object.create(parentVal || null) }
  50493. {
  50494. assertObjectType(key, childVal, vm);
  50495. }
  50496. if (!parentVal) { return childVal }
  50497. var ret = {};
  50498. extend(ret, parentVal);
  50499. for (var key$1 in childVal) {
  50500. var parent = ret[key$1];
  50501. var child = childVal[key$1];
  50502. if (parent && !Array.isArray(parent)) {
  50503. parent = [parent];
  50504. }
  50505. ret[key$1] = parent
  50506. ? parent.concat(child)
  50507. : Array.isArray(child) ? child : [child];
  50508. }
  50509. return ret
  50510. };
  50511. /**
  50512. * Other object hashes.
  50513. */
  50514. strats.props =
  50515. strats.methods =
  50516. strats.inject =
  50517. strats.computed = function (
  50518. parentVal,
  50519. childVal,
  50520. vm,
  50521. key
  50522. ) {
  50523. if (childVal && "development" !== 'production') {
  50524. assertObjectType(key, childVal, vm);
  50525. }
  50526. if (!parentVal) { return childVal }
  50527. var ret = Object.create(null);
  50528. extend(ret, parentVal);
  50529. if (childVal) { extend(ret, childVal); }
  50530. return ret
  50531. };
  50532. strats.provide = mergeDataOrFn;
  50533. /**
  50534. * Default strategy.
  50535. */
  50536. var defaultStrat = function (parentVal, childVal) {
  50537. return childVal === undefined
  50538. ? parentVal
  50539. : childVal
  50540. };
  50541. /**
  50542. * Validate component names
  50543. */
  50544. function checkComponents (options) {
  50545. for (var key in options.components) {
  50546. validateComponentName(key);
  50547. }
  50548. }
  50549. function validateComponentName (name) {
  50550. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50551. warn(
  50552. 'Invalid component name: "' + name + '". Component names ' +
  50553. 'should conform to valid custom element name in html5 specification.'
  50554. );
  50555. }
  50556. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50557. warn(
  50558. 'Do not use built-in or reserved HTML elements as component ' +
  50559. 'id: ' + name
  50560. );
  50561. }
  50562. }
  50563. /**
  50564. * Ensure all props option syntax are normalized into the
  50565. * Object-based format.
  50566. */
  50567. function normalizeProps (options, vm) {
  50568. var props = options.props;
  50569. if (!props) { return }
  50570. var res = {};
  50571. var i, val, name;
  50572. if (Array.isArray(props)) {
  50573. i = props.length;
  50574. while (i--) {
  50575. val = props[i];
  50576. if (typeof val === 'string') {
  50577. name = camelize(val);
  50578. res[name] = { type: null };
  50579. } else {
  50580. warn('props must be strings when using array syntax.');
  50581. }
  50582. }
  50583. } else if (isPlainObject(props)) {
  50584. for (var key in props) {
  50585. val = props[key];
  50586. name = camelize(key);
  50587. res[name] = isPlainObject(val)
  50588. ? val
  50589. : { type: val };
  50590. }
  50591. } else {
  50592. warn(
  50593. "Invalid value for option \"props\": expected an Array or an Object, " +
  50594. "but got " + (toRawType(props)) + ".",
  50595. vm
  50596. );
  50597. }
  50598. options.props = res;
  50599. }
  50600. /**
  50601. * Normalize all injections into Object-based format
  50602. */
  50603. function normalizeInject (options, vm) {
  50604. var inject = options.inject;
  50605. if (!inject) { return }
  50606. var normalized = options.inject = {};
  50607. if (Array.isArray(inject)) {
  50608. for (var i = 0; i < inject.length; i++) {
  50609. normalized[inject[i]] = { from: inject[i] };
  50610. }
  50611. } else if (isPlainObject(inject)) {
  50612. for (var key in inject) {
  50613. var val = inject[key];
  50614. normalized[key] = isPlainObject(val)
  50615. ? extend({ from: key }, val)
  50616. : { from: val };
  50617. }
  50618. } else {
  50619. warn(
  50620. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50621. "but got " + (toRawType(inject)) + ".",
  50622. vm
  50623. );
  50624. }
  50625. }
  50626. /**
  50627. * Normalize raw function directives into object format.
  50628. */
  50629. function normalizeDirectives (options) {
  50630. var dirs = options.directives;
  50631. if (dirs) {
  50632. for (var key in dirs) {
  50633. var def$$1 = dirs[key];
  50634. if (typeof def$$1 === 'function') {
  50635. dirs[key] = { bind: def$$1, update: def$$1 };
  50636. }
  50637. }
  50638. }
  50639. }
  50640. function assertObjectType (name, value, vm) {
  50641. if (!isPlainObject(value)) {
  50642. warn(
  50643. "Invalid value for option \"" + name + "\": expected an Object, " +
  50644. "but got " + (toRawType(value)) + ".",
  50645. vm
  50646. );
  50647. }
  50648. }
  50649. /**
  50650. * Merge two option objects into a new one.
  50651. * Core utility used in both instantiation and inheritance.
  50652. */
  50653. function mergeOptions (
  50654. parent,
  50655. child,
  50656. vm
  50657. ) {
  50658. {
  50659. checkComponents(child);
  50660. }
  50661. if (typeof child === 'function') {
  50662. child = child.options;
  50663. }
  50664. normalizeProps(child, vm);
  50665. normalizeInject(child, vm);
  50666. normalizeDirectives(child);
  50667. // Apply extends and mixins on the child options,
  50668. // but only if it is a raw options object that isn't
  50669. // the result of another mergeOptions call.
  50670. // Only merged options has the _base property.
  50671. if (!child._base) {
  50672. if (child.extends) {
  50673. parent = mergeOptions(parent, child.extends, vm);
  50674. }
  50675. if (child.mixins) {
  50676. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50677. parent = mergeOptions(parent, child.mixins[i], vm);
  50678. }
  50679. }
  50680. }
  50681. var options = {};
  50682. var key;
  50683. for (key in parent) {
  50684. mergeField(key);
  50685. }
  50686. for (key in child) {
  50687. if (!hasOwn(parent, key)) {
  50688. mergeField(key);
  50689. }
  50690. }
  50691. function mergeField (key) {
  50692. var strat = strats[key] || defaultStrat;
  50693. options[key] = strat(parent[key], child[key], vm, key);
  50694. }
  50695. return options
  50696. }
  50697. /**
  50698. * Resolve an asset.
  50699. * This function is used because child instances need access
  50700. * to assets defined in its ancestor chain.
  50701. */
  50702. function resolveAsset (
  50703. options,
  50704. type,
  50705. id,
  50706. warnMissing
  50707. ) {
  50708. /* istanbul ignore if */
  50709. if (typeof id !== 'string') {
  50710. return
  50711. }
  50712. var assets = options[type];
  50713. // check local registration variations first
  50714. if (hasOwn(assets, id)) { return assets[id] }
  50715. var camelizedId = camelize(id);
  50716. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50717. var PascalCaseId = capitalize(camelizedId);
  50718. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50719. // fallback to prototype chain
  50720. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50721. if (warnMissing && !res) {
  50722. warn(
  50723. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50724. options
  50725. );
  50726. }
  50727. return res
  50728. }
  50729. /* */
  50730. function validateProp (
  50731. key,
  50732. propOptions,
  50733. propsData,
  50734. vm
  50735. ) {
  50736. var prop = propOptions[key];
  50737. var absent = !hasOwn(propsData, key);
  50738. var value = propsData[key];
  50739. // boolean casting
  50740. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50741. if (booleanIndex > -1) {
  50742. if (absent && !hasOwn(prop, 'default')) {
  50743. value = false;
  50744. } else if (value === '' || value === hyphenate(key)) {
  50745. // only cast empty string / same name to boolean if
  50746. // boolean has higher priority
  50747. var stringIndex = getTypeIndex(String, prop.type);
  50748. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50749. value = true;
  50750. }
  50751. }
  50752. }
  50753. // check default value
  50754. if (value === undefined) {
  50755. value = getPropDefaultValue(vm, prop, key);
  50756. // since the default value is a fresh copy,
  50757. // make sure to observe it.
  50758. var prevShouldObserve = shouldObserve;
  50759. toggleObserving(true);
  50760. observe(value);
  50761. toggleObserving(prevShouldObserve);
  50762. }
  50763. {
  50764. assertProp(prop, key, value, vm, absent);
  50765. }
  50766. return value
  50767. }
  50768. /**
  50769. * Get the default value of a prop.
  50770. */
  50771. function getPropDefaultValue (vm, prop, key) {
  50772. // no default, return undefined
  50773. if (!hasOwn(prop, 'default')) {
  50774. return undefined
  50775. }
  50776. var def = prop.default;
  50777. // warn against non-factory defaults for Object & Array
  50778. if (isObject(def)) {
  50779. warn(
  50780. 'Invalid default value for prop "' + key + '": ' +
  50781. 'Props with type Object/Array must use a factory function ' +
  50782. 'to return the default value.',
  50783. vm
  50784. );
  50785. }
  50786. // the raw prop value was also undefined from previous render,
  50787. // return previous default value to avoid unnecessary watcher trigger
  50788. if (vm && vm.$options.propsData &&
  50789. vm.$options.propsData[key] === undefined &&
  50790. vm._props[key] !== undefined
  50791. ) {
  50792. return vm._props[key]
  50793. }
  50794. // call factory function for non-Function types
  50795. // a value is Function if its prototype is function even across different execution context
  50796. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50797. ? def.call(vm)
  50798. : def
  50799. }
  50800. /**
  50801. * Assert whether a prop is valid.
  50802. */
  50803. function assertProp (
  50804. prop,
  50805. name,
  50806. value,
  50807. vm,
  50808. absent
  50809. ) {
  50810. if (prop.required && absent) {
  50811. warn(
  50812. 'Missing required prop: "' + name + '"',
  50813. vm
  50814. );
  50815. return
  50816. }
  50817. if (value == null && !prop.required) {
  50818. return
  50819. }
  50820. var type = prop.type;
  50821. var valid = !type || type === true;
  50822. var expectedTypes = [];
  50823. if (type) {
  50824. if (!Array.isArray(type)) {
  50825. type = [type];
  50826. }
  50827. for (var i = 0; i < type.length && !valid; i++) {
  50828. var assertedType = assertType(value, type[i]);
  50829. expectedTypes.push(assertedType.expectedType || '');
  50830. valid = assertedType.valid;
  50831. }
  50832. }
  50833. if (!valid) {
  50834. warn(
  50835. getInvalidTypeMessage(name, value, expectedTypes),
  50836. vm
  50837. );
  50838. return
  50839. }
  50840. var validator = prop.validator;
  50841. if (validator) {
  50842. if (!validator(value)) {
  50843. warn(
  50844. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50845. vm
  50846. );
  50847. }
  50848. }
  50849. }
  50850. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50851. function assertType (value, type) {
  50852. var valid;
  50853. var expectedType = getType(type);
  50854. if (simpleCheckRE.test(expectedType)) {
  50855. var t = typeof value;
  50856. valid = t === expectedType.toLowerCase();
  50857. // for primitive wrapper objects
  50858. if (!valid && t === 'object') {
  50859. valid = value instanceof type;
  50860. }
  50861. } else if (expectedType === 'Object') {
  50862. valid = isPlainObject(value);
  50863. } else if (expectedType === 'Array') {
  50864. valid = Array.isArray(value);
  50865. } else {
  50866. valid = value instanceof type;
  50867. }
  50868. return {
  50869. valid: valid,
  50870. expectedType: expectedType
  50871. }
  50872. }
  50873. /**
  50874. * Use function string name to check built-in types,
  50875. * because a simple equality check will fail when running
  50876. * across different vms / iframes.
  50877. */
  50878. function getType (fn) {
  50879. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50880. return match ? match[1] : ''
  50881. }
  50882. function isSameType (a, b) {
  50883. return getType(a) === getType(b)
  50884. }
  50885. function getTypeIndex (type, expectedTypes) {
  50886. if (!Array.isArray(expectedTypes)) {
  50887. return isSameType(expectedTypes, type) ? 0 : -1
  50888. }
  50889. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50890. if (isSameType(expectedTypes[i], type)) {
  50891. return i
  50892. }
  50893. }
  50894. return -1
  50895. }
  50896. function getInvalidTypeMessage (name, value, expectedTypes) {
  50897. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50898. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50899. var expectedType = expectedTypes[0];
  50900. var receivedType = toRawType(value);
  50901. var expectedValue = styleValue(value, expectedType);
  50902. var receivedValue = styleValue(value, receivedType);
  50903. // check if we need to specify expected value
  50904. if (expectedTypes.length === 1 &&
  50905. isExplicable(expectedType) &&
  50906. !isBoolean(expectedType, receivedType)) {
  50907. message += " with value " + expectedValue;
  50908. }
  50909. message += ", got " + receivedType + " ";
  50910. // check if we need to specify received value
  50911. if (isExplicable(receivedType)) {
  50912. message += "with value " + receivedValue + ".";
  50913. }
  50914. return message
  50915. }
  50916. function styleValue (value, type) {
  50917. if (type === 'String') {
  50918. return ("\"" + value + "\"")
  50919. } else if (type === 'Number') {
  50920. return ("" + (Number(value)))
  50921. } else {
  50922. return ("" + value)
  50923. }
  50924. }
  50925. function isExplicable (value) {
  50926. var explicitTypes = ['string', 'number', 'boolean'];
  50927. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50928. }
  50929. function isBoolean () {
  50930. var args = [], len = arguments.length;
  50931. while ( len-- ) args[ len ] = arguments[ len ];
  50932. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50933. }
  50934. /* */
  50935. function handleError (err, vm, info) {
  50936. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50937. // See: https://github.com/vuejs/vuex/issues/1505
  50938. pushTarget();
  50939. try {
  50940. if (vm) {
  50941. var cur = vm;
  50942. while ((cur = cur.$parent)) {
  50943. var hooks = cur.$options.errorCaptured;
  50944. if (hooks) {
  50945. for (var i = 0; i < hooks.length; i++) {
  50946. try {
  50947. var capture = hooks[i].call(cur, err, vm, info) === false;
  50948. if (capture) { return }
  50949. } catch (e) {
  50950. globalHandleError(e, cur, 'errorCaptured hook');
  50951. }
  50952. }
  50953. }
  50954. }
  50955. }
  50956. globalHandleError(err, vm, info);
  50957. } finally {
  50958. popTarget();
  50959. }
  50960. }
  50961. function invokeWithErrorHandling (
  50962. handler,
  50963. context,
  50964. args,
  50965. vm,
  50966. info
  50967. ) {
  50968. var res;
  50969. try {
  50970. res = args ? handler.apply(context, args) : handler.call(context);
  50971. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50972. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50973. // issue #9511
  50974. // avoid catch triggering multiple times when nested calls
  50975. res._handled = true;
  50976. }
  50977. } catch (e) {
  50978. handleError(e, vm, info);
  50979. }
  50980. return res
  50981. }
  50982. function globalHandleError (err, vm, info) {
  50983. if (config.errorHandler) {
  50984. try {
  50985. return config.errorHandler.call(null, err, vm, info)
  50986. } catch (e) {
  50987. // if the user intentionally throws the original error in the handler,
  50988. // do not log it twice
  50989. if (e !== err) {
  50990. logError(e, null, 'config.errorHandler');
  50991. }
  50992. }
  50993. }
  50994. logError(err, vm, info);
  50995. }
  50996. function logError (err, vm, info) {
  50997. {
  50998. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  50999. }
  51000. /* istanbul ignore else */
  51001. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  51002. console.error(err);
  51003. } else {
  51004. throw err
  51005. }
  51006. }
  51007. /* */
  51008. var isUsingMicroTask = false;
  51009. var callbacks = [];
  51010. var pending = false;
  51011. function flushCallbacks () {
  51012. pending = false;
  51013. var copies = callbacks.slice(0);
  51014. callbacks.length = 0;
  51015. for (var i = 0; i < copies.length; i++) {
  51016. copies[i]();
  51017. }
  51018. }
  51019. // Here we have async deferring wrappers using microtasks.
  51020. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51021. // However, it has subtle problems when state is changed right before repaint
  51022. // (e.g. #6813, out-in transitions).
  51023. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51024. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51025. // So we now use microtasks everywhere, again.
  51026. // A major drawback of this tradeoff is that there are some scenarios
  51027. // where microtasks have too high a priority and fire in between supposedly
  51028. // sequential events (e.g. #4521, #6690, which have workarounds)
  51029. // or even between bubbling of the same event (#6566).
  51030. var timerFunc;
  51031. // The nextTick behavior leverages the microtask queue, which can be accessed
  51032. // via either native Promise.then or MutationObserver.
  51033. // MutationObserver has wider support, however it is seriously bugged in
  51034. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51035. // completely stops working after triggering a few times... so, if native
  51036. // Promise is available, we will use it:
  51037. /* istanbul ignore next, $flow-disable-line */
  51038. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51039. var p = Promise.resolve();
  51040. timerFunc = function () {
  51041. p.then(flushCallbacks);
  51042. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51043. // it can get stuck in a weird state where callbacks are pushed into the
  51044. // microtask queue but the queue isn't being flushed, until the browser
  51045. // needs to do some other work, e.g. handle a timer. Therefore we can
  51046. // "force" the microtask queue to be flushed by adding an empty timer.
  51047. if (isIOS) { setTimeout(noop); }
  51048. };
  51049. isUsingMicroTask = true;
  51050. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51051. isNative(MutationObserver) ||
  51052. // PhantomJS and iOS 7.x
  51053. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51054. )) {
  51055. // Use MutationObserver where native Promise is not available,
  51056. // e.g. PhantomJS, iOS7, Android 4.4
  51057. // (#6466 MutationObserver is unreliable in IE11)
  51058. var counter = 1;
  51059. var observer = new MutationObserver(flushCallbacks);
  51060. var textNode = document.createTextNode(String(counter));
  51061. observer.observe(textNode, {
  51062. characterData: true
  51063. });
  51064. timerFunc = function () {
  51065. counter = (counter + 1) % 2;
  51066. textNode.data = String(counter);
  51067. };
  51068. isUsingMicroTask = true;
  51069. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51070. // Fallback to setImmediate.
  51071. // Technically it leverages the (macro) task queue,
  51072. // but it is still a better choice than setTimeout.
  51073. timerFunc = function () {
  51074. setImmediate(flushCallbacks);
  51075. };
  51076. } else {
  51077. // Fallback to setTimeout.
  51078. timerFunc = function () {
  51079. setTimeout(flushCallbacks, 0);
  51080. };
  51081. }
  51082. function nextTick (cb, ctx) {
  51083. var _resolve;
  51084. callbacks.push(function () {
  51085. if (cb) {
  51086. try {
  51087. cb.call(ctx);
  51088. } catch (e) {
  51089. handleError(e, ctx, 'nextTick');
  51090. }
  51091. } else if (_resolve) {
  51092. _resolve(ctx);
  51093. }
  51094. });
  51095. if (!pending) {
  51096. pending = true;
  51097. timerFunc();
  51098. }
  51099. // $flow-disable-line
  51100. if (!cb && typeof Promise !== 'undefined') {
  51101. return new Promise(function (resolve) {
  51102. _resolve = resolve;
  51103. })
  51104. }
  51105. }
  51106. /* */
  51107. var mark;
  51108. var measure;
  51109. {
  51110. var perf = inBrowser && window.performance;
  51111. /* istanbul ignore if */
  51112. if (
  51113. perf &&
  51114. perf.mark &&
  51115. perf.measure &&
  51116. perf.clearMarks &&
  51117. perf.clearMeasures
  51118. ) {
  51119. mark = function (tag) { return perf.mark(tag); };
  51120. measure = function (name, startTag, endTag) {
  51121. perf.measure(name, startTag, endTag);
  51122. perf.clearMarks(startTag);
  51123. perf.clearMarks(endTag);
  51124. // perf.clearMeasures(name)
  51125. };
  51126. }
  51127. }
  51128. /* not type checking this file because flow doesn't play well with Proxy */
  51129. var initProxy;
  51130. {
  51131. var allowedGlobals = makeMap(
  51132. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51133. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51134. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51135. 'require' // for Webpack/Browserify
  51136. );
  51137. var warnNonPresent = function (target, key) {
  51138. warn(
  51139. "Property or method \"" + key + "\" is not defined on the instance but " +
  51140. 'referenced during render. Make sure that this property is reactive, ' +
  51141. 'either in the data option, or for class-based components, by ' +
  51142. 'initializing the property. ' +
  51143. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51144. target
  51145. );
  51146. };
  51147. var warnReservedPrefix = function (target, key) {
  51148. warn(
  51149. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51150. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51151. 'prevent conflicts with Vue internals. ' +
  51152. 'See: https://vuejs.org/v2/api/#data',
  51153. target
  51154. );
  51155. };
  51156. var hasProxy =
  51157. typeof Proxy !== 'undefined' && isNative(Proxy);
  51158. if (hasProxy) {
  51159. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51160. config.keyCodes = new Proxy(config.keyCodes, {
  51161. set: function set (target, key, value) {
  51162. if (isBuiltInModifier(key)) {
  51163. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51164. return false
  51165. } else {
  51166. target[key] = value;
  51167. return true
  51168. }
  51169. }
  51170. });
  51171. }
  51172. var hasHandler = {
  51173. has: function has (target, key) {
  51174. var has = key in target;
  51175. var isAllowed = allowedGlobals(key) ||
  51176. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51177. if (!has && !isAllowed) {
  51178. if (key in target.$data) { warnReservedPrefix(target, key); }
  51179. else { warnNonPresent(target, key); }
  51180. }
  51181. return has || !isAllowed
  51182. }
  51183. };
  51184. var getHandler = {
  51185. get: function get (target, key) {
  51186. if (typeof key === 'string' && !(key in target)) {
  51187. if (key in target.$data) { warnReservedPrefix(target, key); }
  51188. else { warnNonPresent(target, key); }
  51189. }
  51190. return target[key]
  51191. }
  51192. };
  51193. initProxy = function initProxy (vm) {
  51194. if (hasProxy) {
  51195. // determine which proxy handler to use
  51196. var options = vm.$options;
  51197. var handlers = options.render && options.render._withStripped
  51198. ? getHandler
  51199. : hasHandler;
  51200. vm._renderProxy = new Proxy(vm, handlers);
  51201. } else {
  51202. vm._renderProxy = vm;
  51203. }
  51204. };
  51205. }
  51206. /* */
  51207. var seenObjects = new _Set();
  51208. /**
  51209. * Recursively traverse an object to evoke all converted
  51210. * getters, so that every nested property inside the object
  51211. * is collected as a "deep" dependency.
  51212. */
  51213. function traverse (val) {
  51214. _traverse(val, seenObjects);
  51215. seenObjects.clear();
  51216. }
  51217. function _traverse (val, seen) {
  51218. var i, keys;
  51219. var isA = Array.isArray(val);
  51220. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51221. return
  51222. }
  51223. if (val.__ob__) {
  51224. var depId = val.__ob__.dep.id;
  51225. if (seen.has(depId)) {
  51226. return
  51227. }
  51228. seen.add(depId);
  51229. }
  51230. if (isA) {
  51231. i = val.length;
  51232. while (i--) { _traverse(val[i], seen); }
  51233. } else {
  51234. keys = Object.keys(val);
  51235. i = keys.length;
  51236. while (i--) { _traverse(val[keys[i]], seen); }
  51237. }
  51238. }
  51239. /* */
  51240. var normalizeEvent = cached(function (name) {
  51241. var passive = name.charAt(0) === '&';
  51242. name = passive ? name.slice(1) : name;
  51243. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51244. name = once$$1 ? name.slice(1) : name;
  51245. var capture = name.charAt(0) === '!';
  51246. name = capture ? name.slice(1) : name;
  51247. return {
  51248. name: name,
  51249. once: once$$1,
  51250. capture: capture,
  51251. passive: passive
  51252. }
  51253. });
  51254. function createFnInvoker (fns, vm) {
  51255. function invoker () {
  51256. var arguments$1 = arguments;
  51257. var fns = invoker.fns;
  51258. if (Array.isArray(fns)) {
  51259. var cloned = fns.slice();
  51260. for (var i = 0; i < cloned.length; i++) {
  51261. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51262. }
  51263. } else {
  51264. // return handler return value for single handlers
  51265. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51266. }
  51267. }
  51268. invoker.fns = fns;
  51269. return invoker
  51270. }
  51271. function updateListeners (
  51272. on,
  51273. oldOn,
  51274. add,
  51275. remove$$1,
  51276. createOnceHandler,
  51277. vm
  51278. ) {
  51279. var name, def$$1, cur, old, event;
  51280. for (name in on) {
  51281. def$$1 = cur = on[name];
  51282. old = oldOn[name];
  51283. event = normalizeEvent(name);
  51284. if (isUndef(cur)) {
  51285. warn(
  51286. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51287. vm
  51288. );
  51289. } else if (isUndef(old)) {
  51290. if (isUndef(cur.fns)) {
  51291. cur = on[name] = createFnInvoker(cur, vm);
  51292. }
  51293. if (isTrue(event.once)) {
  51294. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51295. }
  51296. add(event.name, cur, event.capture, event.passive, event.params);
  51297. } else if (cur !== old) {
  51298. old.fns = cur;
  51299. on[name] = old;
  51300. }
  51301. }
  51302. for (name in oldOn) {
  51303. if (isUndef(on[name])) {
  51304. event = normalizeEvent(name);
  51305. remove$$1(event.name, oldOn[name], event.capture);
  51306. }
  51307. }
  51308. }
  51309. /* */
  51310. function mergeVNodeHook (def, hookKey, hook) {
  51311. if (def instanceof VNode) {
  51312. def = def.data.hook || (def.data.hook = {});
  51313. }
  51314. var invoker;
  51315. var oldHook = def[hookKey];
  51316. function wrappedHook () {
  51317. hook.apply(this, arguments);
  51318. // important: remove merged hook to ensure it's called only once
  51319. // and prevent memory leak
  51320. remove(invoker.fns, wrappedHook);
  51321. }
  51322. if (isUndef(oldHook)) {
  51323. // no existing hook
  51324. invoker = createFnInvoker([wrappedHook]);
  51325. } else {
  51326. /* istanbul ignore if */
  51327. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51328. // already a merged invoker
  51329. invoker = oldHook;
  51330. invoker.fns.push(wrappedHook);
  51331. } else {
  51332. // existing plain hook
  51333. invoker = createFnInvoker([oldHook, wrappedHook]);
  51334. }
  51335. }
  51336. invoker.merged = true;
  51337. def[hookKey] = invoker;
  51338. }
  51339. /* */
  51340. function extractPropsFromVNodeData (
  51341. data,
  51342. Ctor,
  51343. tag
  51344. ) {
  51345. // we are only extracting raw values here.
  51346. // validation and default values are handled in the child
  51347. // component itself.
  51348. var propOptions = Ctor.options.props;
  51349. if (isUndef(propOptions)) {
  51350. return
  51351. }
  51352. var res = {};
  51353. var attrs = data.attrs;
  51354. var props = data.props;
  51355. if (isDef(attrs) || isDef(props)) {
  51356. for (var key in propOptions) {
  51357. var altKey = hyphenate(key);
  51358. {
  51359. var keyInLowerCase = key.toLowerCase();
  51360. if (
  51361. key !== keyInLowerCase &&
  51362. attrs && hasOwn(attrs, keyInLowerCase)
  51363. ) {
  51364. tip(
  51365. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51366. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51367. " \"" + key + "\". " +
  51368. "Note that HTML attributes are case-insensitive and camelCased " +
  51369. "props need to use their kebab-case equivalents when using in-DOM " +
  51370. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51371. );
  51372. }
  51373. }
  51374. checkProp(res, props, key, altKey, true) ||
  51375. checkProp(res, attrs, key, altKey, false);
  51376. }
  51377. }
  51378. return res
  51379. }
  51380. function checkProp (
  51381. res,
  51382. hash,
  51383. key,
  51384. altKey,
  51385. preserve
  51386. ) {
  51387. if (isDef(hash)) {
  51388. if (hasOwn(hash, key)) {
  51389. res[key] = hash[key];
  51390. if (!preserve) {
  51391. delete hash[key];
  51392. }
  51393. return true
  51394. } else if (hasOwn(hash, altKey)) {
  51395. res[key] = hash[altKey];
  51396. if (!preserve) {
  51397. delete hash[altKey];
  51398. }
  51399. return true
  51400. }
  51401. }
  51402. return false
  51403. }
  51404. /* */
  51405. // The template compiler attempts to minimize the need for normalization by
  51406. // statically analyzing the template at compile time.
  51407. //
  51408. // For plain HTML markup, normalization can be completely skipped because the
  51409. // generated render function is guaranteed to return Array<VNode>. There are
  51410. // two cases where extra normalization is needed:
  51411. // 1. When the children contains components - because a functional component
  51412. // may return an Array instead of a single root. In this case, just a simple
  51413. // normalization is needed - if any child is an Array, we flatten the whole
  51414. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51415. // because functional components already normalize their own children.
  51416. function simpleNormalizeChildren (children) {
  51417. for (var i = 0; i < children.length; i++) {
  51418. if (Array.isArray(children[i])) {
  51419. return Array.prototype.concat.apply([], children)
  51420. }
  51421. }
  51422. return children
  51423. }
  51424. // 2. When the children contains constructs that always generated nested Arrays,
  51425. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51426. // with hand-written render functions / JSX. In such cases a full normalization
  51427. // is needed to cater to all possible types of children values.
  51428. function normalizeChildren (children) {
  51429. return isPrimitive(children)
  51430. ? [createTextVNode(children)]
  51431. : Array.isArray(children)
  51432. ? normalizeArrayChildren(children)
  51433. : undefined
  51434. }
  51435. function isTextNode (node) {
  51436. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51437. }
  51438. function normalizeArrayChildren (children, nestedIndex) {
  51439. var res = [];
  51440. var i, c, lastIndex, last;
  51441. for (i = 0; i < children.length; i++) {
  51442. c = children[i];
  51443. if (isUndef(c) || typeof c === 'boolean') { continue }
  51444. lastIndex = res.length - 1;
  51445. last = res[lastIndex];
  51446. // nested
  51447. if (Array.isArray(c)) {
  51448. if (c.length > 0) {
  51449. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51450. // merge adjacent text nodes
  51451. if (isTextNode(c[0]) && isTextNode(last)) {
  51452. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51453. c.shift();
  51454. }
  51455. res.push.apply(res, c);
  51456. }
  51457. } else if (isPrimitive(c)) {
  51458. if (isTextNode(last)) {
  51459. // merge adjacent text nodes
  51460. // this is necessary for SSR hydration because text nodes are
  51461. // essentially merged when rendered to HTML strings
  51462. res[lastIndex] = createTextVNode(last.text + c);
  51463. } else if (c !== '') {
  51464. // convert primitive to vnode
  51465. res.push(createTextVNode(c));
  51466. }
  51467. } else {
  51468. if (isTextNode(c) && isTextNode(last)) {
  51469. // merge adjacent text nodes
  51470. res[lastIndex] = createTextVNode(last.text + c.text);
  51471. } else {
  51472. // default key for nested array children (likely generated by v-for)
  51473. if (isTrue(children._isVList) &&
  51474. isDef(c.tag) &&
  51475. isUndef(c.key) &&
  51476. isDef(nestedIndex)) {
  51477. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51478. }
  51479. res.push(c);
  51480. }
  51481. }
  51482. }
  51483. return res
  51484. }
  51485. /* */
  51486. function initProvide (vm) {
  51487. var provide = vm.$options.provide;
  51488. if (provide) {
  51489. vm._provided = typeof provide === 'function'
  51490. ? provide.call(vm)
  51491. : provide;
  51492. }
  51493. }
  51494. function initInjections (vm) {
  51495. var result = resolveInject(vm.$options.inject, vm);
  51496. if (result) {
  51497. toggleObserving(false);
  51498. Object.keys(result).forEach(function (key) {
  51499. /* istanbul ignore else */
  51500. {
  51501. defineReactive$$1(vm, key, result[key], function () {
  51502. warn(
  51503. "Avoid mutating an injected value directly since the changes will be " +
  51504. "overwritten whenever the provided component re-renders. " +
  51505. "injection being mutated: \"" + key + "\"",
  51506. vm
  51507. );
  51508. });
  51509. }
  51510. });
  51511. toggleObserving(true);
  51512. }
  51513. }
  51514. function resolveInject (inject, vm) {
  51515. if (inject) {
  51516. // inject is :any because flow is not smart enough to figure out cached
  51517. var result = Object.create(null);
  51518. var keys = hasSymbol
  51519. ? Reflect.ownKeys(inject)
  51520. : Object.keys(inject);
  51521. for (var i = 0; i < keys.length; i++) {
  51522. var key = keys[i];
  51523. // #6574 in case the inject object is observed...
  51524. if (key === '__ob__') { continue }
  51525. var provideKey = inject[key].from;
  51526. var source = vm;
  51527. while (source) {
  51528. if (source._provided && hasOwn(source._provided, provideKey)) {
  51529. result[key] = source._provided[provideKey];
  51530. break
  51531. }
  51532. source = source.$parent;
  51533. }
  51534. if (!source) {
  51535. if ('default' in inject[key]) {
  51536. var provideDefault = inject[key].default;
  51537. result[key] = typeof provideDefault === 'function'
  51538. ? provideDefault.call(vm)
  51539. : provideDefault;
  51540. } else {
  51541. warn(("Injection \"" + key + "\" not found"), vm);
  51542. }
  51543. }
  51544. }
  51545. return result
  51546. }
  51547. }
  51548. /* */
  51549. /**
  51550. * Runtime helper for resolving raw children VNodes into a slot object.
  51551. */
  51552. function resolveSlots (
  51553. children,
  51554. context
  51555. ) {
  51556. if (!children || !children.length) {
  51557. return {}
  51558. }
  51559. var slots = {};
  51560. for (var i = 0, l = children.length; i < l; i++) {
  51561. var child = children[i];
  51562. var data = child.data;
  51563. // remove slot attribute if the node is resolved as a Vue slot node
  51564. if (data && data.attrs && data.attrs.slot) {
  51565. delete data.attrs.slot;
  51566. }
  51567. // named slots should only be respected if the vnode was rendered in the
  51568. // same context.
  51569. if ((child.context === context || child.fnContext === context) &&
  51570. data && data.slot != null
  51571. ) {
  51572. var name = data.slot;
  51573. var slot = (slots[name] || (slots[name] = []));
  51574. if (child.tag === 'template') {
  51575. slot.push.apply(slot, child.children || []);
  51576. } else {
  51577. slot.push(child);
  51578. }
  51579. } else {
  51580. (slots.default || (slots.default = [])).push(child);
  51581. }
  51582. }
  51583. // ignore slots that contains only whitespace
  51584. for (var name$1 in slots) {
  51585. if (slots[name$1].every(isWhitespace)) {
  51586. delete slots[name$1];
  51587. }
  51588. }
  51589. return slots
  51590. }
  51591. function isWhitespace (node) {
  51592. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51593. }
  51594. /* */
  51595. function normalizeScopedSlots (
  51596. slots,
  51597. normalSlots,
  51598. prevSlots
  51599. ) {
  51600. var res;
  51601. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51602. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51603. var key = slots && slots.$key;
  51604. if (!slots) {
  51605. res = {};
  51606. } else if (slots._normalized) {
  51607. // fast path 1: child component re-render only, parent did not change
  51608. return slots._normalized
  51609. } else if (
  51610. isStable &&
  51611. prevSlots &&
  51612. prevSlots !== emptyObject &&
  51613. key === prevSlots.$key &&
  51614. !hasNormalSlots &&
  51615. !prevSlots.$hasNormal
  51616. ) {
  51617. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51618. // only need to normalize once
  51619. return prevSlots
  51620. } else {
  51621. res = {};
  51622. for (var key$1 in slots) {
  51623. if (slots[key$1] && key$1[0] !== '$') {
  51624. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51625. }
  51626. }
  51627. }
  51628. // expose normal slots on scopedSlots
  51629. for (var key$2 in normalSlots) {
  51630. if (!(key$2 in res)) {
  51631. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51632. }
  51633. }
  51634. // avoriaz seems to mock a non-extensible $scopedSlots object
  51635. // and when that is passed down this would cause an error
  51636. if (slots && Object.isExtensible(slots)) {
  51637. (slots)._normalized = res;
  51638. }
  51639. def(res, '$stable', isStable);
  51640. def(res, '$key', key);
  51641. def(res, '$hasNormal', hasNormalSlots);
  51642. return res
  51643. }
  51644. function normalizeScopedSlot(normalSlots, key, fn) {
  51645. var normalized = function () {
  51646. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51647. res = res && typeof res === 'object' && !Array.isArray(res)
  51648. ? [res] // single vnode
  51649. : normalizeChildren(res);
  51650. return res && (
  51651. res.length === 0 ||
  51652. (res.length === 1 && res[0].isComment) // #9658
  51653. ) ? undefined
  51654. : res
  51655. };
  51656. // this is a slot using the new v-slot syntax without scope. although it is
  51657. // compiled as a scoped slot, render fn users would expect it to be present
  51658. // on this.$slots because the usage is semantically a normal slot.
  51659. if (fn.proxy) {
  51660. Object.defineProperty(normalSlots, key, {
  51661. get: normalized,
  51662. enumerable: true,
  51663. configurable: true
  51664. });
  51665. }
  51666. return normalized
  51667. }
  51668. function proxyNormalSlot(slots, key) {
  51669. return function () { return slots[key]; }
  51670. }
  51671. /* */
  51672. /**
  51673. * Runtime helper for rendering v-for lists.
  51674. */
  51675. function renderList (
  51676. val,
  51677. render
  51678. ) {
  51679. var ret, i, l, keys, key;
  51680. if (Array.isArray(val) || typeof val === 'string') {
  51681. ret = new Array(val.length);
  51682. for (i = 0, l = val.length; i < l; i++) {
  51683. ret[i] = render(val[i], i);
  51684. }
  51685. } else if (typeof val === 'number') {
  51686. ret = new Array(val);
  51687. for (i = 0; i < val; i++) {
  51688. ret[i] = render(i + 1, i);
  51689. }
  51690. } else if (isObject(val)) {
  51691. if (hasSymbol && val[Symbol.iterator]) {
  51692. ret = [];
  51693. var iterator = val[Symbol.iterator]();
  51694. var result = iterator.next();
  51695. while (!result.done) {
  51696. ret.push(render(result.value, ret.length));
  51697. result = iterator.next();
  51698. }
  51699. } else {
  51700. keys = Object.keys(val);
  51701. ret = new Array(keys.length);
  51702. for (i = 0, l = keys.length; i < l; i++) {
  51703. key = keys[i];
  51704. ret[i] = render(val[key], key, i);
  51705. }
  51706. }
  51707. }
  51708. if (!isDef(ret)) {
  51709. ret = [];
  51710. }
  51711. (ret)._isVList = true;
  51712. return ret
  51713. }
  51714. /* */
  51715. /**
  51716. * Runtime helper for rendering <slot>
  51717. */
  51718. function renderSlot (
  51719. name,
  51720. fallback,
  51721. props,
  51722. bindObject
  51723. ) {
  51724. var scopedSlotFn = this.$scopedSlots[name];
  51725. var nodes;
  51726. if (scopedSlotFn) { // scoped slot
  51727. props = props || {};
  51728. if (bindObject) {
  51729. if (!isObject(bindObject)) {
  51730. warn(
  51731. 'slot v-bind without argument expects an Object',
  51732. this
  51733. );
  51734. }
  51735. props = extend(extend({}, bindObject), props);
  51736. }
  51737. nodes = scopedSlotFn(props) || fallback;
  51738. } else {
  51739. nodes = this.$slots[name] || fallback;
  51740. }
  51741. var target = props && props.slot;
  51742. if (target) {
  51743. return this.$createElement('template', { slot: target }, nodes)
  51744. } else {
  51745. return nodes
  51746. }
  51747. }
  51748. /* */
  51749. /**
  51750. * Runtime helper for resolving filters
  51751. */
  51752. function resolveFilter (id) {
  51753. return resolveAsset(this.$options, 'filters', id, true) || identity
  51754. }
  51755. /* */
  51756. function isKeyNotMatch (expect, actual) {
  51757. if (Array.isArray(expect)) {
  51758. return expect.indexOf(actual) === -1
  51759. } else {
  51760. return expect !== actual
  51761. }
  51762. }
  51763. /**
  51764. * Runtime helper for checking keyCodes from config.
  51765. * exposed as Vue.prototype._k
  51766. * passing in eventKeyName as last argument separately for backwards compat
  51767. */
  51768. function checkKeyCodes (
  51769. eventKeyCode,
  51770. key,
  51771. builtInKeyCode,
  51772. eventKeyName,
  51773. builtInKeyName
  51774. ) {
  51775. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51776. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51777. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51778. } else if (mappedKeyCode) {
  51779. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51780. } else if (eventKeyName) {
  51781. return hyphenate(eventKeyName) !== key
  51782. }
  51783. }
  51784. /* */
  51785. /**
  51786. * Runtime helper for merging v-bind="object" into a VNode's data.
  51787. */
  51788. function bindObjectProps (
  51789. data,
  51790. tag,
  51791. value,
  51792. asProp,
  51793. isSync
  51794. ) {
  51795. if (value) {
  51796. if (!isObject(value)) {
  51797. warn(
  51798. 'v-bind without argument expects an Object or Array value',
  51799. this
  51800. );
  51801. } else {
  51802. if (Array.isArray(value)) {
  51803. value = toObject(value);
  51804. }
  51805. var hash;
  51806. var loop = function ( key ) {
  51807. if (
  51808. key === 'class' ||
  51809. key === 'style' ||
  51810. isReservedAttribute(key)
  51811. ) {
  51812. hash = data;
  51813. } else {
  51814. var type = data.attrs && data.attrs.type;
  51815. hash = asProp || config.mustUseProp(tag, type, key)
  51816. ? data.domProps || (data.domProps = {})
  51817. : data.attrs || (data.attrs = {});
  51818. }
  51819. var camelizedKey = camelize(key);
  51820. var hyphenatedKey = hyphenate(key);
  51821. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51822. hash[key] = value[key];
  51823. if (isSync) {
  51824. var on = data.on || (data.on = {});
  51825. on[("update:" + key)] = function ($event) {
  51826. value[key] = $event;
  51827. };
  51828. }
  51829. }
  51830. };
  51831. for (var key in value) loop( key );
  51832. }
  51833. }
  51834. return data
  51835. }
  51836. /* */
  51837. /**
  51838. * Runtime helper for rendering static trees.
  51839. */
  51840. function renderStatic (
  51841. index,
  51842. isInFor
  51843. ) {
  51844. var cached = this._staticTrees || (this._staticTrees = []);
  51845. var tree = cached[index];
  51846. // if has already-rendered static tree and not inside v-for,
  51847. // we can reuse the same tree.
  51848. if (tree && !isInFor) {
  51849. return tree
  51850. }
  51851. // otherwise, render a fresh tree.
  51852. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51853. this._renderProxy,
  51854. null,
  51855. this // for render fns generated for functional component templates
  51856. );
  51857. markStatic(tree, ("__static__" + index), false);
  51858. return tree
  51859. }
  51860. /**
  51861. * Runtime helper for v-once.
  51862. * Effectively it means marking the node as static with a unique key.
  51863. */
  51864. function markOnce (
  51865. tree,
  51866. index,
  51867. key
  51868. ) {
  51869. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51870. return tree
  51871. }
  51872. function markStatic (
  51873. tree,
  51874. key,
  51875. isOnce
  51876. ) {
  51877. if (Array.isArray(tree)) {
  51878. for (var i = 0; i < tree.length; i++) {
  51879. if (tree[i] && typeof tree[i] !== 'string') {
  51880. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51881. }
  51882. }
  51883. } else {
  51884. markStaticNode(tree, key, isOnce);
  51885. }
  51886. }
  51887. function markStaticNode (node, key, isOnce) {
  51888. node.isStatic = true;
  51889. node.key = key;
  51890. node.isOnce = isOnce;
  51891. }
  51892. /* */
  51893. function bindObjectListeners (data, value) {
  51894. if (value) {
  51895. if (!isPlainObject(value)) {
  51896. warn(
  51897. 'v-on without argument expects an Object value',
  51898. this
  51899. );
  51900. } else {
  51901. var on = data.on = data.on ? extend({}, data.on) : {};
  51902. for (var key in value) {
  51903. var existing = on[key];
  51904. var ours = value[key];
  51905. on[key] = existing ? [].concat(existing, ours) : ours;
  51906. }
  51907. }
  51908. }
  51909. return data
  51910. }
  51911. /* */
  51912. function resolveScopedSlots (
  51913. fns, // see flow/vnode
  51914. res,
  51915. // the following are added in 2.6
  51916. hasDynamicKeys,
  51917. contentHashKey
  51918. ) {
  51919. res = res || { $stable: !hasDynamicKeys };
  51920. for (var i = 0; i < fns.length; i++) {
  51921. var slot = fns[i];
  51922. if (Array.isArray(slot)) {
  51923. resolveScopedSlots(slot, res, hasDynamicKeys);
  51924. } else if (slot) {
  51925. // marker for reverse proxying v-slot without scope on this.$slots
  51926. if (slot.proxy) {
  51927. slot.fn.proxy = true;
  51928. }
  51929. res[slot.key] = slot.fn;
  51930. }
  51931. }
  51932. if (contentHashKey) {
  51933. (res).$key = contentHashKey;
  51934. }
  51935. return res
  51936. }
  51937. /* */
  51938. function bindDynamicKeys (baseObj, values) {
  51939. for (var i = 0; i < values.length; i += 2) {
  51940. var key = values[i];
  51941. if (typeof key === 'string' && key) {
  51942. baseObj[values[i]] = values[i + 1];
  51943. } else if (key !== '' && key !== null) {
  51944. // null is a special value for explicitly removing a binding
  51945. warn(
  51946. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51947. this
  51948. );
  51949. }
  51950. }
  51951. return baseObj
  51952. }
  51953. // helper to dynamically append modifier runtime markers to event names.
  51954. // ensure only append when value is already string, otherwise it will be cast
  51955. // to string and cause the type check to miss.
  51956. function prependModifier (value, symbol) {
  51957. return typeof value === 'string' ? symbol + value : value
  51958. }
  51959. /* */
  51960. function installRenderHelpers (target) {
  51961. target._o = markOnce;
  51962. target._n = toNumber;
  51963. target._s = toString;
  51964. target._l = renderList;
  51965. target._t = renderSlot;
  51966. target._q = looseEqual;
  51967. target._i = looseIndexOf;
  51968. target._m = renderStatic;
  51969. target._f = resolveFilter;
  51970. target._k = checkKeyCodes;
  51971. target._b = bindObjectProps;
  51972. target._v = createTextVNode;
  51973. target._e = createEmptyVNode;
  51974. target._u = resolveScopedSlots;
  51975. target._g = bindObjectListeners;
  51976. target._d = bindDynamicKeys;
  51977. target._p = prependModifier;
  51978. }
  51979. /* */
  51980. function FunctionalRenderContext (
  51981. data,
  51982. props,
  51983. children,
  51984. parent,
  51985. Ctor
  51986. ) {
  51987. var this$1 = this;
  51988. var options = Ctor.options;
  51989. // ensure the createElement function in functional components
  51990. // gets a unique context - this is necessary for correct named slot check
  51991. var contextVm;
  51992. if (hasOwn(parent, '_uid')) {
  51993. contextVm = Object.create(parent);
  51994. // $flow-disable-line
  51995. contextVm._original = parent;
  51996. } else {
  51997. // the context vm passed in is a functional context as well.
  51998. // in this case we want to make sure we are able to get a hold to the
  51999. // real context instance.
  52000. contextVm = parent;
  52001. // $flow-disable-line
  52002. parent = parent._original;
  52003. }
  52004. var isCompiled = isTrue(options._compiled);
  52005. var needNormalization = !isCompiled;
  52006. this.data = data;
  52007. this.props = props;
  52008. this.children = children;
  52009. this.parent = parent;
  52010. this.listeners = data.on || emptyObject;
  52011. this.injections = resolveInject(options.inject, parent);
  52012. this.slots = function () {
  52013. if (!this$1.$slots) {
  52014. normalizeScopedSlots(
  52015. data.scopedSlots,
  52016. this$1.$slots = resolveSlots(children, parent)
  52017. );
  52018. }
  52019. return this$1.$slots
  52020. };
  52021. Object.defineProperty(this, 'scopedSlots', ({
  52022. enumerable: true,
  52023. get: function get () {
  52024. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52025. }
  52026. }));
  52027. // support for compiled functional template
  52028. if (isCompiled) {
  52029. // exposing $options for renderStatic()
  52030. this.$options = options;
  52031. // pre-resolve slots for renderSlot()
  52032. this.$slots = this.slots();
  52033. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52034. }
  52035. if (options._scopeId) {
  52036. this._c = function (a, b, c, d) {
  52037. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52038. if (vnode && !Array.isArray(vnode)) {
  52039. vnode.fnScopeId = options._scopeId;
  52040. vnode.fnContext = parent;
  52041. }
  52042. return vnode
  52043. };
  52044. } else {
  52045. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52046. }
  52047. }
  52048. installRenderHelpers(FunctionalRenderContext.prototype);
  52049. function createFunctionalComponent (
  52050. Ctor,
  52051. propsData,
  52052. data,
  52053. contextVm,
  52054. children
  52055. ) {
  52056. var options = Ctor.options;
  52057. var props = {};
  52058. var propOptions = options.props;
  52059. if (isDef(propOptions)) {
  52060. for (var key in propOptions) {
  52061. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52062. }
  52063. } else {
  52064. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52065. if (isDef(data.props)) { mergeProps(props, data.props); }
  52066. }
  52067. var renderContext = new FunctionalRenderContext(
  52068. data,
  52069. props,
  52070. children,
  52071. contextVm,
  52072. Ctor
  52073. );
  52074. var vnode = options.render.call(null, renderContext._c, renderContext);
  52075. if (vnode instanceof VNode) {
  52076. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52077. } else if (Array.isArray(vnode)) {
  52078. var vnodes = normalizeChildren(vnode) || [];
  52079. var res = new Array(vnodes.length);
  52080. for (var i = 0; i < vnodes.length; i++) {
  52081. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52082. }
  52083. return res
  52084. }
  52085. }
  52086. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52087. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52088. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52089. // that should not be matched to match.
  52090. var clone = cloneVNode(vnode);
  52091. clone.fnContext = contextVm;
  52092. clone.fnOptions = options;
  52093. {
  52094. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52095. }
  52096. if (data.slot) {
  52097. (clone.data || (clone.data = {})).slot = data.slot;
  52098. }
  52099. return clone
  52100. }
  52101. function mergeProps (to, from) {
  52102. for (var key in from) {
  52103. to[camelize(key)] = from[key];
  52104. }
  52105. }
  52106. /* */
  52107. /* */
  52108. /* */
  52109. /* */
  52110. // inline hooks to be invoked on component VNodes during patch
  52111. var componentVNodeHooks = {
  52112. init: function init (vnode, hydrating) {
  52113. if (
  52114. vnode.componentInstance &&
  52115. !vnode.componentInstance._isDestroyed &&
  52116. vnode.data.keepAlive
  52117. ) {
  52118. // kept-alive components, treat as a patch
  52119. var mountedNode = vnode; // work around flow
  52120. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52121. } else {
  52122. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52123. vnode,
  52124. activeInstance
  52125. );
  52126. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52127. }
  52128. },
  52129. prepatch: function prepatch (oldVnode, vnode) {
  52130. var options = vnode.componentOptions;
  52131. var child = vnode.componentInstance = oldVnode.componentInstance;
  52132. updateChildComponent(
  52133. child,
  52134. options.propsData, // updated props
  52135. options.listeners, // updated listeners
  52136. vnode, // new parent vnode
  52137. options.children // new children
  52138. );
  52139. },
  52140. insert: function insert (vnode) {
  52141. var context = vnode.context;
  52142. var componentInstance = vnode.componentInstance;
  52143. if (!componentInstance._isMounted) {
  52144. componentInstance._isMounted = true;
  52145. callHook(componentInstance, 'mounted');
  52146. }
  52147. if (vnode.data.keepAlive) {
  52148. if (context._isMounted) {
  52149. // vue-router#1212
  52150. // During updates, a kept-alive component's child components may
  52151. // change, so directly walking the tree here may call activated hooks
  52152. // on incorrect children. Instead we push them into a queue which will
  52153. // be processed after the whole patch process ended.
  52154. queueActivatedComponent(componentInstance);
  52155. } else {
  52156. activateChildComponent(componentInstance, true /* direct */);
  52157. }
  52158. }
  52159. },
  52160. destroy: function destroy (vnode) {
  52161. var componentInstance = vnode.componentInstance;
  52162. if (!componentInstance._isDestroyed) {
  52163. if (!vnode.data.keepAlive) {
  52164. componentInstance.$destroy();
  52165. } else {
  52166. deactivateChildComponent(componentInstance, true /* direct */);
  52167. }
  52168. }
  52169. }
  52170. };
  52171. var hooksToMerge = Object.keys(componentVNodeHooks);
  52172. function createComponent (
  52173. Ctor,
  52174. data,
  52175. context,
  52176. children,
  52177. tag
  52178. ) {
  52179. if (isUndef(Ctor)) {
  52180. return
  52181. }
  52182. var baseCtor = context.$options._base;
  52183. // plain options object: turn it into a constructor
  52184. if (isObject(Ctor)) {
  52185. Ctor = baseCtor.extend(Ctor);
  52186. }
  52187. // if at this stage it's not a constructor or an async component factory,
  52188. // reject.
  52189. if (typeof Ctor !== 'function') {
  52190. {
  52191. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52192. }
  52193. return
  52194. }
  52195. // async component
  52196. var asyncFactory;
  52197. if (isUndef(Ctor.cid)) {
  52198. asyncFactory = Ctor;
  52199. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52200. if (Ctor === undefined) {
  52201. // return a placeholder node for async component, which is rendered
  52202. // as a comment node but preserves all the raw information for the node.
  52203. // the information will be used for async server-rendering and hydration.
  52204. return createAsyncPlaceholder(
  52205. asyncFactory,
  52206. data,
  52207. context,
  52208. children,
  52209. tag
  52210. )
  52211. }
  52212. }
  52213. data = data || {};
  52214. // resolve constructor options in case global mixins are applied after
  52215. // component constructor creation
  52216. resolveConstructorOptions(Ctor);
  52217. // transform component v-model data into props & events
  52218. if (isDef(data.model)) {
  52219. transformModel(Ctor.options, data);
  52220. }
  52221. // extract props
  52222. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52223. // functional component
  52224. if (isTrue(Ctor.options.functional)) {
  52225. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52226. }
  52227. // extract listeners, since these needs to be treated as
  52228. // child component listeners instead of DOM listeners
  52229. var listeners = data.on;
  52230. // replace with listeners with .native modifier
  52231. // so it gets processed during parent component patch.
  52232. data.on = data.nativeOn;
  52233. if (isTrue(Ctor.options.abstract)) {
  52234. // abstract components do not keep anything
  52235. // other than props & listeners & slot
  52236. // work around flow
  52237. var slot = data.slot;
  52238. data = {};
  52239. if (slot) {
  52240. data.slot = slot;
  52241. }
  52242. }
  52243. // install component management hooks onto the placeholder node
  52244. installComponentHooks(data);
  52245. // return a placeholder vnode
  52246. var name = Ctor.options.name || tag;
  52247. var vnode = new VNode(
  52248. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52249. data, undefined, undefined, undefined, context,
  52250. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52251. asyncFactory
  52252. );
  52253. return vnode
  52254. }
  52255. function createComponentInstanceForVnode (
  52256. vnode, // we know it's MountedComponentVNode but flow doesn't
  52257. parent // activeInstance in lifecycle state
  52258. ) {
  52259. var options = {
  52260. _isComponent: true,
  52261. _parentVnode: vnode,
  52262. parent: parent
  52263. };
  52264. // check inline-template render functions
  52265. var inlineTemplate = vnode.data.inlineTemplate;
  52266. if (isDef(inlineTemplate)) {
  52267. options.render = inlineTemplate.render;
  52268. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52269. }
  52270. return new vnode.componentOptions.Ctor(options)
  52271. }
  52272. function installComponentHooks (data) {
  52273. var hooks = data.hook || (data.hook = {});
  52274. for (var i = 0; i < hooksToMerge.length; i++) {
  52275. var key = hooksToMerge[i];
  52276. var existing = hooks[key];
  52277. var toMerge = componentVNodeHooks[key];
  52278. if (existing !== toMerge && !(existing && existing._merged)) {
  52279. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52280. }
  52281. }
  52282. }
  52283. function mergeHook$1 (f1, f2) {
  52284. var merged = function (a, b) {
  52285. // flow complains about extra args which is why we use any
  52286. f1(a, b);
  52287. f2(a, b);
  52288. };
  52289. merged._merged = true;
  52290. return merged
  52291. }
  52292. // transform component v-model info (value and callback) into
  52293. // prop and event handler respectively.
  52294. function transformModel (options, data) {
  52295. var prop = (options.model && options.model.prop) || 'value';
  52296. var event = (options.model && options.model.event) || 'input'
  52297. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52298. var on = data.on || (data.on = {});
  52299. var existing = on[event];
  52300. var callback = data.model.callback;
  52301. if (isDef(existing)) {
  52302. if (
  52303. Array.isArray(existing)
  52304. ? existing.indexOf(callback) === -1
  52305. : existing !== callback
  52306. ) {
  52307. on[event] = [callback].concat(existing);
  52308. }
  52309. } else {
  52310. on[event] = callback;
  52311. }
  52312. }
  52313. /* */
  52314. var SIMPLE_NORMALIZE = 1;
  52315. var ALWAYS_NORMALIZE = 2;
  52316. // wrapper function for providing a more flexible interface
  52317. // without getting yelled at by flow
  52318. function createElement (
  52319. context,
  52320. tag,
  52321. data,
  52322. children,
  52323. normalizationType,
  52324. alwaysNormalize
  52325. ) {
  52326. if (Array.isArray(data) || isPrimitive(data)) {
  52327. normalizationType = children;
  52328. children = data;
  52329. data = undefined;
  52330. }
  52331. if (isTrue(alwaysNormalize)) {
  52332. normalizationType = ALWAYS_NORMALIZE;
  52333. }
  52334. return _createElement(context, tag, data, children, normalizationType)
  52335. }
  52336. function _createElement (
  52337. context,
  52338. tag,
  52339. data,
  52340. children,
  52341. normalizationType
  52342. ) {
  52343. if (isDef(data) && isDef((data).__ob__)) {
  52344. warn(
  52345. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52346. 'Always create fresh vnode data objects in each render!',
  52347. context
  52348. );
  52349. return createEmptyVNode()
  52350. }
  52351. // object syntax in v-bind
  52352. if (isDef(data) && isDef(data.is)) {
  52353. tag = data.is;
  52354. }
  52355. if (!tag) {
  52356. // in case of component :is set to falsy value
  52357. return createEmptyVNode()
  52358. }
  52359. // warn against non-primitive key
  52360. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52361. ) {
  52362. {
  52363. warn(
  52364. 'Avoid using non-primitive value as key, ' +
  52365. 'use string/number value instead.',
  52366. context
  52367. );
  52368. }
  52369. }
  52370. // support single function children as default scoped slot
  52371. if (Array.isArray(children) &&
  52372. typeof children[0] === 'function'
  52373. ) {
  52374. data = data || {};
  52375. data.scopedSlots = { default: children[0] };
  52376. children.length = 0;
  52377. }
  52378. if (normalizationType === ALWAYS_NORMALIZE) {
  52379. children = normalizeChildren(children);
  52380. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52381. children = simpleNormalizeChildren(children);
  52382. }
  52383. var vnode, ns;
  52384. if (typeof tag === 'string') {
  52385. var Ctor;
  52386. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52387. if (config.isReservedTag(tag)) {
  52388. // platform built-in elements
  52389. if (isDef(data) && isDef(data.nativeOn)) {
  52390. warn(
  52391. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52392. context
  52393. );
  52394. }
  52395. vnode = new VNode(
  52396. config.parsePlatformTagName(tag), data, children,
  52397. undefined, undefined, context
  52398. );
  52399. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52400. // component
  52401. vnode = createComponent(Ctor, data, context, children, tag);
  52402. } else {
  52403. // unknown or unlisted namespaced elements
  52404. // check at runtime because it may get assigned a namespace when its
  52405. // parent normalizes children
  52406. vnode = new VNode(
  52407. tag, data, children,
  52408. undefined, undefined, context
  52409. );
  52410. }
  52411. } else {
  52412. // direct component options / constructor
  52413. vnode = createComponent(tag, data, context, children);
  52414. }
  52415. if (Array.isArray(vnode)) {
  52416. return vnode
  52417. } else if (isDef(vnode)) {
  52418. if (isDef(ns)) { applyNS(vnode, ns); }
  52419. if (isDef(data)) { registerDeepBindings(data); }
  52420. return vnode
  52421. } else {
  52422. return createEmptyVNode()
  52423. }
  52424. }
  52425. function applyNS (vnode, ns, force) {
  52426. vnode.ns = ns;
  52427. if (vnode.tag === 'foreignObject') {
  52428. // use default namespace inside foreignObject
  52429. ns = undefined;
  52430. force = true;
  52431. }
  52432. if (isDef(vnode.children)) {
  52433. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52434. var child = vnode.children[i];
  52435. if (isDef(child.tag) && (
  52436. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52437. applyNS(child, ns, force);
  52438. }
  52439. }
  52440. }
  52441. }
  52442. // ref #5318
  52443. // necessary to ensure parent re-render when deep bindings like :style and
  52444. // :class are used on slot nodes
  52445. function registerDeepBindings (data) {
  52446. if (isObject(data.style)) {
  52447. traverse(data.style);
  52448. }
  52449. if (isObject(data.class)) {
  52450. traverse(data.class);
  52451. }
  52452. }
  52453. /* */
  52454. function initRender (vm) {
  52455. vm._vnode = null; // the root of the child tree
  52456. vm._staticTrees = null; // v-once cached trees
  52457. var options = vm.$options;
  52458. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52459. var renderContext = parentVnode && parentVnode.context;
  52460. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52461. vm.$scopedSlots = emptyObject;
  52462. // bind the createElement fn to this instance
  52463. // so that we get proper render context inside it.
  52464. // args order: tag, data, children, normalizationType, alwaysNormalize
  52465. // internal version is used by render functions compiled from templates
  52466. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52467. // normalization is always applied for the public version, used in
  52468. // user-written render functions.
  52469. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52470. // $attrs & $listeners are exposed for easier HOC creation.
  52471. // they need to be reactive so that HOCs using them are always updated
  52472. var parentData = parentVnode && parentVnode.data;
  52473. /* istanbul ignore else */
  52474. {
  52475. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52476. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52477. }, true);
  52478. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52479. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52480. }, true);
  52481. }
  52482. }
  52483. var currentRenderingInstance = null;
  52484. function renderMixin (Vue) {
  52485. // install runtime convenience helpers
  52486. installRenderHelpers(Vue.prototype);
  52487. Vue.prototype.$nextTick = function (fn) {
  52488. return nextTick(fn, this)
  52489. };
  52490. Vue.prototype._render = function () {
  52491. var vm = this;
  52492. var ref = vm.$options;
  52493. var render = ref.render;
  52494. var _parentVnode = ref._parentVnode;
  52495. if (_parentVnode) {
  52496. vm.$scopedSlots = normalizeScopedSlots(
  52497. _parentVnode.data.scopedSlots,
  52498. vm.$slots,
  52499. vm.$scopedSlots
  52500. );
  52501. }
  52502. // set parent vnode. this allows render functions to have access
  52503. // to the data on the placeholder node.
  52504. vm.$vnode = _parentVnode;
  52505. // render self
  52506. var vnode;
  52507. try {
  52508. // There's no need to maintain a stack because all render fns are called
  52509. // separately from one another. Nested component's render fns are called
  52510. // when parent component is patched.
  52511. currentRenderingInstance = vm;
  52512. vnode = render.call(vm._renderProxy, vm.$createElement);
  52513. } catch (e) {
  52514. handleError(e, vm, "render");
  52515. // return error render result,
  52516. // or previous vnode to prevent render error causing blank component
  52517. /* istanbul ignore else */
  52518. if (vm.$options.renderError) {
  52519. try {
  52520. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52521. } catch (e) {
  52522. handleError(e, vm, "renderError");
  52523. vnode = vm._vnode;
  52524. }
  52525. } else {
  52526. vnode = vm._vnode;
  52527. }
  52528. } finally {
  52529. currentRenderingInstance = null;
  52530. }
  52531. // if the returned array contains only a single node, allow it
  52532. if (Array.isArray(vnode) && vnode.length === 1) {
  52533. vnode = vnode[0];
  52534. }
  52535. // return empty vnode in case the render function errored out
  52536. if (!(vnode instanceof VNode)) {
  52537. if (Array.isArray(vnode)) {
  52538. warn(
  52539. 'Multiple root nodes returned from render function. Render function ' +
  52540. 'should return a single root node.',
  52541. vm
  52542. );
  52543. }
  52544. vnode = createEmptyVNode();
  52545. }
  52546. // set parent
  52547. vnode.parent = _parentVnode;
  52548. return vnode
  52549. };
  52550. }
  52551. /* */
  52552. function ensureCtor (comp, base) {
  52553. if (
  52554. comp.__esModule ||
  52555. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52556. ) {
  52557. comp = comp.default;
  52558. }
  52559. return isObject(comp)
  52560. ? base.extend(comp)
  52561. : comp
  52562. }
  52563. function createAsyncPlaceholder (
  52564. factory,
  52565. data,
  52566. context,
  52567. children,
  52568. tag
  52569. ) {
  52570. var node = createEmptyVNode();
  52571. node.asyncFactory = factory;
  52572. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52573. return node
  52574. }
  52575. function resolveAsyncComponent (
  52576. factory,
  52577. baseCtor
  52578. ) {
  52579. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52580. return factory.errorComp
  52581. }
  52582. if (isDef(factory.resolved)) {
  52583. return factory.resolved
  52584. }
  52585. var owner = currentRenderingInstance;
  52586. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52587. // already pending
  52588. factory.owners.push(owner);
  52589. }
  52590. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52591. return factory.loadingComp
  52592. }
  52593. if (owner && !isDef(factory.owners)) {
  52594. var owners = factory.owners = [owner];
  52595. var sync = true;
  52596. var timerLoading = null;
  52597. var timerTimeout = null
  52598. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52599. var forceRender = function (renderCompleted) {
  52600. for (var i = 0, l = owners.length; i < l; i++) {
  52601. (owners[i]).$forceUpdate();
  52602. }
  52603. if (renderCompleted) {
  52604. owners.length = 0;
  52605. if (timerLoading !== null) {
  52606. clearTimeout(timerLoading);
  52607. timerLoading = null;
  52608. }
  52609. if (timerTimeout !== null) {
  52610. clearTimeout(timerTimeout);
  52611. timerTimeout = null;
  52612. }
  52613. }
  52614. };
  52615. var resolve = once(function (res) {
  52616. // cache resolved
  52617. factory.resolved = ensureCtor(res, baseCtor);
  52618. // invoke callbacks only if this is not a synchronous resolve
  52619. // (async resolves are shimmed as synchronous during SSR)
  52620. if (!sync) {
  52621. forceRender(true);
  52622. } else {
  52623. owners.length = 0;
  52624. }
  52625. });
  52626. var reject = once(function (reason) {
  52627. warn(
  52628. "Failed to resolve async component: " + (String(factory)) +
  52629. (reason ? ("\nReason: " + reason) : '')
  52630. );
  52631. if (isDef(factory.errorComp)) {
  52632. factory.error = true;
  52633. forceRender(true);
  52634. }
  52635. });
  52636. var res = factory(resolve, reject);
  52637. if (isObject(res)) {
  52638. if (isPromise(res)) {
  52639. // () => Promise
  52640. if (isUndef(factory.resolved)) {
  52641. res.then(resolve, reject);
  52642. }
  52643. } else if (isPromise(res.component)) {
  52644. res.component.then(resolve, reject);
  52645. if (isDef(res.error)) {
  52646. factory.errorComp = ensureCtor(res.error, baseCtor);
  52647. }
  52648. if (isDef(res.loading)) {
  52649. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52650. if (res.delay === 0) {
  52651. factory.loading = true;
  52652. } else {
  52653. timerLoading = setTimeout(function () {
  52654. timerLoading = null;
  52655. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52656. factory.loading = true;
  52657. forceRender(false);
  52658. }
  52659. }, res.delay || 200);
  52660. }
  52661. }
  52662. if (isDef(res.timeout)) {
  52663. timerTimeout = setTimeout(function () {
  52664. timerTimeout = null;
  52665. if (isUndef(factory.resolved)) {
  52666. reject(
  52667. "timeout (" + (res.timeout) + "ms)"
  52668. );
  52669. }
  52670. }, res.timeout);
  52671. }
  52672. }
  52673. }
  52674. sync = false;
  52675. // return in case resolved synchronously
  52676. return factory.loading
  52677. ? factory.loadingComp
  52678. : factory.resolved
  52679. }
  52680. }
  52681. /* */
  52682. function isAsyncPlaceholder (node) {
  52683. return node.isComment && node.asyncFactory
  52684. }
  52685. /* */
  52686. function getFirstComponentChild (children) {
  52687. if (Array.isArray(children)) {
  52688. for (var i = 0; i < children.length; i++) {
  52689. var c = children[i];
  52690. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52691. return c
  52692. }
  52693. }
  52694. }
  52695. }
  52696. /* */
  52697. /* */
  52698. function initEvents (vm) {
  52699. vm._events = Object.create(null);
  52700. vm._hasHookEvent = false;
  52701. // init parent attached events
  52702. var listeners = vm.$options._parentListeners;
  52703. if (listeners) {
  52704. updateComponentListeners(vm, listeners);
  52705. }
  52706. }
  52707. var target;
  52708. function add (event, fn) {
  52709. target.$on(event, fn);
  52710. }
  52711. function remove$1 (event, fn) {
  52712. target.$off(event, fn);
  52713. }
  52714. function createOnceHandler (event, fn) {
  52715. var _target = target;
  52716. return function onceHandler () {
  52717. var res = fn.apply(null, arguments);
  52718. if (res !== null) {
  52719. _target.$off(event, onceHandler);
  52720. }
  52721. }
  52722. }
  52723. function updateComponentListeners (
  52724. vm,
  52725. listeners,
  52726. oldListeners
  52727. ) {
  52728. target = vm;
  52729. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52730. target = undefined;
  52731. }
  52732. function eventsMixin (Vue) {
  52733. var hookRE = /^hook:/;
  52734. Vue.prototype.$on = function (event, fn) {
  52735. var vm = this;
  52736. if (Array.isArray(event)) {
  52737. for (var i = 0, l = event.length; i < l; i++) {
  52738. vm.$on(event[i], fn);
  52739. }
  52740. } else {
  52741. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52742. // optimize hook:event cost by using a boolean flag marked at registration
  52743. // instead of a hash lookup
  52744. if (hookRE.test(event)) {
  52745. vm._hasHookEvent = true;
  52746. }
  52747. }
  52748. return vm
  52749. };
  52750. Vue.prototype.$once = function (event, fn) {
  52751. var vm = this;
  52752. function on () {
  52753. vm.$off(event, on);
  52754. fn.apply(vm, arguments);
  52755. }
  52756. on.fn = fn;
  52757. vm.$on(event, on);
  52758. return vm
  52759. };
  52760. Vue.prototype.$off = function (event, fn) {
  52761. var vm = this;
  52762. // all
  52763. if (!arguments.length) {
  52764. vm._events = Object.create(null);
  52765. return vm
  52766. }
  52767. // array of events
  52768. if (Array.isArray(event)) {
  52769. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52770. vm.$off(event[i$1], fn);
  52771. }
  52772. return vm
  52773. }
  52774. // specific event
  52775. var cbs = vm._events[event];
  52776. if (!cbs) {
  52777. return vm
  52778. }
  52779. if (!fn) {
  52780. vm._events[event] = null;
  52781. return vm
  52782. }
  52783. // specific handler
  52784. var cb;
  52785. var i = cbs.length;
  52786. while (i--) {
  52787. cb = cbs[i];
  52788. if (cb === fn || cb.fn === fn) {
  52789. cbs.splice(i, 1);
  52790. break
  52791. }
  52792. }
  52793. return vm
  52794. };
  52795. Vue.prototype.$emit = function (event) {
  52796. var vm = this;
  52797. {
  52798. var lowerCaseEvent = event.toLowerCase();
  52799. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52800. tip(
  52801. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52802. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52803. "Note that HTML attributes are case-insensitive and you cannot use " +
  52804. "v-on to listen to camelCase events when using in-DOM templates. " +
  52805. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52806. );
  52807. }
  52808. }
  52809. var cbs = vm._events[event];
  52810. if (cbs) {
  52811. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52812. var args = toArray(arguments, 1);
  52813. var info = "event handler for \"" + event + "\"";
  52814. for (var i = 0, l = cbs.length; i < l; i++) {
  52815. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52816. }
  52817. }
  52818. return vm
  52819. };
  52820. }
  52821. /* */
  52822. var activeInstance = null;
  52823. var isUpdatingChildComponent = false;
  52824. function setActiveInstance(vm) {
  52825. var prevActiveInstance = activeInstance;
  52826. activeInstance = vm;
  52827. return function () {
  52828. activeInstance = prevActiveInstance;
  52829. }
  52830. }
  52831. function initLifecycle (vm) {
  52832. var options = vm.$options;
  52833. // locate first non-abstract parent
  52834. var parent = options.parent;
  52835. if (parent && !options.abstract) {
  52836. while (parent.$options.abstract && parent.$parent) {
  52837. parent = parent.$parent;
  52838. }
  52839. parent.$children.push(vm);
  52840. }
  52841. vm.$parent = parent;
  52842. vm.$root = parent ? parent.$root : vm;
  52843. vm.$children = [];
  52844. vm.$refs = {};
  52845. vm._watcher = null;
  52846. vm._inactive = null;
  52847. vm._directInactive = false;
  52848. vm._isMounted = false;
  52849. vm._isDestroyed = false;
  52850. vm._isBeingDestroyed = false;
  52851. }
  52852. function lifecycleMixin (Vue) {
  52853. Vue.prototype._update = function (vnode, hydrating) {
  52854. var vm = this;
  52855. var prevEl = vm.$el;
  52856. var prevVnode = vm._vnode;
  52857. var restoreActiveInstance = setActiveInstance(vm);
  52858. vm._vnode = vnode;
  52859. // Vue.prototype.__patch__ is injected in entry points
  52860. // based on the rendering backend used.
  52861. if (!prevVnode) {
  52862. // initial render
  52863. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52864. } else {
  52865. // updates
  52866. vm.$el = vm.__patch__(prevVnode, vnode);
  52867. }
  52868. restoreActiveInstance();
  52869. // update __vue__ reference
  52870. if (prevEl) {
  52871. prevEl.__vue__ = null;
  52872. }
  52873. if (vm.$el) {
  52874. vm.$el.__vue__ = vm;
  52875. }
  52876. // if parent is an HOC, update its $el as well
  52877. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52878. vm.$parent.$el = vm.$el;
  52879. }
  52880. // updated hook is called by the scheduler to ensure that children are
  52881. // updated in a parent's updated hook.
  52882. };
  52883. Vue.prototype.$forceUpdate = function () {
  52884. var vm = this;
  52885. if (vm._watcher) {
  52886. vm._watcher.update();
  52887. }
  52888. };
  52889. Vue.prototype.$destroy = function () {
  52890. var vm = this;
  52891. if (vm._isBeingDestroyed) {
  52892. return
  52893. }
  52894. callHook(vm, 'beforeDestroy');
  52895. vm._isBeingDestroyed = true;
  52896. // remove self from parent
  52897. var parent = vm.$parent;
  52898. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52899. remove(parent.$children, vm);
  52900. }
  52901. // teardown watchers
  52902. if (vm._watcher) {
  52903. vm._watcher.teardown();
  52904. }
  52905. var i = vm._watchers.length;
  52906. while (i--) {
  52907. vm._watchers[i].teardown();
  52908. }
  52909. // remove reference from data ob
  52910. // frozen object may not have observer.
  52911. if (vm._data.__ob__) {
  52912. vm._data.__ob__.vmCount--;
  52913. }
  52914. // call the last hook...
  52915. vm._isDestroyed = true;
  52916. // invoke destroy hooks on current rendered tree
  52917. vm.__patch__(vm._vnode, null);
  52918. // fire destroyed hook
  52919. callHook(vm, 'destroyed');
  52920. // turn off all instance listeners.
  52921. vm.$off();
  52922. // remove __vue__ reference
  52923. if (vm.$el) {
  52924. vm.$el.__vue__ = null;
  52925. }
  52926. // release circular reference (#6759)
  52927. if (vm.$vnode) {
  52928. vm.$vnode.parent = null;
  52929. }
  52930. };
  52931. }
  52932. function mountComponent (
  52933. vm,
  52934. el,
  52935. hydrating
  52936. ) {
  52937. vm.$el = el;
  52938. if (!vm.$options.render) {
  52939. vm.$options.render = createEmptyVNode;
  52940. {
  52941. /* istanbul ignore if */
  52942. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52943. vm.$options.el || el) {
  52944. warn(
  52945. 'You are using the runtime-only build of Vue where the template ' +
  52946. 'compiler is not available. Either pre-compile the templates into ' +
  52947. 'render functions, or use the compiler-included build.',
  52948. vm
  52949. );
  52950. } else {
  52951. warn(
  52952. 'Failed to mount component: template or render function not defined.',
  52953. vm
  52954. );
  52955. }
  52956. }
  52957. }
  52958. callHook(vm, 'beforeMount');
  52959. var updateComponent;
  52960. /* istanbul ignore if */
  52961. if (config.performance && mark) {
  52962. updateComponent = function () {
  52963. var name = vm._name;
  52964. var id = vm._uid;
  52965. var startTag = "vue-perf-start:" + id;
  52966. var endTag = "vue-perf-end:" + id;
  52967. mark(startTag);
  52968. var vnode = vm._render();
  52969. mark(endTag);
  52970. measure(("vue " + name + " render"), startTag, endTag);
  52971. mark(startTag);
  52972. vm._update(vnode, hydrating);
  52973. mark(endTag);
  52974. measure(("vue " + name + " patch"), startTag, endTag);
  52975. };
  52976. } else {
  52977. updateComponent = function () {
  52978. vm._update(vm._render(), hydrating);
  52979. };
  52980. }
  52981. // we set this to vm._watcher inside the watcher's constructor
  52982. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52983. // component's mounted hook), which relies on vm._watcher being already defined
  52984. new Watcher(vm, updateComponent, noop, {
  52985. before: function before () {
  52986. if (vm._isMounted && !vm._isDestroyed) {
  52987. callHook(vm, 'beforeUpdate');
  52988. }
  52989. }
  52990. }, true /* isRenderWatcher */);
  52991. hydrating = false;
  52992. // manually mounted instance, call mounted on self
  52993. // mounted is called for render-created child components in its inserted hook
  52994. if (vm.$vnode == null) {
  52995. vm._isMounted = true;
  52996. callHook(vm, 'mounted');
  52997. }
  52998. return vm
  52999. }
  53000. function updateChildComponent (
  53001. vm,
  53002. propsData,
  53003. listeners,
  53004. parentVnode,
  53005. renderChildren
  53006. ) {
  53007. {
  53008. isUpdatingChildComponent = true;
  53009. }
  53010. // determine whether component has slot children
  53011. // we need to do this before overwriting $options._renderChildren.
  53012. // check if there are dynamic scopedSlots (hand-written or compiled but with
  53013. // dynamic slot names). Static scoped slots compiled from template has the
  53014. // "$stable" marker.
  53015. var newScopedSlots = parentVnode.data.scopedSlots;
  53016. var oldScopedSlots = vm.$scopedSlots;
  53017. var hasDynamicScopedSlot = !!(
  53018. (newScopedSlots && !newScopedSlots.$stable) ||
  53019. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53020. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53021. );
  53022. // Any static slot children from the parent may have changed during parent's
  53023. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53024. // update is necessary to ensure correctness.
  53025. var needsForceUpdate = !!(
  53026. renderChildren || // has new static slots
  53027. vm.$options._renderChildren || // has old static slots
  53028. hasDynamicScopedSlot
  53029. );
  53030. vm.$options._parentVnode = parentVnode;
  53031. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53032. if (vm._vnode) { // update child tree's parent
  53033. vm._vnode.parent = parentVnode;
  53034. }
  53035. vm.$options._renderChildren = renderChildren;
  53036. // update $attrs and $listeners hash
  53037. // these are also reactive so they may trigger child update if the child
  53038. // used them during render
  53039. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53040. vm.$listeners = listeners || emptyObject;
  53041. // update props
  53042. if (propsData && vm.$options.props) {
  53043. toggleObserving(false);
  53044. var props = vm._props;
  53045. var propKeys = vm.$options._propKeys || [];
  53046. for (var i = 0; i < propKeys.length; i++) {
  53047. var key = propKeys[i];
  53048. var propOptions = vm.$options.props; // wtf flow?
  53049. props[key] = validateProp(key, propOptions, propsData, vm);
  53050. }
  53051. toggleObserving(true);
  53052. // keep a copy of raw propsData
  53053. vm.$options.propsData = propsData;
  53054. }
  53055. // update listeners
  53056. listeners = listeners || emptyObject;
  53057. var oldListeners = vm.$options._parentListeners;
  53058. vm.$options._parentListeners = listeners;
  53059. updateComponentListeners(vm, listeners, oldListeners);
  53060. // resolve slots + force update if has children
  53061. if (needsForceUpdate) {
  53062. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53063. vm.$forceUpdate();
  53064. }
  53065. {
  53066. isUpdatingChildComponent = false;
  53067. }
  53068. }
  53069. function isInInactiveTree (vm) {
  53070. while (vm && (vm = vm.$parent)) {
  53071. if (vm._inactive) { return true }
  53072. }
  53073. return false
  53074. }
  53075. function activateChildComponent (vm, direct) {
  53076. if (direct) {
  53077. vm._directInactive = false;
  53078. if (isInInactiveTree(vm)) {
  53079. return
  53080. }
  53081. } else if (vm._directInactive) {
  53082. return
  53083. }
  53084. if (vm._inactive || vm._inactive === null) {
  53085. vm._inactive = false;
  53086. for (var i = 0; i < vm.$children.length; i++) {
  53087. activateChildComponent(vm.$children[i]);
  53088. }
  53089. callHook(vm, 'activated');
  53090. }
  53091. }
  53092. function deactivateChildComponent (vm, direct) {
  53093. if (direct) {
  53094. vm._directInactive = true;
  53095. if (isInInactiveTree(vm)) {
  53096. return
  53097. }
  53098. }
  53099. if (!vm._inactive) {
  53100. vm._inactive = true;
  53101. for (var i = 0; i < vm.$children.length; i++) {
  53102. deactivateChildComponent(vm.$children[i]);
  53103. }
  53104. callHook(vm, 'deactivated');
  53105. }
  53106. }
  53107. function callHook (vm, hook) {
  53108. // #7573 disable dep collection when invoking lifecycle hooks
  53109. pushTarget();
  53110. var handlers = vm.$options[hook];
  53111. var info = hook + " hook";
  53112. if (handlers) {
  53113. for (var i = 0, j = handlers.length; i < j; i++) {
  53114. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53115. }
  53116. }
  53117. if (vm._hasHookEvent) {
  53118. vm.$emit('hook:' + hook);
  53119. }
  53120. popTarget();
  53121. }
  53122. /* */
  53123. var MAX_UPDATE_COUNT = 100;
  53124. var queue = [];
  53125. var activatedChildren = [];
  53126. var has = {};
  53127. var circular = {};
  53128. var waiting = false;
  53129. var flushing = false;
  53130. var index = 0;
  53131. /**
  53132. * Reset the scheduler's state.
  53133. */
  53134. function resetSchedulerState () {
  53135. index = queue.length = activatedChildren.length = 0;
  53136. has = {};
  53137. {
  53138. circular = {};
  53139. }
  53140. waiting = flushing = false;
  53141. }
  53142. // Async edge case #6566 requires saving the timestamp when event listeners are
  53143. // attached. However, calling performance.now() has a perf overhead especially
  53144. // if the page has thousands of event listeners. Instead, we take a timestamp
  53145. // every time the scheduler flushes and use that for all event listeners
  53146. // attached during that flush.
  53147. var currentFlushTimestamp = 0;
  53148. // Async edge case fix requires storing an event listener's attach timestamp.
  53149. var getNow = Date.now;
  53150. // Determine what event timestamp the browser is using. Annoyingly, the
  53151. // timestamp can either be hi-res (relative to page load) or low-res
  53152. // (relative to UNIX epoch), so in order to compare time we have to use the
  53153. // same timestamp type when saving the flush timestamp.
  53154. // All IE versions use low-res event timestamps, and have problematic clock
  53155. // implementations (#9632)
  53156. if (inBrowser && !isIE) {
  53157. var performance = window.performance;
  53158. if (
  53159. performance &&
  53160. typeof performance.now === 'function' &&
  53161. getNow() > document.createEvent('Event').timeStamp
  53162. ) {
  53163. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53164. // smaller than it, it means the event is using a hi-res timestamp,
  53165. // and we need to use the hi-res version for event listener timestamps as
  53166. // well.
  53167. getNow = function () { return performance.now(); };
  53168. }
  53169. }
  53170. /**
  53171. * Flush both queues and run the watchers.
  53172. */
  53173. function flushSchedulerQueue () {
  53174. currentFlushTimestamp = getNow();
  53175. flushing = true;
  53176. var watcher, id;
  53177. // Sort queue before flush.
  53178. // This ensures that:
  53179. // 1. Components are updated from parent to child. (because parent is always
  53180. // created before the child)
  53181. // 2. A component's user watchers are run before its render watcher (because
  53182. // user watchers are created before the render watcher)
  53183. // 3. If a component is destroyed during a parent component's watcher run,
  53184. // its watchers can be skipped.
  53185. queue.sort(function (a, b) { return a.id - b.id; });
  53186. // do not cache length because more watchers might be pushed
  53187. // as we run existing watchers
  53188. for (index = 0; index < queue.length; index++) {
  53189. watcher = queue[index];
  53190. if (watcher.before) {
  53191. watcher.before();
  53192. }
  53193. id = watcher.id;
  53194. has[id] = null;
  53195. watcher.run();
  53196. // in dev build, check and stop circular updates.
  53197. if (has[id] != null) {
  53198. circular[id] = (circular[id] || 0) + 1;
  53199. if (circular[id] > MAX_UPDATE_COUNT) {
  53200. warn(
  53201. 'You may have an infinite update loop ' + (
  53202. watcher.user
  53203. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53204. : "in a component render function."
  53205. ),
  53206. watcher.vm
  53207. );
  53208. break
  53209. }
  53210. }
  53211. }
  53212. // keep copies of post queues before resetting state
  53213. var activatedQueue = activatedChildren.slice();
  53214. var updatedQueue = queue.slice();
  53215. resetSchedulerState();
  53216. // call component updated and activated hooks
  53217. callActivatedHooks(activatedQueue);
  53218. callUpdatedHooks(updatedQueue);
  53219. // devtool hook
  53220. /* istanbul ignore if */
  53221. if (devtools && config.devtools) {
  53222. devtools.emit('flush');
  53223. }
  53224. }
  53225. function callUpdatedHooks (queue) {
  53226. var i = queue.length;
  53227. while (i--) {
  53228. var watcher = queue[i];
  53229. var vm = watcher.vm;
  53230. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53231. callHook(vm, 'updated');
  53232. }
  53233. }
  53234. }
  53235. /**
  53236. * Queue a kept-alive component that was activated during patch.
  53237. * The queue will be processed after the entire tree has been patched.
  53238. */
  53239. function queueActivatedComponent (vm) {
  53240. // setting _inactive to false here so that a render function can
  53241. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53242. vm._inactive = false;
  53243. activatedChildren.push(vm);
  53244. }
  53245. function callActivatedHooks (queue) {
  53246. for (var i = 0; i < queue.length; i++) {
  53247. queue[i]._inactive = true;
  53248. activateChildComponent(queue[i], true /* true */);
  53249. }
  53250. }
  53251. /**
  53252. * Push a watcher into the watcher queue.
  53253. * Jobs with duplicate IDs will be skipped unless it's
  53254. * pushed when the queue is being flushed.
  53255. */
  53256. function queueWatcher (watcher) {
  53257. var id = watcher.id;
  53258. if (has[id] == null) {
  53259. has[id] = true;
  53260. if (!flushing) {
  53261. queue.push(watcher);
  53262. } else {
  53263. // if already flushing, splice the watcher based on its id
  53264. // if already past its id, it will be run next immediately.
  53265. var i = queue.length - 1;
  53266. while (i > index && queue[i].id > watcher.id) {
  53267. i--;
  53268. }
  53269. queue.splice(i + 1, 0, watcher);
  53270. }
  53271. // queue the flush
  53272. if (!waiting) {
  53273. waiting = true;
  53274. if (!config.async) {
  53275. flushSchedulerQueue();
  53276. return
  53277. }
  53278. nextTick(flushSchedulerQueue);
  53279. }
  53280. }
  53281. }
  53282. /* */
  53283. var uid$2 = 0;
  53284. /**
  53285. * A watcher parses an expression, collects dependencies,
  53286. * and fires callback when the expression value changes.
  53287. * This is used for both the $watch() api and directives.
  53288. */
  53289. var Watcher = function Watcher (
  53290. vm,
  53291. expOrFn,
  53292. cb,
  53293. options,
  53294. isRenderWatcher
  53295. ) {
  53296. this.vm = vm;
  53297. if (isRenderWatcher) {
  53298. vm._watcher = this;
  53299. }
  53300. vm._watchers.push(this);
  53301. // options
  53302. if (options) {
  53303. this.deep = !!options.deep;
  53304. this.user = !!options.user;
  53305. this.lazy = !!options.lazy;
  53306. this.sync = !!options.sync;
  53307. this.before = options.before;
  53308. } else {
  53309. this.deep = this.user = this.lazy = this.sync = false;
  53310. }
  53311. this.cb = cb;
  53312. this.id = ++uid$2; // uid for batching
  53313. this.active = true;
  53314. this.dirty = this.lazy; // for lazy watchers
  53315. this.deps = [];
  53316. this.newDeps = [];
  53317. this.depIds = new _Set();
  53318. this.newDepIds = new _Set();
  53319. this.expression = expOrFn.toString();
  53320. // parse expression for getter
  53321. if (typeof expOrFn === 'function') {
  53322. this.getter = expOrFn;
  53323. } else {
  53324. this.getter = parsePath(expOrFn);
  53325. if (!this.getter) {
  53326. this.getter = noop;
  53327. warn(
  53328. "Failed watching path: \"" + expOrFn + "\" " +
  53329. 'Watcher only accepts simple dot-delimited paths. ' +
  53330. 'For full control, use a function instead.',
  53331. vm
  53332. );
  53333. }
  53334. }
  53335. this.value = this.lazy
  53336. ? undefined
  53337. : this.get();
  53338. };
  53339. /**
  53340. * Evaluate the getter, and re-collect dependencies.
  53341. */
  53342. Watcher.prototype.get = function get () {
  53343. pushTarget(this);
  53344. var value;
  53345. var vm = this.vm;
  53346. try {
  53347. value = this.getter.call(vm, vm);
  53348. } catch (e) {
  53349. if (this.user) {
  53350. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53351. } else {
  53352. throw e
  53353. }
  53354. } finally {
  53355. // "touch" every property so they are all tracked as
  53356. // dependencies for deep watching
  53357. if (this.deep) {
  53358. traverse(value);
  53359. }
  53360. popTarget();
  53361. this.cleanupDeps();
  53362. }
  53363. return value
  53364. };
  53365. /**
  53366. * Add a dependency to this directive.
  53367. */
  53368. Watcher.prototype.addDep = function addDep (dep) {
  53369. var id = dep.id;
  53370. if (!this.newDepIds.has(id)) {
  53371. this.newDepIds.add(id);
  53372. this.newDeps.push(dep);
  53373. if (!this.depIds.has(id)) {
  53374. dep.addSub(this);
  53375. }
  53376. }
  53377. };
  53378. /**
  53379. * Clean up for dependency collection.
  53380. */
  53381. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53382. var i = this.deps.length;
  53383. while (i--) {
  53384. var dep = this.deps[i];
  53385. if (!this.newDepIds.has(dep.id)) {
  53386. dep.removeSub(this);
  53387. }
  53388. }
  53389. var tmp = this.depIds;
  53390. this.depIds = this.newDepIds;
  53391. this.newDepIds = tmp;
  53392. this.newDepIds.clear();
  53393. tmp = this.deps;
  53394. this.deps = this.newDeps;
  53395. this.newDeps = tmp;
  53396. this.newDeps.length = 0;
  53397. };
  53398. /**
  53399. * Subscriber interface.
  53400. * Will be called when a dependency changes.
  53401. */
  53402. Watcher.prototype.update = function update () {
  53403. /* istanbul ignore else */
  53404. if (this.lazy) {
  53405. this.dirty = true;
  53406. } else if (this.sync) {
  53407. this.run();
  53408. } else {
  53409. queueWatcher(this);
  53410. }
  53411. };
  53412. /**
  53413. * Scheduler job interface.
  53414. * Will be called by the scheduler.
  53415. */
  53416. Watcher.prototype.run = function run () {
  53417. if (this.active) {
  53418. var value = this.get();
  53419. if (
  53420. value !== this.value ||
  53421. // Deep watchers and watchers on Object/Arrays should fire even
  53422. // when the value is the same, because the value may
  53423. // have mutated.
  53424. isObject(value) ||
  53425. this.deep
  53426. ) {
  53427. // set new value
  53428. var oldValue = this.value;
  53429. this.value = value;
  53430. if (this.user) {
  53431. try {
  53432. this.cb.call(this.vm, value, oldValue);
  53433. } catch (e) {
  53434. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53435. }
  53436. } else {
  53437. this.cb.call(this.vm, value, oldValue);
  53438. }
  53439. }
  53440. }
  53441. };
  53442. /**
  53443. * Evaluate the value of the watcher.
  53444. * This only gets called for lazy watchers.
  53445. */
  53446. Watcher.prototype.evaluate = function evaluate () {
  53447. this.value = this.get();
  53448. this.dirty = false;
  53449. };
  53450. /**
  53451. * Depend on all deps collected by this watcher.
  53452. */
  53453. Watcher.prototype.depend = function depend () {
  53454. var i = this.deps.length;
  53455. while (i--) {
  53456. this.deps[i].depend();
  53457. }
  53458. };
  53459. /**
  53460. * Remove self from all dependencies' subscriber list.
  53461. */
  53462. Watcher.prototype.teardown = function teardown () {
  53463. if (this.active) {
  53464. // remove self from vm's watcher list
  53465. // this is a somewhat expensive operation so we skip it
  53466. // if the vm is being destroyed.
  53467. if (!this.vm._isBeingDestroyed) {
  53468. remove(this.vm._watchers, this);
  53469. }
  53470. var i = this.deps.length;
  53471. while (i--) {
  53472. this.deps[i].removeSub(this);
  53473. }
  53474. this.active = false;
  53475. }
  53476. };
  53477. /* */
  53478. var sharedPropertyDefinition = {
  53479. enumerable: true,
  53480. configurable: true,
  53481. get: noop,
  53482. set: noop
  53483. };
  53484. function proxy (target, sourceKey, key) {
  53485. sharedPropertyDefinition.get = function proxyGetter () {
  53486. return this[sourceKey][key]
  53487. };
  53488. sharedPropertyDefinition.set = function proxySetter (val) {
  53489. this[sourceKey][key] = val;
  53490. };
  53491. Object.defineProperty(target, key, sharedPropertyDefinition);
  53492. }
  53493. function initState (vm) {
  53494. vm._watchers = [];
  53495. var opts = vm.$options;
  53496. if (opts.props) { initProps(vm, opts.props); }
  53497. if (opts.methods) { initMethods(vm, opts.methods); }
  53498. if (opts.data) {
  53499. initData(vm);
  53500. } else {
  53501. observe(vm._data = {}, true /* asRootData */);
  53502. }
  53503. if (opts.computed) { initComputed(vm, opts.computed); }
  53504. if (opts.watch && opts.watch !== nativeWatch) {
  53505. initWatch(vm, opts.watch);
  53506. }
  53507. }
  53508. function initProps (vm, propsOptions) {
  53509. var propsData = vm.$options.propsData || {};
  53510. var props = vm._props = {};
  53511. // cache prop keys so that future props updates can iterate using Array
  53512. // instead of dynamic object key enumeration.
  53513. var keys = vm.$options._propKeys = [];
  53514. var isRoot = !vm.$parent;
  53515. // root instance props should be converted
  53516. if (!isRoot) {
  53517. toggleObserving(false);
  53518. }
  53519. var loop = function ( key ) {
  53520. keys.push(key);
  53521. var value = validateProp(key, propsOptions, propsData, vm);
  53522. /* istanbul ignore else */
  53523. {
  53524. var hyphenatedKey = hyphenate(key);
  53525. if (isReservedAttribute(hyphenatedKey) ||
  53526. config.isReservedAttr(hyphenatedKey)) {
  53527. warn(
  53528. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53529. vm
  53530. );
  53531. }
  53532. defineReactive$$1(props, key, value, function () {
  53533. if (!isRoot && !isUpdatingChildComponent) {
  53534. warn(
  53535. "Avoid mutating a prop directly since the value will be " +
  53536. "overwritten whenever the parent component re-renders. " +
  53537. "Instead, use a data or computed property based on the prop's " +
  53538. "value. Prop being mutated: \"" + key + "\"",
  53539. vm
  53540. );
  53541. }
  53542. });
  53543. }
  53544. // static props are already proxied on the component's prototype
  53545. // during Vue.extend(). We only need to proxy props defined at
  53546. // instantiation here.
  53547. if (!(key in vm)) {
  53548. proxy(vm, "_props", key);
  53549. }
  53550. };
  53551. for (var key in propsOptions) loop( key );
  53552. toggleObserving(true);
  53553. }
  53554. function initData (vm) {
  53555. var data = vm.$options.data;
  53556. data = vm._data = typeof data === 'function'
  53557. ? getData(data, vm)
  53558. : data || {};
  53559. if (!isPlainObject(data)) {
  53560. data = {};
  53561. warn(
  53562. 'data functions should return an object:\n' +
  53563. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53564. vm
  53565. );
  53566. }
  53567. // proxy data on instance
  53568. var keys = Object.keys(data);
  53569. var props = vm.$options.props;
  53570. var methods = vm.$options.methods;
  53571. var i = keys.length;
  53572. while (i--) {
  53573. var key = keys[i];
  53574. {
  53575. if (methods && hasOwn(methods, key)) {
  53576. warn(
  53577. ("Method \"" + key + "\" has already been defined as a data property."),
  53578. vm
  53579. );
  53580. }
  53581. }
  53582. if (props && hasOwn(props, key)) {
  53583. warn(
  53584. "The data property \"" + key + "\" is already declared as a prop. " +
  53585. "Use prop default value instead.",
  53586. vm
  53587. );
  53588. } else if (!isReserved(key)) {
  53589. proxy(vm, "_data", key);
  53590. }
  53591. }
  53592. // observe data
  53593. observe(data, true /* asRootData */);
  53594. }
  53595. function getData (data, vm) {
  53596. // #7573 disable dep collection when invoking data getters
  53597. pushTarget();
  53598. try {
  53599. return data.call(vm, vm)
  53600. } catch (e) {
  53601. handleError(e, vm, "data()");
  53602. return {}
  53603. } finally {
  53604. popTarget();
  53605. }
  53606. }
  53607. var computedWatcherOptions = { lazy: true };
  53608. function initComputed (vm, computed) {
  53609. // $flow-disable-line
  53610. var watchers = vm._computedWatchers = Object.create(null);
  53611. // computed properties are just getters during SSR
  53612. var isSSR = isServerRendering();
  53613. for (var key in computed) {
  53614. var userDef = computed[key];
  53615. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53616. if (getter == null) {
  53617. warn(
  53618. ("Getter is missing for computed property \"" + key + "\"."),
  53619. vm
  53620. );
  53621. }
  53622. if (!isSSR) {
  53623. // create internal watcher for the computed property.
  53624. watchers[key] = new Watcher(
  53625. vm,
  53626. getter || noop,
  53627. noop,
  53628. computedWatcherOptions
  53629. );
  53630. }
  53631. // component-defined computed properties are already defined on the
  53632. // component prototype. We only need to define computed properties defined
  53633. // at instantiation here.
  53634. if (!(key in vm)) {
  53635. defineComputed(vm, key, userDef);
  53636. } else {
  53637. if (key in vm.$data) {
  53638. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53639. } else if (vm.$options.props && key in vm.$options.props) {
  53640. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53641. }
  53642. }
  53643. }
  53644. }
  53645. function defineComputed (
  53646. target,
  53647. key,
  53648. userDef
  53649. ) {
  53650. var shouldCache = !isServerRendering();
  53651. if (typeof userDef === 'function') {
  53652. sharedPropertyDefinition.get = shouldCache
  53653. ? createComputedGetter(key)
  53654. : createGetterInvoker(userDef);
  53655. sharedPropertyDefinition.set = noop;
  53656. } else {
  53657. sharedPropertyDefinition.get = userDef.get
  53658. ? shouldCache && userDef.cache !== false
  53659. ? createComputedGetter(key)
  53660. : createGetterInvoker(userDef.get)
  53661. : noop;
  53662. sharedPropertyDefinition.set = userDef.set || noop;
  53663. }
  53664. if (sharedPropertyDefinition.set === noop) {
  53665. sharedPropertyDefinition.set = function () {
  53666. warn(
  53667. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53668. this
  53669. );
  53670. };
  53671. }
  53672. Object.defineProperty(target, key, sharedPropertyDefinition);
  53673. }
  53674. function createComputedGetter (key) {
  53675. return function computedGetter () {
  53676. var watcher = this._computedWatchers && this._computedWatchers[key];
  53677. if (watcher) {
  53678. if (watcher.dirty) {
  53679. watcher.evaluate();
  53680. }
  53681. if (Dep.target) {
  53682. watcher.depend();
  53683. }
  53684. return watcher.value
  53685. }
  53686. }
  53687. }
  53688. function createGetterInvoker(fn) {
  53689. return function computedGetter () {
  53690. return fn.call(this, this)
  53691. }
  53692. }
  53693. function initMethods (vm, methods) {
  53694. var props = vm.$options.props;
  53695. for (var key in methods) {
  53696. {
  53697. if (typeof methods[key] !== 'function') {
  53698. warn(
  53699. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53700. "Did you reference the function correctly?",
  53701. vm
  53702. );
  53703. }
  53704. if (props && hasOwn(props, key)) {
  53705. warn(
  53706. ("Method \"" + key + "\" has already been defined as a prop."),
  53707. vm
  53708. );
  53709. }
  53710. if ((key in vm) && isReserved(key)) {
  53711. warn(
  53712. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53713. "Avoid defining component methods that start with _ or $."
  53714. );
  53715. }
  53716. }
  53717. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53718. }
  53719. }
  53720. function initWatch (vm, watch) {
  53721. for (var key in watch) {
  53722. var handler = watch[key];
  53723. if (Array.isArray(handler)) {
  53724. for (var i = 0; i < handler.length; i++) {
  53725. createWatcher(vm, key, handler[i]);
  53726. }
  53727. } else {
  53728. createWatcher(vm, key, handler);
  53729. }
  53730. }
  53731. }
  53732. function createWatcher (
  53733. vm,
  53734. expOrFn,
  53735. handler,
  53736. options
  53737. ) {
  53738. if (isPlainObject(handler)) {
  53739. options = handler;
  53740. handler = handler.handler;
  53741. }
  53742. if (typeof handler === 'string') {
  53743. handler = vm[handler];
  53744. }
  53745. return vm.$watch(expOrFn, handler, options)
  53746. }
  53747. function stateMixin (Vue) {
  53748. // flow somehow has problems with directly declared definition object
  53749. // when using Object.defineProperty, so we have to procedurally build up
  53750. // the object here.
  53751. var dataDef = {};
  53752. dataDef.get = function () { return this._data };
  53753. var propsDef = {};
  53754. propsDef.get = function () { return this._props };
  53755. {
  53756. dataDef.set = function () {
  53757. warn(
  53758. 'Avoid replacing instance root $data. ' +
  53759. 'Use nested data properties instead.',
  53760. this
  53761. );
  53762. };
  53763. propsDef.set = function () {
  53764. warn("$props is readonly.", this);
  53765. };
  53766. }
  53767. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53768. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53769. Vue.prototype.$set = set;
  53770. Vue.prototype.$delete = del;
  53771. Vue.prototype.$watch = function (
  53772. expOrFn,
  53773. cb,
  53774. options
  53775. ) {
  53776. var vm = this;
  53777. if (isPlainObject(cb)) {
  53778. return createWatcher(vm, expOrFn, cb, options)
  53779. }
  53780. options = options || {};
  53781. options.user = true;
  53782. var watcher = new Watcher(vm, expOrFn, cb, options);
  53783. if (options.immediate) {
  53784. try {
  53785. cb.call(vm, watcher.value);
  53786. } catch (error) {
  53787. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53788. }
  53789. }
  53790. return function unwatchFn () {
  53791. watcher.teardown();
  53792. }
  53793. };
  53794. }
  53795. /* */
  53796. var uid$3 = 0;
  53797. function initMixin (Vue) {
  53798. Vue.prototype._init = function (options) {
  53799. var vm = this;
  53800. // a uid
  53801. vm._uid = uid$3++;
  53802. var startTag, endTag;
  53803. /* istanbul ignore if */
  53804. if (config.performance && mark) {
  53805. startTag = "vue-perf-start:" + (vm._uid);
  53806. endTag = "vue-perf-end:" + (vm._uid);
  53807. mark(startTag);
  53808. }
  53809. // a flag to avoid this being observed
  53810. vm._isVue = true;
  53811. // merge options
  53812. if (options && options._isComponent) {
  53813. // optimize internal component instantiation
  53814. // since dynamic options merging is pretty slow, and none of the
  53815. // internal component options needs special treatment.
  53816. initInternalComponent(vm, options);
  53817. } else {
  53818. vm.$options = mergeOptions(
  53819. resolveConstructorOptions(vm.constructor),
  53820. options || {},
  53821. vm
  53822. );
  53823. }
  53824. /* istanbul ignore else */
  53825. {
  53826. initProxy(vm);
  53827. }
  53828. // expose real self
  53829. vm._self = vm;
  53830. initLifecycle(vm);
  53831. initEvents(vm);
  53832. initRender(vm);
  53833. callHook(vm, 'beforeCreate');
  53834. initInjections(vm); // resolve injections before data/props
  53835. initState(vm);
  53836. initProvide(vm); // resolve provide after data/props
  53837. callHook(vm, 'created');
  53838. /* istanbul ignore if */
  53839. if (config.performance && mark) {
  53840. vm._name = formatComponentName(vm, false);
  53841. mark(endTag);
  53842. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53843. }
  53844. if (vm.$options.el) {
  53845. vm.$mount(vm.$options.el);
  53846. }
  53847. };
  53848. }
  53849. function initInternalComponent (vm, options) {
  53850. var opts = vm.$options = Object.create(vm.constructor.options);
  53851. // doing this because it's faster than dynamic enumeration.
  53852. var parentVnode = options._parentVnode;
  53853. opts.parent = options.parent;
  53854. opts._parentVnode = parentVnode;
  53855. var vnodeComponentOptions = parentVnode.componentOptions;
  53856. opts.propsData = vnodeComponentOptions.propsData;
  53857. opts._parentListeners = vnodeComponentOptions.listeners;
  53858. opts._renderChildren = vnodeComponentOptions.children;
  53859. opts._componentTag = vnodeComponentOptions.tag;
  53860. if (options.render) {
  53861. opts.render = options.render;
  53862. opts.staticRenderFns = options.staticRenderFns;
  53863. }
  53864. }
  53865. function resolveConstructorOptions (Ctor) {
  53866. var options = Ctor.options;
  53867. if (Ctor.super) {
  53868. var superOptions = resolveConstructorOptions(Ctor.super);
  53869. var cachedSuperOptions = Ctor.superOptions;
  53870. if (superOptions !== cachedSuperOptions) {
  53871. // super option changed,
  53872. // need to resolve new options.
  53873. Ctor.superOptions = superOptions;
  53874. // check if there are any late-modified/attached options (#4976)
  53875. var modifiedOptions = resolveModifiedOptions(Ctor);
  53876. // update base extend options
  53877. if (modifiedOptions) {
  53878. extend(Ctor.extendOptions, modifiedOptions);
  53879. }
  53880. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53881. if (options.name) {
  53882. options.components[options.name] = Ctor;
  53883. }
  53884. }
  53885. }
  53886. return options
  53887. }
  53888. function resolveModifiedOptions (Ctor) {
  53889. var modified;
  53890. var latest = Ctor.options;
  53891. var sealed = Ctor.sealedOptions;
  53892. for (var key in latest) {
  53893. if (latest[key] !== sealed[key]) {
  53894. if (!modified) { modified = {}; }
  53895. modified[key] = latest[key];
  53896. }
  53897. }
  53898. return modified
  53899. }
  53900. function Vue (options) {
  53901. if (!(this instanceof Vue)
  53902. ) {
  53903. warn('Vue is a constructor and should be called with the `new` keyword');
  53904. }
  53905. this._init(options);
  53906. }
  53907. initMixin(Vue);
  53908. stateMixin(Vue);
  53909. eventsMixin(Vue);
  53910. lifecycleMixin(Vue);
  53911. renderMixin(Vue);
  53912. /* */
  53913. function initUse (Vue) {
  53914. Vue.use = function (plugin) {
  53915. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53916. if (installedPlugins.indexOf(plugin) > -1) {
  53917. return this
  53918. }
  53919. // additional parameters
  53920. var args = toArray(arguments, 1);
  53921. args.unshift(this);
  53922. if (typeof plugin.install === 'function') {
  53923. plugin.install.apply(plugin, args);
  53924. } else if (typeof plugin === 'function') {
  53925. plugin.apply(null, args);
  53926. }
  53927. installedPlugins.push(plugin);
  53928. return this
  53929. };
  53930. }
  53931. /* */
  53932. function initMixin$1 (Vue) {
  53933. Vue.mixin = function (mixin) {
  53934. this.options = mergeOptions(this.options, mixin);
  53935. return this
  53936. };
  53937. }
  53938. /* */
  53939. function initExtend (Vue) {
  53940. /**
  53941. * Each instance constructor, including Vue, has a unique
  53942. * cid. This enables us to create wrapped "child
  53943. * constructors" for prototypal inheritance and cache them.
  53944. */
  53945. Vue.cid = 0;
  53946. var cid = 1;
  53947. /**
  53948. * Class inheritance
  53949. */
  53950. Vue.extend = function (extendOptions) {
  53951. extendOptions = extendOptions || {};
  53952. var Super = this;
  53953. var SuperId = Super.cid;
  53954. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53955. if (cachedCtors[SuperId]) {
  53956. return cachedCtors[SuperId]
  53957. }
  53958. var name = extendOptions.name || Super.options.name;
  53959. if (name) {
  53960. validateComponentName(name);
  53961. }
  53962. var Sub = function VueComponent (options) {
  53963. this._init(options);
  53964. };
  53965. Sub.prototype = Object.create(Super.prototype);
  53966. Sub.prototype.constructor = Sub;
  53967. Sub.cid = cid++;
  53968. Sub.options = mergeOptions(
  53969. Super.options,
  53970. extendOptions
  53971. );
  53972. Sub['super'] = Super;
  53973. // For props and computed properties, we define the proxy getters on
  53974. // the Vue instances at extension time, on the extended prototype. This
  53975. // avoids Object.defineProperty calls for each instance created.
  53976. if (Sub.options.props) {
  53977. initProps$1(Sub);
  53978. }
  53979. if (Sub.options.computed) {
  53980. initComputed$1(Sub);
  53981. }
  53982. // allow further extension/mixin/plugin usage
  53983. Sub.extend = Super.extend;
  53984. Sub.mixin = Super.mixin;
  53985. Sub.use = Super.use;
  53986. // create asset registers, so extended classes
  53987. // can have their private assets too.
  53988. ASSET_TYPES.forEach(function (type) {
  53989. Sub[type] = Super[type];
  53990. });
  53991. // enable recursive self-lookup
  53992. if (name) {
  53993. Sub.options.components[name] = Sub;
  53994. }
  53995. // keep a reference to the super options at extension time.
  53996. // later at instantiation we can check if Super's options have
  53997. // been updated.
  53998. Sub.superOptions = Super.options;
  53999. Sub.extendOptions = extendOptions;
  54000. Sub.sealedOptions = extend({}, Sub.options);
  54001. // cache constructor
  54002. cachedCtors[SuperId] = Sub;
  54003. return Sub
  54004. };
  54005. }
  54006. function initProps$1 (Comp) {
  54007. var props = Comp.options.props;
  54008. for (var key in props) {
  54009. proxy(Comp.prototype, "_props", key);
  54010. }
  54011. }
  54012. function initComputed$1 (Comp) {
  54013. var computed = Comp.options.computed;
  54014. for (var key in computed) {
  54015. defineComputed(Comp.prototype, key, computed[key]);
  54016. }
  54017. }
  54018. /* */
  54019. function initAssetRegisters (Vue) {
  54020. /**
  54021. * Create asset registration methods.
  54022. */
  54023. ASSET_TYPES.forEach(function (type) {
  54024. Vue[type] = function (
  54025. id,
  54026. definition
  54027. ) {
  54028. if (!definition) {
  54029. return this.options[type + 's'][id]
  54030. } else {
  54031. /* istanbul ignore if */
  54032. if (type === 'component') {
  54033. validateComponentName(id);
  54034. }
  54035. if (type === 'component' && isPlainObject(definition)) {
  54036. definition.name = definition.name || id;
  54037. definition = this.options._base.extend(definition);
  54038. }
  54039. if (type === 'directive' && typeof definition === 'function') {
  54040. definition = { bind: definition, update: definition };
  54041. }
  54042. this.options[type + 's'][id] = definition;
  54043. return definition
  54044. }
  54045. };
  54046. });
  54047. }
  54048. /* */
  54049. function getComponentName (opts) {
  54050. return opts && (opts.Ctor.options.name || opts.tag)
  54051. }
  54052. function matches (pattern, name) {
  54053. if (Array.isArray(pattern)) {
  54054. return pattern.indexOf(name) > -1
  54055. } else if (typeof pattern === 'string') {
  54056. return pattern.split(',').indexOf(name) > -1
  54057. } else if (isRegExp(pattern)) {
  54058. return pattern.test(name)
  54059. }
  54060. /* istanbul ignore next */
  54061. return false
  54062. }
  54063. function pruneCache (keepAliveInstance, filter) {
  54064. var cache = keepAliveInstance.cache;
  54065. var keys = keepAliveInstance.keys;
  54066. var _vnode = keepAliveInstance._vnode;
  54067. for (var key in cache) {
  54068. var cachedNode = cache[key];
  54069. if (cachedNode) {
  54070. var name = getComponentName(cachedNode.componentOptions);
  54071. if (name && !filter(name)) {
  54072. pruneCacheEntry(cache, key, keys, _vnode);
  54073. }
  54074. }
  54075. }
  54076. }
  54077. function pruneCacheEntry (
  54078. cache,
  54079. key,
  54080. keys,
  54081. current
  54082. ) {
  54083. var cached$$1 = cache[key];
  54084. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54085. cached$$1.componentInstance.$destroy();
  54086. }
  54087. cache[key] = null;
  54088. remove(keys, key);
  54089. }
  54090. var patternTypes = [String, RegExp, Array];
  54091. var KeepAlive = {
  54092. name: 'keep-alive',
  54093. abstract: true,
  54094. props: {
  54095. include: patternTypes,
  54096. exclude: patternTypes,
  54097. max: [String, Number]
  54098. },
  54099. created: function created () {
  54100. this.cache = Object.create(null);
  54101. this.keys = [];
  54102. },
  54103. destroyed: function destroyed () {
  54104. for (var key in this.cache) {
  54105. pruneCacheEntry(this.cache, key, this.keys);
  54106. }
  54107. },
  54108. mounted: function mounted () {
  54109. var this$1 = this;
  54110. this.$watch('include', function (val) {
  54111. pruneCache(this$1, function (name) { return matches(val, name); });
  54112. });
  54113. this.$watch('exclude', function (val) {
  54114. pruneCache(this$1, function (name) { return !matches(val, name); });
  54115. });
  54116. },
  54117. render: function render () {
  54118. var slot = this.$slots.default;
  54119. var vnode = getFirstComponentChild(slot);
  54120. var componentOptions = vnode && vnode.componentOptions;
  54121. if (componentOptions) {
  54122. // check pattern
  54123. var name = getComponentName(componentOptions);
  54124. var ref = this;
  54125. var include = ref.include;
  54126. var exclude = ref.exclude;
  54127. if (
  54128. // not included
  54129. (include && (!name || !matches(include, name))) ||
  54130. // excluded
  54131. (exclude && name && matches(exclude, name))
  54132. ) {
  54133. return vnode
  54134. }
  54135. var ref$1 = this;
  54136. var cache = ref$1.cache;
  54137. var keys = ref$1.keys;
  54138. var key = vnode.key == null
  54139. // same constructor may get registered as different local components
  54140. // so cid alone is not enough (#3269)
  54141. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54142. : vnode.key;
  54143. if (cache[key]) {
  54144. vnode.componentInstance = cache[key].componentInstance;
  54145. // make current key freshest
  54146. remove(keys, key);
  54147. keys.push(key);
  54148. } else {
  54149. cache[key] = vnode;
  54150. keys.push(key);
  54151. // prune oldest entry
  54152. if (this.max && keys.length > parseInt(this.max)) {
  54153. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54154. }
  54155. }
  54156. vnode.data.keepAlive = true;
  54157. }
  54158. return vnode || (slot && slot[0])
  54159. }
  54160. };
  54161. var builtInComponents = {
  54162. KeepAlive: KeepAlive
  54163. };
  54164. /* */
  54165. function initGlobalAPI (Vue) {
  54166. // config
  54167. var configDef = {};
  54168. configDef.get = function () { return config; };
  54169. {
  54170. configDef.set = function () {
  54171. warn(
  54172. 'Do not replace the Vue.config object, set individual fields instead.'
  54173. );
  54174. };
  54175. }
  54176. Object.defineProperty(Vue, 'config', configDef);
  54177. // exposed util methods.
  54178. // NOTE: these are not considered part of the public API - avoid relying on
  54179. // them unless you are aware of the risk.
  54180. Vue.util = {
  54181. warn: warn,
  54182. extend: extend,
  54183. mergeOptions: mergeOptions,
  54184. defineReactive: defineReactive$$1
  54185. };
  54186. Vue.set = set;
  54187. Vue.delete = del;
  54188. Vue.nextTick = nextTick;
  54189. // 2.6 explicit observable API
  54190. Vue.observable = function (obj) {
  54191. observe(obj);
  54192. return obj
  54193. };
  54194. Vue.options = Object.create(null);
  54195. ASSET_TYPES.forEach(function (type) {
  54196. Vue.options[type + 's'] = Object.create(null);
  54197. });
  54198. // this is used to identify the "base" constructor to extend all plain-object
  54199. // components with in Weex's multi-instance scenarios.
  54200. Vue.options._base = Vue;
  54201. extend(Vue.options.components, builtInComponents);
  54202. initUse(Vue);
  54203. initMixin$1(Vue);
  54204. initExtend(Vue);
  54205. initAssetRegisters(Vue);
  54206. }
  54207. initGlobalAPI(Vue);
  54208. Object.defineProperty(Vue.prototype, '$isServer', {
  54209. get: isServerRendering
  54210. });
  54211. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54212. get: function get () {
  54213. /* istanbul ignore next */
  54214. return this.$vnode && this.$vnode.ssrContext
  54215. }
  54216. });
  54217. // expose FunctionalRenderContext for ssr runtime helper installation
  54218. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54219. value: FunctionalRenderContext
  54220. });
  54221. Vue.version = '2.6.11';
  54222. /* */
  54223. // these are reserved for web because they are directly compiled away
  54224. // during template compilation
  54225. var isReservedAttr = makeMap('style,class');
  54226. // attributes that should be using props for binding
  54227. var acceptValue = makeMap('input,textarea,option,select,progress');
  54228. var mustUseProp = function (tag, type, attr) {
  54229. return (
  54230. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54231. (attr === 'selected' && tag === 'option') ||
  54232. (attr === 'checked' && tag === 'input') ||
  54233. (attr === 'muted' && tag === 'video')
  54234. )
  54235. };
  54236. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54237. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54238. var convertEnumeratedValue = function (key, value) {
  54239. return isFalsyAttrValue(value) || value === 'false'
  54240. ? 'false'
  54241. // allow arbitrary string value for contenteditable
  54242. : key === 'contenteditable' && isValidContentEditableValue(value)
  54243. ? value
  54244. : 'true'
  54245. };
  54246. var isBooleanAttr = makeMap(
  54247. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54248. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54249. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54250. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54251. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54252. 'truespeed,typemustmatch,visible'
  54253. );
  54254. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54255. var isXlink = function (name) {
  54256. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54257. };
  54258. var getXlinkProp = function (name) {
  54259. return isXlink(name) ? name.slice(6, name.length) : ''
  54260. };
  54261. var isFalsyAttrValue = function (val) {
  54262. return val == null || val === false
  54263. };
  54264. /* */
  54265. function genClassForVnode (vnode) {
  54266. var data = vnode.data;
  54267. var parentNode = vnode;
  54268. var childNode = vnode;
  54269. while (isDef(childNode.componentInstance)) {
  54270. childNode = childNode.componentInstance._vnode;
  54271. if (childNode && childNode.data) {
  54272. data = mergeClassData(childNode.data, data);
  54273. }
  54274. }
  54275. while (isDef(parentNode = parentNode.parent)) {
  54276. if (parentNode && parentNode.data) {
  54277. data = mergeClassData(data, parentNode.data);
  54278. }
  54279. }
  54280. return renderClass(data.staticClass, data.class)
  54281. }
  54282. function mergeClassData (child, parent) {
  54283. return {
  54284. staticClass: concat(child.staticClass, parent.staticClass),
  54285. class: isDef(child.class)
  54286. ? [child.class, parent.class]
  54287. : parent.class
  54288. }
  54289. }
  54290. function renderClass (
  54291. staticClass,
  54292. dynamicClass
  54293. ) {
  54294. if (isDef(staticClass) || isDef(dynamicClass)) {
  54295. return concat(staticClass, stringifyClass(dynamicClass))
  54296. }
  54297. /* istanbul ignore next */
  54298. return ''
  54299. }
  54300. function concat (a, b) {
  54301. return a ? b ? (a + ' ' + b) : a : (b || '')
  54302. }
  54303. function stringifyClass (value) {
  54304. if (Array.isArray(value)) {
  54305. return stringifyArray(value)
  54306. }
  54307. if (isObject(value)) {
  54308. return stringifyObject(value)
  54309. }
  54310. if (typeof value === 'string') {
  54311. return value
  54312. }
  54313. /* istanbul ignore next */
  54314. return ''
  54315. }
  54316. function stringifyArray (value) {
  54317. var res = '';
  54318. var stringified;
  54319. for (var i = 0, l = value.length; i < l; i++) {
  54320. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54321. if (res) { res += ' '; }
  54322. res += stringified;
  54323. }
  54324. }
  54325. return res
  54326. }
  54327. function stringifyObject (value) {
  54328. var res = '';
  54329. for (var key in value) {
  54330. if (value[key]) {
  54331. if (res) { res += ' '; }
  54332. res += key;
  54333. }
  54334. }
  54335. return res
  54336. }
  54337. /* */
  54338. var namespaceMap = {
  54339. svg: 'http://www.w3.org/2000/svg',
  54340. math: 'http://www.w3.org/1998/Math/MathML'
  54341. };
  54342. var isHTMLTag = makeMap(
  54343. 'html,body,base,head,link,meta,style,title,' +
  54344. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54345. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54346. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54347. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54348. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54349. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54350. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54351. 'output,progress,select,textarea,' +
  54352. 'details,dialog,menu,menuitem,summary,' +
  54353. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54354. );
  54355. // this map is intentionally selective, only covering SVG elements that may
  54356. // contain child elements.
  54357. var isSVG = makeMap(
  54358. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54359. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54360. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54361. true
  54362. );
  54363. var isPreTag = function (tag) { return tag === 'pre'; };
  54364. var isReservedTag = function (tag) {
  54365. return isHTMLTag(tag) || isSVG(tag)
  54366. };
  54367. function getTagNamespace (tag) {
  54368. if (isSVG(tag)) {
  54369. return 'svg'
  54370. }
  54371. // basic support for MathML
  54372. // note it doesn't support other MathML elements being component roots
  54373. if (tag === 'math') {
  54374. return 'math'
  54375. }
  54376. }
  54377. var unknownElementCache = Object.create(null);
  54378. function isUnknownElement (tag) {
  54379. /* istanbul ignore if */
  54380. if (!inBrowser) {
  54381. return true
  54382. }
  54383. if (isReservedTag(tag)) {
  54384. return false
  54385. }
  54386. tag = tag.toLowerCase();
  54387. /* istanbul ignore if */
  54388. if (unknownElementCache[tag] != null) {
  54389. return unknownElementCache[tag]
  54390. }
  54391. var el = document.createElement(tag);
  54392. if (tag.indexOf('-') > -1) {
  54393. // http://stackoverflow.com/a/28210364/1070244
  54394. return (unknownElementCache[tag] = (
  54395. el.constructor === window.HTMLUnknownElement ||
  54396. el.constructor === window.HTMLElement
  54397. ))
  54398. } else {
  54399. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54400. }
  54401. }
  54402. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54403. /* */
  54404. /**
  54405. * Query an element selector if it's not an element already.
  54406. */
  54407. function query (el) {
  54408. if (typeof el === 'string') {
  54409. var selected = document.querySelector(el);
  54410. if (!selected) {
  54411. warn(
  54412. 'Cannot find element: ' + el
  54413. );
  54414. return document.createElement('div')
  54415. }
  54416. return selected
  54417. } else {
  54418. return el
  54419. }
  54420. }
  54421. /* */
  54422. function createElement$1 (tagName, vnode) {
  54423. var elm = document.createElement(tagName);
  54424. if (tagName !== 'select') {
  54425. return elm
  54426. }
  54427. // false or null will remove the attribute but undefined will not
  54428. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54429. elm.setAttribute('multiple', 'multiple');
  54430. }
  54431. return elm
  54432. }
  54433. function createElementNS (namespace, tagName) {
  54434. return document.createElementNS(namespaceMap[namespace], tagName)
  54435. }
  54436. function createTextNode (text) {
  54437. return document.createTextNode(text)
  54438. }
  54439. function createComment (text) {
  54440. return document.createComment(text)
  54441. }
  54442. function insertBefore (parentNode, newNode, referenceNode) {
  54443. parentNode.insertBefore(newNode, referenceNode);
  54444. }
  54445. function removeChild (node, child) {
  54446. node.removeChild(child);
  54447. }
  54448. function appendChild (node, child) {
  54449. node.appendChild(child);
  54450. }
  54451. function parentNode (node) {
  54452. return node.parentNode
  54453. }
  54454. function nextSibling (node) {
  54455. return node.nextSibling
  54456. }
  54457. function tagName (node) {
  54458. return node.tagName
  54459. }
  54460. function setTextContent (node, text) {
  54461. node.textContent = text;
  54462. }
  54463. function setStyleScope (node, scopeId) {
  54464. node.setAttribute(scopeId, '');
  54465. }
  54466. var nodeOps = /*#__PURE__*/Object.freeze({
  54467. createElement: createElement$1,
  54468. createElementNS: createElementNS,
  54469. createTextNode: createTextNode,
  54470. createComment: createComment,
  54471. insertBefore: insertBefore,
  54472. removeChild: removeChild,
  54473. appendChild: appendChild,
  54474. parentNode: parentNode,
  54475. nextSibling: nextSibling,
  54476. tagName: tagName,
  54477. setTextContent: setTextContent,
  54478. setStyleScope: setStyleScope
  54479. });
  54480. /* */
  54481. var ref = {
  54482. create: function create (_, vnode) {
  54483. registerRef(vnode);
  54484. },
  54485. update: function update (oldVnode, vnode) {
  54486. if (oldVnode.data.ref !== vnode.data.ref) {
  54487. registerRef(oldVnode, true);
  54488. registerRef(vnode);
  54489. }
  54490. },
  54491. destroy: function destroy (vnode) {
  54492. registerRef(vnode, true);
  54493. }
  54494. };
  54495. function registerRef (vnode, isRemoval) {
  54496. var key = vnode.data.ref;
  54497. if (!isDef(key)) { return }
  54498. var vm = vnode.context;
  54499. var ref = vnode.componentInstance || vnode.elm;
  54500. var refs = vm.$refs;
  54501. if (isRemoval) {
  54502. if (Array.isArray(refs[key])) {
  54503. remove(refs[key], ref);
  54504. } else if (refs[key] === ref) {
  54505. refs[key] = undefined;
  54506. }
  54507. } else {
  54508. if (vnode.data.refInFor) {
  54509. if (!Array.isArray(refs[key])) {
  54510. refs[key] = [ref];
  54511. } else if (refs[key].indexOf(ref) < 0) {
  54512. // $flow-disable-line
  54513. refs[key].push(ref);
  54514. }
  54515. } else {
  54516. refs[key] = ref;
  54517. }
  54518. }
  54519. }
  54520. /**
  54521. * Virtual DOM patching algorithm based on Snabbdom by
  54522. * Simon Friis Vindum (@paldepind)
  54523. * Licensed under the MIT License
  54524. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54525. *
  54526. * modified by Evan You (@yyx990803)
  54527. *
  54528. * Not type-checking this because this file is perf-critical and the cost
  54529. * of making flow understand it is not worth it.
  54530. */
  54531. var emptyNode = new VNode('', {}, []);
  54532. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54533. function sameVnode (a, b) {
  54534. return (
  54535. a.key === b.key && (
  54536. (
  54537. a.tag === b.tag &&
  54538. a.isComment === b.isComment &&
  54539. isDef(a.data) === isDef(b.data) &&
  54540. sameInputType(a, b)
  54541. ) || (
  54542. isTrue(a.isAsyncPlaceholder) &&
  54543. a.asyncFactory === b.asyncFactory &&
  54544. isUndef(b.asyncFactory.error)
  54545. )
  54546. )
  54547. )
  54548. }
  54549. function sameInputType (a, b) {
  54550. if (a.tag !== 'input') { return true }
  54551. var i;
  54552. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54553. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54554. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54555. }
  54556. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54557. var i, key;
  54558. var map = {};
  54559. for (i = beginIdx; i <= endIdx; ++i) {
  54560. key = children[i].key;
  54561. if (isDef(key)) { map[key] = i; }
  54562. }
  54563. return map
  54564. }
  54565. function createPatchFunction (backend) {
  54566. var i, j;
  54567. var cbs = {};
  54568. var modules = backend.modules;
  54569. var nodeOps = backend.nodeOps;
  54570. for (i = 0; i < hooks.length; ++i) {
  54571. cbs[hooks[i]] = [];
  54572. for (j = 0; j < modules.length; ++j) {
  54573. if (isDef(modules[j][hooks[i]])) {
  54574. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54575. }
  54576. }
  54577. }
  54578. function emptyNodeAt (elm) {
  54579. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54580. }
  54581. function createRmCb (childElm, listeners) {
  54582. function remove$$1 () {
  54583. if (--remove$$1.listeners === 0) {
  54584. removeNode(childElm);
  54585. }
  54586. }
  54587. remove$$1.listeners = listeners;
  54588. return remove$$1
  54589. }
  54590. function removeNode (el) {
  54591. var parent = nodeOps.parentNode(el);
  54592. // element may have already been removed due to v-html / v-text
  54593. if (isDef(parent)) {
  54594. nodeOps.removeChild(parent, el);
  54595. }
  54596. }
  54597. function isUnknownElement$$1 (vnode, inVPre) {
  54598. return (
  54599. !inVPre &&
  54600. !vnode.ns &&
  54601. !(
  54602. config.ignoredElements.length &&
  54603. config.ignoredElements.some(function (ignore) {
  54604. return isRegExp(ignore)
  54605. ? ignore.test(vnode.tag)
  54606. : ignore === vnode.tag
  54607. })
  54608. ) &&
  54609. config.isUnknownElement(vnode.tag)
  54610. )
  54611. }
  54612. var creatingElmInVPre = 0;
  54613. function createElm (
  54614. vnode,
  54615. insertedVnodeQueue,
  54616. parentElm,
  54617. refElm,
  54618. nested,
  54619. ownerArray,
  54620. index
  54621. ) {
  54622. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54623. // This vnode was used in a previous render!
  54624. // now it's used as a new node, overwriting its elm would cause
  54625. // potential patch errors down the road when it's used as an insertion
  54626. // reference node. Instead, we clone the node on-demand before creating
  54627. // associated DOM element for it.
  54628. vnode = ownerArray[index] = cloneVNode(vnode);
  54629. }
  54630. vnode.isRootInsert = !nested; // for transition enter check
  54631. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54632. return
  54633. }
  54634. var data = vnode.data;
  54635. var children = vnode.children;
  54636. var tag = vnode.tag;
  54637. if (isDef(tag)) {
  54638. {
  54639. if (data && data.pre) {
  54640. creatingElmInVPre++;
  54641. }
  54642. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54643. warn(
  54644. 'Unknown custom element: <' + tag + '> - did you ' +
  54645. 'register the component correctly? For recursive components, ' +
  54646. 'make sure to provide the "name" option.',
  54647. vnode.context
  54648. );
  54649. }
  54650. }
  54651. vnode.elm = vnode.ns
  54652. ? nodeOps.createElementNS(vnode.ns, tag)
  54653. : nodeOps.createElement(tag, vnode);
  54654. setScope(vnode);
  54655. /* istanbul ignore if */
  54656. {
  54657. createChildren(vnode, children, insertedVnodeQueue);
  54658. if (isDef(data)) {
  54659. invokeCreateHooks(vnode, insertedVnodeQueue);
  54660. }
  54661. insert(parentElm, vnode.elm, refElm);
  54662. }
  54663. if (data && data.pre) {
  54664. creatingElmInVPre--;
  54665. }
  54666. } else if (isTrue(vnode.isComment)) {
  54667. vnode.elm = nodeOps.createComment(vnode.text);
  54668. insert(parentElm, vnode.elm, refElm);
  54669. } else {
  54670. vnode.elm = nodeOps.createTextNode(vnode.text);
  54671. insert(parentElm, vnode.elm, refElm);
  54672. }
  54673. }
  54674. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54675. var i = vnode.data;
  54676. if (isDef(i)) {
  54677. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54678. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54679. i(vnode, false /* hydrating */);
  54680. }
  54681. // after calling the init hook, if the vnode is a child component
  54682. // it should've created a child instance and mounted it. the child
  54683. // component also has set the placeholder vnode's elm.
  54684. // in that case we can just return the element and be done.
  54685. if (isDef(vnode.componentInstance)) {
  54686. initComponent(vnode, insertedVnodeQueue);
  54687. insert(parentElm, vnode.elm, refElm);
  54688. if (isTrue(isReactivated)) {
  54689. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54690. }
  54691. return true
  54692. }
  54693. }
  54694. }
  54695. function initComponent (vnode, insertedVnodeQueue) {
  54696. if (isDef(vnode.data.pendingInsert)) {
  54697. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54698. vnode.data.pendingInsert = null;
  54699. }
  54700. vnode.elm = vnode.componentInstance.$el;
  54701. if (isPatchable(vnode)) {
  54702. invokeCreateHooks(vnode, insertedVnodeQueue);
  54703. setScope(vnode);
  54704. } else {
  54705. // empty component root.
  54706. // skip all element-related modules except for ref (#3455)
  54707. registerRef(vnode);
  54708. // make sure to invoke the insert hook
  54709. insertedVnodeQueue.push(vnode);
  54710. }
  54711. }
  54712. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54713. var i;
  54714. // hack for #4339: a reactivated component with inner transition
  54715. // does not trigger because the inner node's created hooks are not called
  54716. // again. It's not ideal to involve module-specific logic in here but
  54717. // there doesn't seem to be a better way to do it.
  54718. var innerNode = vnode;
  54719. while (innerNode.componentInstance) {
  54720. innerNode = innerNode.componentInstance._vnode;
  54721. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54722. for (i = 0; i < cbs.activate.length; ++i) {
  54723. cbs.activate[i](emptyNode, innerNode);
  54724. }
  54725. insertedVnodeQueue.push(innerNode);
  54726. break
  54727. }
  54728. }
  54729. // unlike a newly created component,
  54730. // a reactivated keep-alive component doesn't insert itself
  54731. insert(parentElm, vnode.elm, refElm);
  54732. }
  54733. function insert (parent, elm, ref$$1) {
  54734. if (isDef(parent)) {
  54735. if (isDef(ref$$1)) {
  54736. if (nodeOps.parentNode(ref$$1) === parent) {
  54737. nodeOps.insertBefore(parent, elm, ref$$1);
  54738. }
  54739. } else {
  54740. nodeOps.appendChild(parent, elm);
  54741. }
  54742. }
  54743. }
  54744. function createChildren (vnode, children, insertedVnodeQueue) {
  54745. if (Array.isArray(children)) {
  54746. {
  54747. checkDuplicateKeys(children);
  54748. }
  54749. for (var i = 0; i < children.length; ++i) {
  54750. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54751. }
  54752. } else if (isPrimitive(vnode.text)) {
  54753. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54754. }
  54755. }
  54756. function isPatchable (vnode) {
  54757. while (vnode.componentInstance) {
  54758. vnode = vnode.componentInstance._vnode;
  54759. }
  54760. return isDef(vnode.tag)
  54761. }
  54762. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54763. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54764. cbs.create[i$1](emptyNode, vnode);
  54765. }
  54766. i = vnode.data.hook; // Reuse variable
  54767. if (isDef(i)) {
  54768. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54769. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54770. }
  54771. }
  54772. // set scope id attribute for scoped CSS.
  54773. // this is implemented as a special case to avoid the overhead
  54774. // of going through the normal attribute patching process.
  54775. function setScope (vnode) {
  54776. var i;
  54777. if (isDef(i = vnode.fnScopeId)) {
  54778. nodeOps.setStyleScope(vnode.elm, i);
  54779. } else {
  54780. var ancestor = vnode;
  54781. while (ancestor) {
  54782. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54783. nodeOps.setStyleScope(vnode.elm, i);
  54784. }
  54785. ancestor = ancestor.parent;
  54786. }
  54787. }
  54788. // for slot content they should also get the scopeId from the host instance.
  54789. if (isDef(i = activeInstance) &&
  54790. i !== vnode.context &&
  54791. i !== vnode.fnContext &&
  54792. isDef(i = i.$options._scopeId)
  54793. ) {
  54794. nodeOps.setStyleScope(vnode.elm, i);
  54795. }
  54796. }
  54797. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54798. for (; startIdx <= endIdx; ++startIdx) {
  54799. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54800. }
  54801. }
  54802. function invokeDestroyHook (vnode) {
  54803. var i, j;
  54804. var data = vnode.data;
  54805. if (isDef(data)) {
  54806. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54807. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54808. }
  54809. if (isDef(i = vnode.children)) {
  54810. for (j = 0; j < vnode.children.length; ++j) {
  54811. invokeDestroyHook(vnode.children[j]);
  54812. }
  54813. }
  54814. }
  54815. function removeVnodes (vnodes, startIdx, endIdx) {
  54816. for (; startIdx <= endIdx; ++startIdx) {
  54817. var ch = vnodes[startIdx];
  54818. if (isDef(ch)) {
  54819. if (isDef(ch.tag)) {
  54820. removeAndInvokeRemoveHook(ch);
  54821. invokeDestroyHook(ch);
  54822. } else { // Text node
  54823. removeNode(ch.elm);
  54824. }
  54825. }
  54826. }
  54827. }
  54828. function removeAndInvokeRemoveHook (vnode, rm) {
  54829. if (isDef(rm) || isDef(vnode.data)) {
  54830. var i;
  54831. var listeners = cbs.remove.length + 1;
  54832. if (isDef(rm)) {
  54833. // we have a recursively passed down rm callback
  54834. // increase the listeners count
  54835. rm.listeners += listeners;
  54836. } else {
  54837. // directly removing
  54838. rm = createRmCb(vnode.elm, listeners);
  54839. }
  54840. // recursively invoke hooks on child component root node
  54841. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54842. removeAndInvokeRemoveHook(i, rm);
  54843. }
  54844. for (i = 0; i < cbs.remove.length; ++i) {
  54845. cbs.remove[i](vnode, rm);
  54846. }
  54847. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54848. i(vnode, rm);
  54849. } else {
  54850. rm();
  54851. }
  54852. } else {
  54853. removeNode(vnode.elm);
  54854. }
  54855. }
  54856. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54857. var oldStartIdx = 0;
  54858. var newStartIdx = 0;
  54859. var oldEndIdx = oldCh.length - 1;
  54860. var oldStartVnode = oldCh[0];
  54861. var oldEndVnode = oldCh[oldEndIdx];
  54862. var newEndIdx = newCh.length - 1;
  54863. var newStartVnode = newCh[0];
  54864. var newEndVnode = newCh[newEndIdx];
  54865. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54866. // removeOnly is a special flag used only by <transition-group>
  54867. // to ensure removed elements stay in correct relative positions
  54868. // during leaving transitions
  54869. var canMove = !removeOnly;
  54870. {
  54871. checkDuplicateKeys(newCh);
  54872. }
  54873. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54874. if (isUndef(oldStartVnode)) {
  54875. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54876. } else if (isUndef(oldEndVnode)) {
  54877. oldEndVnode = oldCh[--oldEndIdx];
  54878. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54879. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54880. oldStartVnode = oldCh[++oldStartIdx];
  54881. newStartVnode = newCh[++newStartIdx];
  54882. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54883. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54884. oldEndVnode = oldCh[--oldEndIdx];
  54885. newEndVnode = newCh[--newEndIdx];
  54886. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54887. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54888. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54889. oldStartVnode = oldCh[++oldStartIdx];
  54890. newEndVnode = newCh[--newEndIdx];
  54891. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54892. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54893. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54894. oldEndVnode = oldCh[--oldEndIdx];
  54895. newStartVnode = newCh[++newStartIdx];
  54896. } else {
  54897. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54898. idxInOld = isDef(newStartVnode.key)
  54899. ? oldKeyToIdx[newStartVnode.key]
  54900. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54901. if (isUndef(idxInOld)) { // New element
  54902. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54903. } else {
  54904. vnodeToMove = oldCh[idxInOld];
  54905. if (sameVnode(vnodeToMove, newStartVnode)) {
  54906. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54907. oldCh[idxInOld] = undefined;
  54908. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54909. } else {
  54910. // same key but different element. treat as new element
  54911. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54912. }
  54913. }
  54914. newStartVnode = newCh[++newStartIdx];
  54915. }
  54916. }
  54917. if (oldStartIdx > oldEndIdx) {
  54918. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54919. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54920. } else if (newStartIdx > newEndIdx) {
  54921. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54922. }
  54923. }
  54924. function checkDuplicateKeys (children) {
  54925. var seenKeys = {};
  54926. for (var i = 0; i < children.length; i++) {
  54927. var vnode = children[i];
  54928. var key = vnode.key;
  54929. if (isDef(key)) {
  54930. if (seenKeys[key]) {
  54931. warn(
  54932. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54933. vnode.context
  54934. );
  54935. } else {
  54936. seenKeys[key] = true;
  54937. }
  54938. }
  54939. }
  54940. }
  54941. function findIdxInOld (node, oldCh, start, end) {
  54942. for (var i = start; i < end; i++) {
  54943. var c = oldCh[i];
  54944. if (isDef(c) && sameVnode(node, c)) { return i }
  54945. }
  54946. }
  54947. function patchVnode (
  54948. oldVnode,
  54949. vnode,
  54950. insertedVnodeQueue,
  54951. ownerArray,
  54952. index,
  54953. removeOnly
  54954. ) {
  54955. if (oldVnode === vnode) {
  54956. return
  54957. }
  54958. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54959. // clone reused vnode
  54960. vnode = ownerArray[index] = cloneVNode(vnode);
  54961. }
  54962. var elm = vnode.elm = oldVnode.elm;
  54963. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54964. if (isDef(vnode.asyncFactory.resolved)) {
  54965. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54966. } else {
  54967. vnode.isAsyncPlaceholder = true;
  54968. }
  54969. return
  54970. }
  54971. // reuse element for static trees.
  54972. // note we only do this if the vnode is cloned -
  54973. // if the new node is not cloned it means the render functions have been
  54974. // reset by the hot-reload-api and we need to do a proper re-render.
  54975. if (isTrue(vnode.isStatic) &&
  54976. isTrue(oldVnode.isStatic) &&
  54977. vnode.key === oldVnode.key &&
  54978. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54979. ) {
  54980. vnode.componentInstance = oldVnode.componentInstance;
  54981. return
  54982. }
  54983. var i;
  54984. var data = vnode.data;
  54985. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  54986. i(oldVnode, vnode);
  54987. }
  54988. var oldCh = oldVnode.children;
  54989. var ch = vnode.children;
  54990. if (isDef(data) && isPatchable(vnode)) {
  54991. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  54992. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  54993. }
  54994. if (isUndef(vnode.text)) {
  54995. if (isDef(oldCh) && isDef(ch)) {
  54996. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  54997. } else if (isDef(ch)) {
  54998. {
  54999. checkDuplicateKeys(ch);
  55000. }
  55001. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  55002. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  55003. } else if (isDef(oldCh)) {
  55004. removeVnodes(oldCh, 0, oldCh.length - 1);
  55005. } else if (isDef(oldVnode.text)) {
  55006. nodeOps.setTextContent(elm, '');
  55007. }
  55008. } else if (oldVnode.text !== vnode.text) {
  55009. nodeOps.setTextContent(elm, vnode.text);
  55010. }
  55011. if (isDef(data)) {
  55012. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  55013. }
  55014. }
  55015. function invokeInsertHook (vnode, queue, initial) {
  55016. // delay insert hooks for component root nodes, invoke them after the
  55017. // element is really inserted
  55018. if (isTrue(initial) && isDef(vnode.parent)) {
  55019. vnode.parent.data.pendingInsert = queue;
  55020. } else {
  55021. for (var i = 0; i < queue.length; ++i) {
  55022. queue[i].data.hook.insert(queue[i]);
  55023. }
  55024. }
  55025. }
  55026. var hydrationBailed = false;
  55027. // list of modules that can skip create hook during hydration because they
  55028. // are already rendered on the client or has no need for initialization
  55029. // Note: style is excluded because it relies on initial clone for future
  55030. // deep updates (#7063).
  55031. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55032. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55033. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55034. var i;
  55035. var tag = vnode.tag;
  55036. var data = vnode.data;
  55037. var children = vnode.children;
  55038. inVPre = inVPre || (data && data.pre);
  55039. vnode.elm = elm;
  55040. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55041. vnode.isAsyncPlaceholder = true;
  55042. return true
  55043. }
  55044. // assert node match
  55045. {
  55046. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55047. return false
  55048. }
  55049. }
  55050. if (isDef(data)) {
  55051. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55052. if (isDef(i = vnode.componentInstance)) {
  55053. // child component. it should have hydrated its own tree.
  55054. initComponent(vnode, insertedVnodeQueue);
  55055. return true
  55056. }
  55057. }
  55058. if (isDef(tag)) {
  55059. if (isDef(children)) {
  55060. // empty element, allow client to pick up and populate children
  55061. if (!elm.hasChildNodes()) {
  55062. createChildren(vnode, children, insertedVnodeQueue);
  55063. } else {
  55064. // v-html and domProps: innerHTML
  55065. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55066. if (i !== elm.innerHTML) {
  55067. /* istanbul ignore if */
  55068. if (typeof console !== 'undefined' &&
  55069. !hydrationBailed
  55070. ) {
  55071. hydrationBailed = true;
  55072. console.warn('Parent: ', elm);
  55073. console.warn('server innerHTML: ', i);
  55074. console.warn('client innerHTML: ', elm.innerHTML);
  55075. }
  55076. return false
  55077. }
  55078. } else {
  55079. // iterate and compare children lists
  55080. var childrenMatch = true;
  55081. var childNode = elm.firstChild;
  55082. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55083. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55084. childrenMatch = false;
  55085. break
  55086. }
  55087. childNode = childNode.nextSibling;
  55088. }
  55089. // if childNode is not null, it means the actual childNodes list is
  55090. // longer than the virtual children list.
  55091. if (!childrenMatch || childNode) {
  55092. /* istanbul ignore if */
  55093. if (typeof console !== 'undefined' &&
  55094. !hydrationBailed
  55095. ) {
  55096. hydrationBailed = true;
  55097. console.warn('Parent: ', elm);
  55098. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55099. }
  55100. return false
  55101. }
  55102. }
  55103. }
  55104. }
  55105. if (isDef(data)) {
  55106. var fullInvoke = false;
  55107. for (var key in data) {
  55108. if (!isRenderedModule(key)) {
  55109. fullInvoke = true;
  55110. invokeCreateHooks(vnode, insertedVnodeQueue);
  55111. break
  55112. }
  55113. }
  55114. if (!fullInvoke && data['class']) {
  55115. // ensure collecting deps for deep class bindings for future updates
  55116. traverse(data['class']);
  55117. }
  55118. }
  55119. } else if (elm.data !== vnode.text) {
  55120. elm.data = vnode.text;
  55121. }
  55122. return true
  55123. }
  55124. function assertNodeMatch (node, vnode, inVPre) {
  55125. if (isDef(vnode.tag)) {
  55126. return vnode.tag.indexOf('vue-component') === 0 || (
  55127. !isUnknownElement$$1(vnode, inVPre) &&
  55128. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55129. )
  55130. } else {
  55131. return node.nodeType === (vnode.isComment ? 8 : 3)
  55132. }
  55133. }
  55134. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55135. if (isUndef(vnode)) {
  55136. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55137. return
  55138. }
  55139. var isInitialPatch = false;
  55140. var insertedVnodeQueue = [];
  55141. if (isUndef(oldVnode)) {
  55142. // empty mount (likely as component), create new root element
  55143. isInitialPatch = true;
  55144. createElm(vnode, insertedVnodeQueue);
  55145. } else {
  55146. var isRealElement = isDef(oldVnode.nodeType);
  55147. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55148. // patch existing root node
  55149. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55150. } else {
  55151. if (isRealElement) {
  55152. // mounting to a real element
  55153. // check if this is server-rendered content and if we can perform
  55154. // a successful hydration.
  55155. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55156. oldVnode.removeAttribute(SSR_ATTR);
  55157. hydrating = true;
  55158. }
  55159. if (isTrue(hydrating)) {
  55160. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55161. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55162. return oldVnode
  55163. } else {
  55164. warn(
  55165. 'The client-side rendered virtual DOM tree is not matching ' +
  55166. 'server-rendered content. This is likely caused by incorrect ' +
  55167. 'HTML markup, for example nesting block-level elements inside ' +
  55168. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55169. 'full client-side render.'
  55170. );
  55171. }
  55172. }
  55173. // either not server-rendered, or hydration failed.
  55174. // create an empty node and replace it
  55175. oldVnode = emptyNodeAt(oldVnode);
  55176. }
  55177. // replacing existing element
  55178. var oldElm = oldVnode.elm;
  55179. var parentElm = nodeOps.parentNode(oldElm);
  55180. // create new node
  55181. createElm(
  55182. vnode,
  55183. insertedVnodeQueue,
  55184. // extremely rare edge case: do not insert if old element is in a
  55185. // leaving transition. Only happens when combining transition +
  55186. // keep-alive + HOCs. (#4590)
  55187. oldElm._leaveCb ? null : parentElm,
  55188. nodeOps.nextSibling(oldElm)
  55189. );
  55190. // update parent placeholder node element, recursively
  55191. if (isDef(vnode.parent)) {
  55192. var ancestor = vnode.parent;
  55193. var patchable = isPatchable(vnode);
  55194. while (ancestor) {
  55195. for (var i = 0; i < cbs.destroy.length; ++i) {
  55196. cbs.destroy[i](ancestor);
  55197. }
  55198. ancestor.elm = vnode.elm;
  55199. if (patchable) {
  55200. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55201. cbs.create[i$1](emptyNode, ancestor);
  55202. }
  55203. // #6513
  55204. // invoke insert hooks that may have been merged by create hooks.
  55205. // e.g. for directives that uses the "inserted" hook.
  55206. var insert = ancestor.data.hook.insert;
  55207. if (insert.merged) {
  55208. // start at index 1 to avoid re-invoking component mounted hook
  55209. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55210. insert.fns[i$2]();
  55211. }
  55212. }
  55213. } else {
  55214. registerRef(ancestor);
  55215. }
  55216. ancestor = ancestor.parent;
  55217. }
  55218. }
  55219. // destroy old node
  55220. if (isDef(parentElm)) {
  55221. removeVnodes([oldVnode], 0, 0);
  55222. } else if (isDef(oldVnode.tag)) {
  55223. invokeDestroyHook(oldVnode);
  55224. }
  55225. }
  55226. }
  55227. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55228. return vnode.elm
  55229. }
  55230. }
  55231. /* */
  55232. var directives = {
  55233. create: updateDirectives,
  55234. update: updateDirectives,
  55235. destroy: function unbindDirectives (vnode) {
  55236. updateDirectives(vnode, emptyNode);
  55237. }
  55238. };
  55239. function updateDirectives (oldVnode, vnode) {
  55240. if (oldVnode.data.directives || vnode.data.directives) {
  55241. _update(oldVnode, vnode);
  55242. }
  55243. }
  55244. function _update (oldVnode, vnode) {
  55245. var isCreate = oldVnode === emptyNode;
  55246. var isDestroy = vnode === emptyNode;
  55247. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55248. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55249. var dirsWithInsert = [];
  55250. var dirsWithPostpatch = [];
  55251. var key, oldDir, dir;
  55252. for (key in newDirs) {
  55253. oldDir = oldDirs[key];
  55254. dir = newDirs[key];
  55255. if (!oldDir) {
  55256. // new directive, bind
  55257. callHook$1(dir, 'bind', vnode, oldVnode);
  55258. if (dir.def && dir.def.inserted) {
  55259. dirsWithInsert.push(dir);
  55260. }
  55261. } else {
  55262. // existing directive, update
  55263. dir.oldValue = oldDir.value;
  55264. dir.oldArg = oldDir.arg;
  55265. callHook$1(dir, 'update', vnode, oldVnode);
  55266. if (dir.def && dir.def.componentUpdated) {
  55267. dirsWithPostpatch.push(dir);
  55268. }
  55269. }
  55270. }
  55271. if (dirsWithInsert.length) {
  55272. var callInsert = function () {
  55273. for (var i = 0; i < dirsWithInsert.length; i++) {
  55274. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55275. }
  55276. };
  55277. if (isCreate) {
  55278. mergeVNodeHook(vnode, 'insert', callInsert);
  55279. } else {
  55280. callInsert();
  55281. }
  55282. }
  55283. if (dirsWithPostpatch.length) {
  55284. mergeVNodeHook(vnode, 'postpatch', function () {
  55285. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55286. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55287. }
  55288. });
  55289. }
  55290. if (!isCreate) {
  55291. for (key in oldDirs) {
  55292. if (!newDirs[key]) {
  55293. // no longer present, unbind
  55294. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55295. }
  55296. }
  55297. }
  55298. }
  55299. var emptyModifiers = Object.create(null);
  55300. function normalizeDirectives$1 (
  55301. dirs,
  55302. vm
  55303. ) {
  55304. var res = Object.create(null);
  55305. if (!dirs) {
  55306. // $flow-disable-line
  55307. return res
  55308. }
  55309. var i, dir;
  55310. for (i = 0; i < dirs.length; i++) {
  55311. dir = dirs[i];
  55312. if (!dir.modifiers) {
  55313. // $flow-disable-line
  55314. dir.modifiers = emptyModifiers;
  55315. }
  55316. res[getRawDirName(dir)] = dir;
  55317. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55318. }
  55319. // $flow-disable-line
  55320. return res
  55321. }
  55322. function getRawDirName (dir) {
  55323. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55324. }
  55325. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55326. var fn = dir.def && dir.def[hook];
  55327. if (fn) {
  55328. try {
  55329. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55330. } catch (e) {
  55331. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55332. }
  55333. }
  55334. }
  55335. var baseModules = [
  55336. ref,
  55337. directives
  55338. ];
  55339. /* */
  55340. function updateAttrs (oldVnode, vnode) {
  55341. var opts = vnode.componentOptions;
  55342. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55343. return
  55344. }
  55345. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55346. return
  55347. }
  55348. var key, cur, old;
  55349. var elm = vnode.elm;
  55350. var oldAttrs = oldVnode.data.attrs || {};
  55351. var attrs = vnode.data.attrs || {};
  55352. // clone observed objects, as the user probably wants to mutate it
  55353. if (isDef(attrs.__ob__)) {
  55354. attrs = vnode.data.attrs = extend({}, attrs);
  55355. }
  55356. for (key in attrs) {
  55357. cur = attrs[key];
  55358. old = oldAttrs[key];
  55359. if (old !== cur) {
  55360. setAttr(elm, key, cur);
  55361. }
  55362. }
  55363. // #4391: in IE9, setting type can reset value for input[type=radio]
  55364. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55365. /* istanbul ignore if */
  55366. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55367. setAttr(elm, 'value', attrs.value);
  55368. }
  55369. for (key in oldAttrs) {
  55370. if (isUndef(attrs[key])) {
  55371. if (isXlink(key)) {
  55372. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55373. } else if (!isEnumeratedAttr(key)) {
  55374. elm.removeAttribute(key);
  55375. }
  55376. }
  55377. }
  55378. }
  55379. function setAttr (el, key, value) {
  55380. if (el.tagName.indexOf('-') > -1) {
  55381. baseSetAttr(el, key, value);
  55382. } else if (isBooleanAttr(key)) {
  55383. // set attribute for blank value
  55384. // e.g. <option disabled>Select one</option>
  55385. if (isFalsyAttrValue(value)) {
  55386. el.removeAttribute(key);
  55387. } else {
  55388. // technically allowfullscreen is a boolean attribute for <iframe>,
  55389. // but Flash expects a value of "true" when used on <embed> tag
  55390. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55391. ? 'true'
  55392. : key;
  55393. el.setAttribute(key, value);
  55394. }
  55395. } else if (isEnumeratedAttr(key)) {
  55396. el.setAttribute(key, convertEnumeratedValue(key, value));
  55397. } else if (isXlink(key)) {
  55398. if (isFalsyAttrValue(value)) {
  55399. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55400. } else {
  55401. el.setAttributeNS(xlinkNS, key, value);
  55402. }
  55403. } else {
  55404. baseSetAttr(el, key, value);
  55405. }
  55406. }
  55407. function baseSetAttr (el, key, value) {
  55408. if (isFalsyAttrValue(value)) {
  55409. el.removeAttribute(key);
  55410. } else {
  55411. // #7138: IE10 & 11 fires input event when setting placeholder on
  55412. // <textarea>... block the first input event and remove the blocker
  55413. // immediately.
  55414. /* istanbul ignore if */
  55415. if (
  55416. isIE && !isIE9 &&
  55417. el.tagName === 'TEXTAREA' &&
  55418. key === 'placeholder' && value !== '' && !el.__ieph
  55419. ) {
  55420. var blocker = function (e) {
  55421. e.stopImmediatePropagation();
  55422. el.removeEventListener('input', blocker);
  55423. };
  55424. el.addEventListener('input', blocker);
  55425. // $flow-disable-line
  55426. el.__ieph = true; /* IE placeholder patched */
  55427. }
  55428. el.setAttribute(key, value);
  55429. }
  55430. }
  55431. var attrs = {
  55432. create: updateAttrs,
  55433. update: updateAttrs
  55434. };
  55435. /* */
  55436. function updateClass (oldVnode, vnode) {
  55437. var el = vnode.elm;
  55438. var data = vnode.data;
  55439. var oldData = oldVnode.data;
  55440. if (
  55441. isUndef(data.staticClass) &&
  55442. isUndef(data.class) && (
  55443. isUndef(oldData) || (
  55444. isUndef(oldData.staticClass) &&
  55445. isUndef(oldData.class)
  55446. )
  55447. )
  55448. ) {
  55449. return
  55450. }
  55451. var cls = genClassForVnode(vnode);
  55452. // handle transition classes
  55453. var transitionClass = el._transitionClasses;
  55454. if (isDef(transitionClass)) {
  55455. cls = concat(cls, stringifyClass(transitionClass));
  55456. }
  55457. // set the class
  55458. if (cls !== el._prevClass) {
  55459. el.setAttribute('class', cls);
  55460. el._prevClass = cls;
  55461. }
  55462. }
  55463. var klass = {
  55464. create: updateClass,
  55465. update: updateClass
  55466. };
  55467. /* */
  55468. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55469. function parseFilters (exp) {
  55470. var inSingle = false;
  55471. var inDouble = false;
  55472. var inTemplateString = false;
  55473. var inRegex = false;
  55474. var curly = 0;
  55475. var square = 0;
  55476. var paren = 0;
  55477. var lastFilterIndex = 0;
  55478. var c, prev, i, expression, filters;
  55479. for (i = 0; i < exp.length; i++) {
  55480. prev = c;
  55481. c = exp.charCodeAt(i);
  55482. if (inSingle) {
  55483. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55484. } else if (inDouble) {
  55485. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55486. } else if (inTemplateString) {
  55487. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55488. } else if (inRegex) {
  55489. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55490. } else if (
  55491. c === 0x7C && // pipe
  55492. exp.charCodeAt(i + 1) !== 0x7C &&
  55493. exp.charCodeAt(i - 1) !== 0x7C &&
  55494. !curly && !square && !paren
  55495. ) {
  55496. if (expression === undefined) {
  55497. // first filter, end of expression
  55498. lastFilterIndex = i + 1;
  55499. expression = exp.slice(0, i).trim();
  55500. } else {
  55501. pushFilter();
  55502. }
  55503. } else {
  55504. switch (c) {
  55505. case 0x22: inDouble = true; break // "
  55506. case 0x27: inSingle = true; break // '
  55507. case 0x60: inTemplateString = true; break // `
  55508. case 0x28: paren++; break // (
  55509. case 0x29: paren--; break // )
  55510. case 0x5B: square++; break // [
  55511. case 0x5D: square--; break // ]
  55512. case 0x7B: curly++; break // {
  55513. case 0x7D: curly--; break // }
  55514. }
  55515. if (c === 0x2f) { // /
  55516. var j = i - 1;
  55517. var p = (void 0);
  55518. // find first non-whitespace prev char
  55519. for (; j >= 0; j--) {
  55520. p = exp.charAt(j);
  55521. if (p !== ' ') { break }
  55522. }
  55523. if (!p || !validDivisionCharRE.test(p)) {
  55524. inRegex = true;
  55525. }
  55526. }
  55527. }
  55528. }
  55529. if (expression === undefined) {
  55530. expression = exp.slice(0, i).trim();
  55531. } else if (lastFilterIndex !== 0) {
  55532. pushFilter();
  55533. }
  55534. function pushFilter () {
  55535. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55536. lastFilterIndex = i + 1;
  55537. }
  55538. if (filters) {
  55539. for (i = 0; i < filters.length; i++) {
  55540. expression = wrapFilter(expression, filters[i]);
  55541. }
  55542. }
  55543. return expression
  55544. }
  55545. function wrapFilter (exp, filter) {
  55546. var i = filter.indexOf('(');
  55547. if (i < 0) {
  55548. // _f: resolveFilter
  55549. return ("_f(\"" + filter + "\")(" + exp + ")")
  55550. } else {
  55551. var name = filter.slice(0, i);
  55552. var args = filter.slice(i + 1);
  55553. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55554. }
  55555. }
  55556. /* */
  55557. /* eslint-disable no-unused-vars */
  55558. function baseWarn (msg, range) {
  55559. console.error(("[Vue compiler]: " + msg));
  55560. }
  55561. /* eslint-enable no-unused-vars */
  55562. function pluckModuleFunction (
  55563. modules,
  55564. key
  55565. ) {
  55566. return modules
  55567. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55568. : []
  55569. }
  55570. function addProp (el, name, value, range, dynamic) {
  55571. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55572. el.plain = false;
  55573. }
  55574. function addAttr (el, name, value, range, dynamic) {
  55575. var attrs = dynamic
  55576. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55577. : (el.attrs || (el.attrs = []));
  55578. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55579. el.plain = false;
  55580. }
  55581. // add a raw attr (use this in preTransforms)
  55582. function addRawAttr (el, name, value, range) {
  55583. el.attrsMap[name] = value;
  55584. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55585. }
  55586. function addDirective (
  55587. el,
  55588. name,
  55589. rawName,
  55590. value,
  55591. arg,
  55592. isDynamicArg,
  55593. modifiers,
  55594. range
  55595. ) {
  55596. (el.directives || (el.directives = [])).push(rangeSetItem({
  55597. name: name,
  55598. rawName: rawName,
  55599. value: value,
  55600. arg: arg,
  55601. isDynamicArg: isDynamicArg,
  55602. modifiers: modifiers
  55603. }, range));
  55604. el.plain = false;
  55605. }
  55606. function prependModifierMarker (symbol, name, dynamic) {
  55607. return dynamic
  55608. ? ("_p(" + name + ",\"" + symbol + "\")")
  55609. : symbol + name // mark the event as captured
  55610. }
  55611. function addHandler (
  55612. el,
  55613. name,
  55614. value,
  55615. modifiers,
  55616. important,
  55617. warn,
  55618. range,
  55619. dynamic
  55620. ) {
  55621. modifiers = modifiers || emptyObject;
  55622. // warn prevent and passive modifier
  55623. /* istanbul ignore if */
  55624. if (
  55625. warn &&
  55626. modifiers.prevent && modifiers.passive
  55627. ) {
  55628. warn(
  55629. 'passive and prevent can\'t be used together. ' +
  55630. 'Passive handler can\'t prevent default event.',
  55631. range
  55632. );
  55633. }
  55634. // normalize click.right and click.middle since they don't actually fire
  55635. // this is technically browser-specific, but at least for now browsers are
  55636. // the only target envs that have right/middle clicks.
  55637. if (modifiers.right) {
  55638. if (dynamic) {
  55639. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55640. } else if (name === 'click') {
  55641. name = 'contextmenu';
  55642. delete modifiers.right;
  55643. }
  55644. } else if (modifiers.middle) {
  55645. if (dynamic) {
  55646. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55647. } else if (name === 'click') {
  55648. name = 'mouseup';
  55649. }
  55650. }
  55651. // check capture modifier
  55652. if (modifiers.capture) {
  55653. delete modifiers.capture;
  55654. name = prependModifierMarker('!', name, dynamic);
  55655. }
  55656. if (modifiers.once) {
  55657. delete modifiers.once;
  55658. name = prependModifierMarker('~', name, dynamic);
  55659. }
  55660. /* istanbul ignore if */
  55661. if (modifiers.passive) {
  55662. delete modifiers.passive;
  55663. name = prependModifierMarker('&', name, dynamic);
  55664. }
  55665. var events;
  55666. if (modifiers.native) {
  55667. delete modifiers.native;
  55668. events = el.nativeEvents || (el.nativeEvents = {});
  55669. } else {
  55670. events = el.events || (el.events = {});
  55671. }
  55672. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55673. if (modifiers !== emptyObject) {
  55674. newHandler.modifiers = modifiers;
  55675. }
  55676. var handlers = events[name];
  55677. /* istanbul ignore if */
  55678. if (Array.isArray(handlers)) {
  55679. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55680. } else if (handlers) {
  55681. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55682. } else {
  55683. events[name] = newHandler;
  55684. }
  55685. el.plain = false;
  55686. }
  55687. function getRawBindingAttr (
  55688. el,
  55689. name
  55690. ) {
  55691. return el.rawAttrsMap[':' + name] ||
  55692. el.rawAttrsMap['v-bind:' + name] ||
  55693. el.rawAttrsMap[name]
  55694. }
  55695. function getBindingAttr (
  55696. el,
  55697. name,
  55698. getStatic
  55699. ) {
  55700. var dynamicValue =
  55701. getAndRemoveAttr(el, ':' + name) ||
  55702. getAndRemoveAttr(el, 'v-bind:' + name);
  55703. if (dynamicValue != null) {
  55704. return parseFilters(dynamicValue)
  55705. } else if (getStatic !== false) {
  55706. var staticValue = getAndRemoveAttr(el, name);
  55707. if (staticValue != null) {
  55708. return JSON.stringify(staticValue)
  55709. }
  55710. }
  55711. }
  55712. // note: this only removes the attr from the Array (attrsList) so that it
  55713. // doesn't get processed by processAttrs.
  55714. // By default it does NOT remove it from the map (attrsMap) because the map is
  55715. // needed during codegen.
  55716. function getAndRemoveAttr (
  55717. el,
  55718. name,
  55719. removeFromMap
  55720. ) {
  55721. var val;
  55722. if ((val = el.attrsMap[name]) != null) {
  55723. var list = el.attrsList;
  55724. for (var i = 0, l = list.length; i < l; i++) {
  55725. if (list[i].name === name) {
  55726. list.splice(i, 1);
  55727. break
  55728. }
  55729. }
  55730. }
  55731. if (removeFromMap) {
  55732. delete el.attrsMap[name];
  55733. }
  55734. return val
  55735. }
  55736. function getAndRemoveAttrByRegex (
  55737. el,
  55738. name
  55739. ) {
  55740. var list = el.attrsList;
  55741. for (var i = 0, l = list.length; i < l; i++) {
  55742. var attr = list[i];
  55743. if (name.test(attr.name)) {
  55744. list.splice(i, 1);
  55745. return attr
  55746. }
  55747. }
  55748. }
  55749. function rangeSetItem (
  55750. item,
  55751. range
  55752. ) {
  55753. if (range) {
  55754. if (range.start != null) {
  55755. item.start = range.start;
  55756. }
  55757. if (range.end != null) {
  55758. item.end = range.end;
  55759. }
  55760. }
  55761. return item
  55762. }
  55763. /* */
  55764. /**
  55765. * Cross-platform code generation for component v-model
  55766. */
  55767. function genComponentModel (
  55768. el,
  55769. value,
  55770. modifiers
  55771. ) {
  55772. var ref = modifiers || {};
  55773. var number = ref.number;
  55774. var trim = ref.trim;
  55775. var baseValueExpression = '$$v';
  55776. var valueExpression = baseValueExpression;
  55777. if (trim) {
  55778. valueExpression =
  55779. "(typeof " + baseValueExpression + " === 'string'" +
  55780. "? " + baseValueExpression + ".trim()" +
  55781. ": " + baseValueExpression + ")";
  55782. }
  55783. if (number) {
  55784. valueExpression = "_n(" + valueExpression + ")";
  55785. }
  55786. var assignment = genAssignmentCode(value, valueExpression);
  55787. el.model = {
  55788. value: ("(" + value + ")"),
  55789. expression: JSON.stringify(value),
  55790. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55791. };
  55792. }
  55793. /**
  55794. * Cross-platform codegen helper for generating v-model value assignment code.
  55795. */
  55796. function genAssignmentCode (
  55797. value,
  55798. assignment
  55799. ) {
  55800. var res = parseModel(value);
  55801. if (res.key === null) {
  55802. return (value + "=" + assignment)
  55803. } else {
  55804. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55805. }
  55806. }
  55807. /**
  55808. * Parse a v-model expression into a base path and a final key segment.
  55809. * Handles both dot-path and possible square brackets.
  55810. *
  55811. * Possible cases:
  55812. *
  55813. * - test
  55814. * - test[key]
  55815. * - test[test1[key]]
  55816. * - test["a"][key]
  55817. * - xxx.test[a[a].test1[key]]
  55818. * - test.xxx.a["asa"][test1[key]]
  55819. *
  55820. */
  55821. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55822. function parseModel (val) {
  55823. // Fix https://github.com/vuejs/vue/pull/7730
  55824. // allow v-model="obj.val " (trailing whitespace)
  55825. val = val.trim();
  55826. len = val.length;
  55827. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55828. index$1 = val.lastIndexOf('.');
  55829. if (index$1 > -1) {
  55830. return {
  55831. exp: val.slice(0, index$1),
  55832. key: '"' + val.slice(index$1 + 1) + '"'
  55833. }
  55834. } else {
  55835. return {
  55836. exp: val,
  55837. key: null
  55838. }
  55839. }
  55840. }
  55841. str = val;
  55842. index$1 = expressionPos = expressionEndPos = 0;
  55843. while (!eof()) {
  55844. chr = next();
  55845. /* istanbul ignore if */
  55846. if (isStringStart(chr)) {
  55847. parseString(chr);
  55848. } else if (chr === 0x5B) {
  55849. parseBracket(chr);
  55850. }
  55851. }
  55852. return {
  55853. exp: val.slice(0, expressionPos),
  55854. key: val.slice(expressionPos + 1, expressionEndPos)
  55855. }
  55856. }
  55857. function next () {
  55858. return str.charCodeAt(++index$1)
  55859. }
  55860. function eof () {
  55861. return index$1 >= len
  55862. }
  55863. function isStringStart (chr) {
  55864. return chr === 0x22 || chr === 0x27
  55865. }
  55866. function parseBracket (chr) {
  55867. var inBracket = 1;
  55868. expressionPos = index$1;
  55869. while (!eof()) {
  55870. chr = next();
  55871. if (isStringStart(chr)) {
  55872. parseString(chr);
  55873. continue
  55874. }
  55875. if (chr === 0x5B) { inBracket++; }
  55876. if (chr === 0x5D) { inBracket--; }
  55877. if (inBracket === 0) {
  55878. expressionEndPos = index$1;
  55879. break
  55880. }
  55881. }
  55882. }
  55883. function parseString (chr) {
  55884. var stringQuote = chr;
  55885. while (!eof()) {
  55886. chr = next();
  55887. if (chr === stringQuote) {
  55888. break
  55889. }
  55890. }
  55891. }
  55892. /* */
  55893. var warn$1;
  55894. // in some cases, the event used has to be determined at runtime
  55895. // so we used some reserved tokens during compile.
  55896. var RANGE_TOKEN = '__r';
  55897. var CHECKBOX_RADIO_TOKEN = '__c';
  55898. function model (
  55899. el,
  55900. dir,
  55901. _warn
  55902. ) {
  55903. warn$1 = _warn;
  55904. var value = dir.value;
  55905. var modifiers = dir.modifiers;
  55906. var tag = el.tag;
  55907. var type = el.attrsMap.type;
  55908. {
  55909. // inputs with type="file" are read only and setting the input's
  55910. // value will throw an error.
  55911. if (tag === 'input' && type === 'file') {
  55912. warn$1(
  55913. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55914. "File inputs are read only. Use a v-on:change listener instead.",
  55915. el.rawAttrsMap['v-model']
  55916. );
  55917. }
  55918. }
  55919. if (el.component) {
  55920. genComponentModel(el, value, modifiers);
  55921. // component v-model doesn't need extra runtime
  55922. return false
  55923. } else if (tag === 'select') {
  55924. genSelect(el, value, modifiers);
  55925. } else if (tag === 'input' && type === 'checkbox') {
  55926. genCheckboxModel(el, value, modifiers);
  55927. } else if (tag === 'input' && type === 'radio') {
  55928. genRadioModel(el, value, modifiers);
  55929. } else if (tag === 'input' || tag === 'textarea') {
  55930. genDefaultModel(el, value, modifiers);
  55931. } else if (!config.isReservedTag(tag)) {
  55932. genComponentModel(el, value, modifiers);
  55933. // component v-model doesn't need extra runtime
  55934. return false
  55935. } else {
  55936. warn$1(
  55937. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55938. "v-model is not supported on this element type. " +
  55939. 'If you are working with contenteditable, it\'s recommended to ' +
  55940. 'wrap a library dedicated for that purpose inside a custom component.',
  55941. el.rawAttrsMap['v-model']
  55942. );
  55943. }
  55944. // ensure runtime directive metadata
  55945. return true
  55946. }
  55947. function genCheckboxModel (
  55948. el,
  55949. value,
  55950. modifiers
  55951. ) {
  55952. var number = modifiers && modifiers.number;
  55953. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55954. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55955. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55956. addProp(el, 'checked',
  55957. "Array.isArray(" + value + ")" +
  55958. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55959. trueValueBinding === 'true'
  55960. ? (":(" + value + ")")
  55961. : (":_q(" + value + "," + trueValueBinding + ")")
  55962. )
  55963. );
  55964. addHandler(el, 'change',
  55965. "var $$a=" + value + "," +
  55966. '$$el=$event.target,' +
  55967. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55968. 'if(Array.isArray($$a)){' +
  55969. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55970. '$$i=_i($$a,$$v);' +
  55971. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55972. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55973. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55974. null, true
  55975. );
  55976. }
  55977. function genRadioModel (
  55978. el,
  55979. value,
  55980. modifiers
  55981. ) {
  55982. var number = modifiers && modifiers.number;
  55983. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55984. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55985. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  55986. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  55987. }
  55988. function genSelect (
  55989. el,
  55990. value,
  55991. modifiers
  55992. ) {
  55993. var number = modifiers && modifiers.number;
  55994. var selectedVal = "Array.prototype.filter" +
  55995. ".call($event.target.options,function(o){return o.selected})" +
  55996. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  55997. "return " + (number ? '_n(val)' : 'val') + "})";
  55998. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  55999. var code = "var $$selectedVal = " + selectedVal + ";";
  56000. code = code + " " + (genAssignmentCode(value, assignment));
  56001. addHandler(el, 'change', code, null, true);
  56002. }
  56003. function genDefaultModel (
  56004. el,
  56005. value,
  56006. modifiers
  56007. ) {
  56008. var type = el.attrsMap.type;
  56009. // warn if v-bind:value conflicts with v-model
  56010. // except for inputs with v-bind:type
  56011. {
  56012. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  56013. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  56014. if (value$1 && !typeBinding) {
  56015. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  56016. warn$1(
  56017. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56018. 'because the latter already expands to a value binding internally',
  56019. el.rawAttrsMap[binding]
  56020. );
  56021. }
  56022. }
  56023. var ref = modifiers || {};
  56024. var lazy = ref.lazy;
  56025. var number = ref.number;
  56026. var trim = ref.trim;
  56027. var needCompositionGuard = !lazy && type !== 'range';
  56028. var event = lazy
  56029. ? 'change'
  56030. : type === 'range'
  56031. ? RANGE_TOKEN
  56032. : 'input';
  56033. var valueExpression = '$event.target.value';
  56034. if (trim) {
  56035. valueExpression = "$event.target.value.trim()";
  56036. }
  56037. if (number) {
  56038. valueExpression = "_n(" + valueExpression + ")";
  56039. }
  56040. var code = genAssignmentCode(value, valueExpression);
  56041. if (needCompositionGuard) {
  56042. code = "if($event.target.composing)return;" + code;
  56043. }
  56044. addProp(el, 'value', ("(" + value + ")"));
  56045. addHandler(el, event, code, null, true);
  56046. if (trim || number) {
  56047. addHandler(el, 'blur', '$forceUpdate()');
  56048. }
  56049. }
  56050. /* */
  56051. // normalize v-model event tokens that can only be determined at runtime.
  56052. // it's important to place the event as the first in the array because
  56053. // the whole point is ensuring the v-model callback gets called before
  56054. // user-attached handlers.
  56055. function normalizeEvents (on) {
  56056. /* istanbul ignore if */
  56057. if (isDef(on[RANGE_TOKEN])) {
  56058. // IE input[type=range] only supports `change` event
  56059. var event = isIE ? 'change' : 'input';
  56060. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56061. delete on[RANGE_TOKEN];
  56062. }
  56063. // This was originally intended to fix #4521 but no longer necessary
  56064. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56065. /* istanbul ignore if */
  56066. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56067. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56068. delete on[CHECKBOX_RADIO_TOKEN];
  56069. }
  56070. }
  56071. var target$1;
  56072. function createOnceHandler$1 (event, handler, capture) {
  56073. var _target = target$1; // save current target element in closure
  56074. return function onceHandler () {
  56075. var res = handler.apply(null, arguments);
  56076. if (res !== null) {
  56077. remove$2(event, onceHandler, capture, _target);
  56078. }
  56079. }
  56080. }
  56081. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56082. // implementation and does not fire microtasks in between event propagation, so
  56083. // safe to exclude.
  56084. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56085. function add$1 (
  56086. name,
  56087. handler,
  56088. capture,
  56089. passive
  56090. ) {
  56091. // async edge case #6566: inner click event triggers patch, event handler
  56092. // attached to outer element during patch, and triggered again. This
  56093. // happens because browsers fire microtask ticks between event propagation.
  56094. // the solution is simple: we save the timestamp when a handler is attached,
  56095. // and the handler would only fire if the event passed to it was fired
  56096. // AFTER it was attached.
  56097. if (useMicrotaskFix) {
  56098. var attachedTimestamp = currentFlushTimestamp;
  56099. var original = handler;
  56100. handler = original._wrapper = function (e) {
  56101. if (
  56102. // no bubbling, should always fire.
  56103. // this is just a safety net in case event.timeStamp is unreliable in
  56104. // certain weird environments...
  56105. e.target === e.currentTarget ||
  56106. // event is fired after handler attachment
  56107. e.timeStamp >= attachedTimestamp ||
  56108. // bail for environments that have buggy event.timeStamp implementations
  56109. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56110. // #9681 QtWebEngine event.timeStamp is negative value
  56111. e.timeStamp <= 0 ||
  56112. // #9448 bail if event is fired in another document in a multi-page
  56113. // electron/nw.js app, since event.timeStamp will be using a different
  56114. // starting reference
  56115. e.target.ownerDocument !== document
  56116. ) {
  56117. return original.apply(this, arguments)
  56118. }
  56119. };
  56120. }
  56121. target$1.addEventListener(
  56122. name,
  56123. handler,
  56124. supportsPassive
  56125. ? { capture: capture, passive: passive }
  56126. : capture
  56127. );
  56128. }
  56129. function remove$2 (
  56130. name,
  56131. handler,
  56132. capture,
  56133. _target
  56134. ) {
  56135. (_target || target$1).removeEventListener(
  56136. name,
  56137. handler._wrapper || handler,
  56138. capture
  56139. );
  56140. }
  56141. function updateDOMListeners (oldVnode, vnode) {
  56142. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56143. return
  56144. }
  56145. var on = vnode.data.on || {};
  56146. var oldOn = oldVnode.data.on || {};
  56147. target$1 = vnode.elm;
  56148. normalizeEvents(on);
  56149. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56150. target$1 = undefined;
  56151. }
  56152. var events = {
  56153. create: updateDOMListeners,
  56154. update: updateDOMListeners
  56155. };
  56156. /* */
  56157. var svgContainer;
  56158. function updateDOMProps (oldVnode, vnode) {
  56159. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56160. return
  56161. }
  56162. var key, cur;
  56163. var elm = vnode.elm;
  56164. var oldProps = oldVnode.data.domProps || {};
  56165. var props = vnode.data.domProps || {};
  56166. // clone observed objects, as the user probably wants to mutate it
  56167. if (isDef(props.__ob__)) {
  56168. props = vnode.data.domProps = extend({}, props);
  56169. }
  56170. for (key in oldProps) {
  56171. if (!(key in props)) {
  56172. elm[key] = '';
  56173. }
  56174. }
  56175. for (key in props) {
  56176. cur = props[key];
  56177. // ignore children if the node has textContent or innerHTML,
  56178. // as these will throw away existing DOM nodes and cause removal errors
  56179. // on subsequent patches (#3360)
  56180. if (key === 'textContent' || key === 'innerHTML') {
  56181. if (vnode.children) { vnode.children.length = 0; }
  56182. if (cur === oldProps[key]) { continue }
  56183. // #6601 work around Chrome version <= 55 bug where single textNode
  56184. // replaced by innerHTML/textContent retains its parentNode property
  56185. if (elm.childNodes.length === 1) {
  56186. elm.removeChild(elm.childNodes[0]);
  56187. }
  56188. }
  56189. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56190. // store value as _value as well since
  56191. // non-string values will be stringified
  56192. elm._value = cur;
  56193. // avoid resetting cursor position when value is the same
  56194. var strCur = isUndef(cur) ? '' : String(cur);
  56195. if (shouldUpdateValue(elm, strCur)) {
  56196. elm.value = strCur;
  56197. }
  56198. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56199. // IE doesn't support innerHTML for SVG elements
  56200. svgContainer = svgContainer || document.createElement('div');
  56201. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56202. var svg = svgContainer.firstChild;
  56203. while (elm.firstChild) {
  56204. elm.removeChild(elm.firstChild);
  56205. }
  56206. while (svg.firstChild) {
  56207. elm.appendChild(svg.firstChild);
  56208. }
  56209. } else if (
  56210. // skip the update if old and new VDOM state is the same.
  56211. // `value` is handled separately because the DOM value may be temporarily
  56212. // out of sync with VDOM state due to focus, composition and modifiers.
  56213. // This #4521 by skipping the unnecesarry `checked` update.
  56214. cur !== oldProps[key]
  56215. ) {
  56216. // some property updates can throw
  56217. // e.g. `value` on <progress> w/ non-finite value
  56218. try {
  56219. elm[key] = cur;
  56220. } catch (e) {}
  56221. }
  56222. }
  56223. }
  56224. // check platforms/web/util/attrs.js acceptValue
  56225. function shouldUpdateValue (elm, checkVal) {
  56226. return (!elm.composing && (
  56227. elm.tagName === 'OPTION' ||
  56228. isNotInFocusAndDirty(elm, checkVal) ||
  56229. isDirtyWithModifiers(elm, checkVal)
  56230. ))
  56231. }
  56232. function isNotInFocusAndDirty (elm, checkVal) {
  56233. // return true when textbox (.number and .trim) loses focus and its value is
  56234. // not equal to the updated value
  56235. var notInFocus = true;
  56236. // #6157
  56237. // work around IE bug when accessing document.activeElement in an iframe
  56238. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56239. return notInFocus && elm.value !== checkVal
  56240. }
  56241. function isDirtyWithModifiers (elm, newVal) {
  56242. var value = elm.value;
  56243. var modifiers = elm._vModifiers; // injected by v-model runtime
  56244. if (isDef(modifiers)) {
  56245. if (modifiers.number) {
  56246. return toNumber(value) !== toNumber(newVal)
  56247. }
  56248. if (modifiers.trim) {
  56249. return value.trim() !== newVal.trim()
  56250. }
  56251. }
  56252. return value !== newVal
  56253. }
  56254. var domProps = {
  56255. create: updateDOMProps,
  56256. update: updateDOMProps
  56257. };
  56258. /* */
  56259. var parseStyleText = cached(function (cssText) {
  56260. var res = {};
  56261. var listDelimiter = /;(?![^(]*\))/g;
  56262. var propertyDelimiter = /:(.+)/;
  56263. cssText.split(listDelimiter).forEach(function (item) {
  56264. if (item) {
  56265. var tmp = item.split(propertyDelimiter);
  56266. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56267. }
  56268. });
  56269. return res
  56270. });
  56271. // merge static and dynamic style data on the same vnode
  56272. function normalizeStyleData (data) {
  56273. var style = normalizeStyleBinding(data.style);
  56274. // static style is pre-processed into an object during compilation
  56275. // and is always a fresh object, so it's safe to merge into it
  56276. return data.staticStyle
  56277. ? extend(data.staticStyle, style)
  56278. : style
  56279. }
  56280. // normalize possible array / string values into Object
  56281. function normalizeStyleBinding (bindingStyle) {
  56282. if (Array.isArray(bindingStyle)) {
  56283. return toObject(bindingStyle)
  56284. }
  56285. if (typeof bindingStyle === 'string') {
  56286. return parseStyleText(bindingStyle)
  56287. }
  56288. return bindingStyle
  56289. }
  56290. /**
  56291. * parent component style should be after child's
  56292. * so that parent component's style could override it
  56293. */
  56294. function getStyle (vnode, checkChild) {
  56295. var res = {};
  56296. var styleData;
  56297. if (checkChild) {
  56298. var childNode = vnode;
  56299. while (childNode.componentInstance) {
  56300. childNode = childNode.componentInstance._vnode;
  56301. if (
  56302. childNode && childNode.data &&
  56303. (styleData = normalizeStyleData(childNode.data))
  56304. ) {
  56305. extend(res, styleData);
  56306. }
  56307. }
  56308. }
  56309. if ((styleData = normalizeStyleData(vnode.data))) {
  56310. extend(res, styleData);
  56311. }
  56312. var parentNode = vnode;
  56313. while ((parentNode = parentNode.parent)) {
  56314. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56315. extend(res, styleData);
  56316. }
  56317. }
  56318. return res
  56319. }
  56320. /* */
  56321. var cssVarRE = /^--/;
  56322. var importantRE = /\s*!important$/;
  56323. var setProp = function (el, name, val) {
  56324. /* istanbul ignore if */
  56325. if (cssVarRE.test(name)) {
  56326. el.style.setProperty(name, val);
  56327. } else if (importantRE.test(val)) {
  56328. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56329. } else {
  56330. var normalizedName = normalize(name);
  56331. if (Array.isArray(val)) {
  56332. // Support values array created by autoprefixer, e.g.
  56333. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56334. // Set them one by one, and the browser will only set those it can recognize
  56335. for (var i = 0, len = val.length; i < len; i++) {
  56336. el.style[normalizedName] = val[i];
  56337. }
  56338. } else {
  56339. el.style[normalizedName] = val;
  56340. }
  56341. }
  56342. };
  56343. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56344. var emptyStyle;
  56345. var normalize = cached(function (prop) {
  56346. emptyStyle = emptyStyle || document.createElement('div').style;
  56347. prop = camelize(prop);
  56348. if (prop !== 'filter' && (prop in emptyStyle)) {
  56349. return prop
  56350. }
  56351. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56352. for (var i = 0; i < vendorNames.length; i++) {
  56353. var name = vendorNames[i] + capName;
  56354. if (name in emptyStyle) {
  56355. return name
  56356. }
  56357. }
  56358. });
  56359. function updateStyle (oldVnode, vnode) {
  56360. var data = vnode.data;
  56361. var oldData = oldVnode.data;
  56362. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56363. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56364. ) {
  56365. return
  56366. }
  56367. var cur, name;
  56368. var el = vnode.elm;
  56369. var oldStaticStyle = oldData.staticStyle;
  56370. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56371. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56372. var oldStyle = oldStaticStyle || oldStyleBinding;
  56373. var style = normalizeStyleBinding(vnode.data.style) || {};
  56374. // store normalized style under a different key for next diff
  56375. // make sure to clone it if it's reactive, since the user likely wants
  56376. // to mutate it.
  56377. vnode.data.normalizedStyle = isDef(style.__ob__)
  56378. ? extend({}, style)
  56379. : style;
  56380. var newStyle = getStyle(vnode, true);
  56381. for (name in oldStyle) {
  56382. if (isUndef(newStyle[name])) {
  56383. setProp(el, name, '');
  56384. }
  56385. }
  56386. for (name in newStyle) {
  56387. cur = newStyle[name];
  56388. if (cur !== oldStyle[name]) {
  56389. // ie9 setting to null has no effect, must use empty string
  56390. setProp(el, name, cur == null ? '' : cur);
  56391. }
  56392. }
  56393. }
  56394. var style = {
  56395. create: updateStyle,
  56396. update: updateStyle
  56397. };
  56398. /* */
  56399. var whitespaceRE = /\s+/;
  56400. /**
  56401. * Add class with compatibility for SVG since classList is not supported on
  56402. * SVG elements in IE
  56403. */
  56404. function addClass (el, cls) {
  56405. /* istanbul ignore if */
  56406. if (!cls || !(cls = cls.trim())) {
  56407. return
  56408. }
  56409. /* istanbul ignore else */
  56410. if (el.classList) {
  56411. if (cls.indexOf(' ') > -1) {
  56412. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56413. } else {
  56414. el.classList.add(cls);
  56415. }
  56416. } else {
  56417. var cur = " " + (el.getAttribute('class') || '') + " ";
  56418. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56419. el.setAttribute('class', (cur + cls).trim());
  56420. }
  56421. }
  56422. }
  56423. /**
  56424. * Remove class with compatibility for SVG since classList is not supported on
  56425. * SVG elements in IE
  56426. */
  56427. function removeClass (el, cls) {
  56428. /* istanbul ignore if */
  56429. if (!cls || !(cls = cls.trim())) {
  56430. return
  56431. }
  56432. /* istanbul ignore else */
  56433. if (el.classList) {
  56434. if (cls.indexOf(' ') > -1) {
  56435. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56436. } else {
  56437. el.classList.remove(cls);
  56438. }
  56439. if (!el.classList.length) {
  56440. el.removeAttribute('class');
  56441. }
  56442. } else {
  56443. var cur = " " + (el.getAttribute('class') || '') + " ";
  56444. var tar = ' ' + cls + ' ';
  56445. while (cur.indexOf(tar) >= 0) {
  56446. cur = cur.replace(tar, ' ');
  56447. }
  56448. cur = cur.trim();
  56449. if (cur) {
  56450. el.setAttribute('class', cur);
  56451. } else {
  56452. el.removeAttribute('class');
  56453. }
  56454. }
  56455. }
  56456. /* */
  56457. function resolveTransition (def$$1) {
  56458. if (!def$$1) {
  56459. return
  56460. }
  56461. /* istanbul ignore else */
  56462. if (typeof def$$1 === 'object') {
  56463. var res = {};
  56464. if (def$$1.css !== false) {
  56465. extend(res, autoCssTransition(def$$1.name || 'v'));
  56466. }
  56467. extend(res, def$$1);
  56468. return res
  56469. } else if (typeof def$$1 === 'string') {
  56470. return autoCssTransition(def$$1)
  56471. }
  56472. }
  56473. var autoCssTransition = cached(function (name) {
  56474. return {
  56475. enterClass: (name + "-enter"),
  56476. enterToClass: (name + "-enter-to"),
  56477. enterActiveClass: (name + "-enter-active"),
  56478. leaveClass: (name + "-leave"),
  56479. leaveToClass: (name + "-leave-to"),
  56480. leaveActiveClass: (name + "-leave-active")
  56481. }
  56482. });
  56483. var hasTransition = inBrowser && !isIE9;
  56484. var TRANSITION = 'transition';
  56485. var ANIMATION = 'animation';
  56486. // Transition property/event sniffing
  56487. var transitionProp = 'transition';
  56488. var transitionEndEvent = 'transitionend';
  56489. var animationProp = 'animation';
  56490. var animationEndEvent = 'animationend';
  56491. if (hasTransition) {
  56492. /* istanbul ignore if */
  56493. if (window.ontransitionend === undefined &&
  56494. window.onwebkittransitionend !== undefined
  56495. ) {
  56496. transitionProp = 'WebkitTransition';
  56497. transitionEndEvent = 'webkitTransitionEnd';
  56498. }
  56499. if (window.onanimationend === undefined &&
  56500. window.onwebkitanimationend !== undefined
  56501. ) {
  56502. animationProp = 'WebkitAnimation';
  56503. animationEndEvent = 'webkitAnimationEnd';
  56504. }
  56505. }
  56506. // binding to window is necessary to make hot reload work in IE in strict mode
  56507. var raf = inBrowser
  56508. ? window.requestAnimationFrame
  56509. ? window.requestAnimationFrame.bind(window)
  56510. : setTimeout
  56511. : /* istanbul ignore next */ function (fn) { return fn(); };
  56512. function nextFrame (fn) {
  56513. raf(function () {
  56514. raf(fn);
  56515. });
  56516. }
  56517. function addTransitionClass (el, cls) {
  56518. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56519. if (transitionClasses.indexOf(cls) < 0) {
  56520. transitionClasses.push(cls);
  56521. addClass(el, cls);
  56522. }
  56523. }
  56524. function removeTransitionClass (el, cls) {
  56525. if (el._transitionClasses) {
  56526. remove(el._transitionClasses, cls);
  56527. }
  56528. removeClass(el, cls);
  56529. }
  56530. function whenTransitionEnds (
  56531. el,
  56532. expectedType,
  56533. cb
  56534. ) {
  56535. var ref = getTransitionInfo(el, expectedType);
  56536. var type = ref.type;
  56537. var timeout = ref.timeout;
  56538. var propCount = ref.propCount;
  56539. if (!type) { return cb() }
  56540. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56541. var ended = 0;
  56542. var end = function () {
  56543. el.removeEventListener(event, onEnd);
  56544. cb();
  56545. };
  56546. var onEnd = function (e) {
  56547. if (e.target === el) {
  56548. if (++ended >= propCount) {
  56549. end();
  56550. }
  56551. }
  56552. };
  56553. setTimeout(function () {
  56554. if (ended < propCount) {
  56555. end();
  56556. }
  56557. }, timeout + 1);
  56558. el.addEventListener(event, onEnd);
  56559. }
  56560. var transformRE = /\b(transform|all)(,|$)/;
  56561. function getTransitionInfo (el, expectedType) {
  56562. var styles = window.getComputedStyle(el);
  56563. // JSDOM may return undefined for transition properties
  56564. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56565. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56566. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56567. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56568. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56569. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56570. var type;
  56571. var timeout = 0;
  56572. var propCount = 0;
  56573. /* istanbul ignore if */
  56574. if (expectedType === TRANSITION) {
  56575. if (transitionTimeout > 0) {
  56576. type = TRANSITION;
  56577. timeout = transitionTimeout;
  56578. propCount = transitionDurations.length;
  56579. }
  56580. } else if (expectedType === ANIMATION) {
  56581. if (animationTimeout > 0) {
  56582. type = ANIMATION;
  56583. timeout = animationTimeout;
  56584. propCount = animationDurations.length;
  56585. }
  56586. } else {
  56587. timeout = Math.max(transitionTimeout, animationTimeout);
  56588. type = timeout > 0
  56589. ? transitionTimeout > animationTimeout
  56590. ? TRANSITION
  56591. : ANIMATION
  56592. : null;
  56593. propCount = type
  56594. ? type === TRANSITION
  56595. ? transitionDurations.length
  56596. : animationDurations.length
  56597. : 0;
  56598. }
  56599. var hasTransform =
  56600. type === TRANSITION &&
  56601. transformRE.test(styles[transitionProp + 'Property']);
  56602. return {
  56603. type: type,
  56604. timeout: timeout,
  56605. propCount: propCount,
  56606. hasTransform: hasTransform
  56607. }
  56608. }
  56609. function getTimeout (delays, durations) {
  56610. /* istanbul ignore next */
  56611. while (delays.length < durations.length) {
  56612. delays = delays.concat(delays);
  56613. }
  56614. return Math.max.apply(null, durations.map(function (d, i) {
  56615. return toMs(d) + toMs(delays[i])
  56616. }))
  56617. }
  56618. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56619. // in a locale-dependent way, using a comma instead of a dot.
  56620. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56621. // as a floor function) causing unexpected behaviors
  56622. function toMs (s) {
  56623. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56624. }
  56625. /* */
  56626. function enter (vnode, toggleDisplay) {
  56627. var el = vnode.elm;
  56628. // call leave callback now
  56629. if (isDef(el._leaveCb)) {
  56630. el._leaveCb.cancelled = true;
  56631. el._leaveCb();
  56632. }
  56633. var data = resolveTransition(vnode.data.transition);
  56634. if (isUndef(data)) {
  56635. return
  56636. }
  56637. /* istanbul ignore if */
  56638. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56639. return
  56640. }
  56641. var css = data.css;
  56642. var type = data.type;
  56643. var enterClass = data.enterClass;
  56644. var enterToClass = data.enterToClass;
  56645. var enterActiveClass = data.enterActiveClass;
  56646. var appearClass = data.appearClass;
  56647. var appearToClass = data.appearToClass;
  56648. var appearActiveClass = data.appearActiveClass;
  56649. var beforeEnter = data.beforeEnter;
  56650. var enter = data.enter;
  56651. var afterEnter = data.afterEnter;
  56652. var enterCancelled = data.enterCancelled;
  56653. var beforeAppear = data.beforeAppear;
  56654. var appear = data.appear;
  56655. var afterAppear = data.afterAppear;
  56656. var appearCancelled = data.appearCancelled;
  56657. var duration = data.duration;
  56658. // activeInstance will always be the <transition> component managing this
  56659. // transition. One edge case to check is when the <transition> is placed
  56660. // as the root node of a child component. In that case we need to check
  56661. // <transition>'s parent for appear check.
  56662. var context = activeInstance;
  56663. var transitionNode = activeInstance.$vnode;
  56664. while (transitionNode && transitionNode.parent) {
  56665. context = transitionNode.context;
  56666. transitionNode = transitionNode.parent;
  56667. }
  56668. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56669. if (isAppear && !appear && appear !== '') {
  56670. return
  56671. }
  56672. var startClass = isAppear && appearClass
  56673. ? appearClass
  56674. : enterClass;
  56675. var activeClass = isAppear && appearActiveClass
  56676. ? appearActiveClass
  56677. : enterActiveClass;
  56678. var toClass = isAppear && appearToClass
  56679. ? appearToClass
  56680. : enterToClass;
  56681. var beforeEnterHook = isAppear
  56682. ? (beforeAppear || beforeEnter)
  56683. : beforeEnter;
  56684. var enterHook = isAppear
  56685. ? (typeof appear === 'function' ? appear : enter)
  56686. : enter;
  56687. var afterEnterHook = isAppear
  56688. ? (afterAppear || afterEnter)
  56689. : afterEnter;
  56690. var enterCancelledHook = isAppear
  56691. ? (appearCancelled || enterCancelled)
  56692. : enterCancelled;
  56693. var explicitEnterDuration = toNumber(
  56694. isObject(duration)
  56695. ? duration.enter
  56696. : duration
  56697. );
  56698. if (explicitEnterDuration != null) {
  56699. checkDuration(explicitEnterDuration, 'enter', vnode);
  56700. }
  56701. var expectsCSS = css !== false && !isIE9;
  56702. var userWantsControl = getHookArgumentsLength(enterHook);
  56703. var cb = el._enterCb = once(function () {
  56704. if (expectsCSS) {
  56705. removeTransitionClass(el, toClass);
  56706. removeTransitionClass(el, activeClass);
  56707. }
  56708. if (cb.cancelled) {
  56709. if (expectsCSS) {
  56710. removeTransitionClass(el, startClass);
  56711. }
  56712. enterCancelledHook && enterCancelledHook(el);
  56713. } else {
  56714. afterEnterHook && afterEnterHook(el);
  56715. }
  56716. el._enterCb = null;
  56717. });
  56718. if (!vnode.data.show) {
  56719. // remove pending leave element on enter by injecting an insert hook
  56720. mergeVNodeHook(vnode, 'insert', function () {
  56721. var parent = el.parentNode;
  56722. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56723. if (pendingNode &&
  56724. pendingNode.tag === vnode.tag &&
  56725. pendingNode.elm._leaveCb
  56726. ) {
  56727. pendingNode.elm._leaveCb();
  56728. }
  56729. enterHook && enterHook(el, cb);
  56730. });
  56731. }
  56732. // start enter transition
  56733. beforeEnterHook && beforeEnterHook(el);
  56734. if (expectsCSS) {
  56735. addTransitionClass(el, startClass);
  56736. addTransitionClass(el, activeClass);
  56737. nextFrame(function () {
  56738. removeTransitionClass(el, startClass);
  56739. if (!cb.cancelled) {
  56740. addTransitionClass(el, toClass);
  56741. if (!userWantsControl) {
  56742. if (isValidDuration(explicitEnterDuration)) {
  56743. setTimeout(cb, explicitEnterDuration);
  56744. } else {
  56745. whenTransitionEnds(el, type, cb);
  56746. }
  56747. }
  56748. }
  56749. });
  56750. }
  56751. if (vnode.data.show) {
  56752. toggleDisplay && toggleDisplay();
  56753. enterHook && enterHook(el, cb);
  56754. }
  56755. if (!expectsCSS && !userWantsControl) {
  56756. cb();
  56757. }
  56758. }
  56759. function leave (vnode, rm) {
  56760. var el = vnode.elm;
  56761. // call enter callback now
  56762. if (isDef(el._enterCb)) {
  56763. el._enterCb.cancelled = true;
  56764. el._enterCb();
  56765. }
  56766. var data = resolveTransition(vnode.data.transition);
  56767. if (isUndef(data) || el.nodeType !== 1) {
  56768. return rm()
  56769. }
  56770. /* istanbul ignore if */
  56771. if (isDef(el._leaveCb)) {
  56772. return
  56773. }
  56774. var css = data.css;
  56775. var type = data.type;
  56776. var leaveClass = data.leaveClass;
  56777. var leaveToClass = data.leaveToClass;
  56778. var leaveActiveClass = data.leaveActiveClass;
  56779. var beforeLeave = data.beforeLeave;
  56780. var leave = data.leave;
  56781. var afterLeave = data.afterLeave;
  56782. var leaveCancelled = data.leaveCancelled;
  56783. var delayLeave = data.delayLeave;
  56784. var duration = data.duration;
  56785. var expectsCSS = css !== false && !isIE9;
  56786. var userWantsControl = getHookArgumentsLength(leave);
  56787. var explicitLeaveDuration = toNumber(
  56788. isObject(duration)
  56789. ? duration.leave
  56790. : duration
  56791. );
  56792. if (isDef(explicitLeaveDuration)) {
  56793. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56794. }
  56795. var cb = el._leaveCb = once(function () {
  56796. if (el.parentNode && el.parentNode._pending) {
  56797. el.parentNode._pending[vnode.key] = null;
  56798. }
  56799. if (expectsCSS) {
  56800. removeTransitionClass(el, leaveToClass);
  56801. removeTransitionClass(el, leaveActiveClass);
  56802. }
  56803. if (cb.cancelled) {
  56804. if (expectsCSS) {
  56805. removeTransitionClass(el, leaveClass);
  56806. }
  56807. leaveCancelled && leaveCancelled(el);
  56808. } else {
  56809. rm();
  56810. afterLeave && afterLeave(el);
  56811. }
  56812. el._leaveCb = null;
  56813. });
  56814. if (delayLeave) {
  56815. delayLeave(performLeave);
  56816. } else {
  56817. performLeave();
  56818. }
  56819. function performLeave () {
  56820. // the delayed leave may have already been cancelled
  56821. if (cb.cancelled) {
  56822. return
  56823. }
  56824. // record leaving element
  56825. if (!vnode.data.show && el.parentNode) {
  56826. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56827. }
  56828. beforeLeave && beforeLeave(el);
  56829. if (expectsCSS) {
  56830. addTransitionClass(el, leaveClass);
  56831. addTransitionClass(el, leaveActiveClass);
  56832. nextFrame(function () {
  56833. removeTransitionClass(el, leaveClass);
  56834. if (!cb.cancelled) {
  56835. addTransitionClass(el, leaveToClass);
  56836. if (!userWantsControl) {
  56837. if (isValidDuration(explicitLeaveDuration)) {
  56838. setTimeout(cb, explicitLeaveDuration);
  56839. } else {
  56840. whenTransitionEnds(el, type, cb);
  56841. }
  56842. }
  56843. }
  56844. });
  56845. }
  56846. leave && leave(el, cb);
  56847. if (!expectsCSS && !userWantsControl) {
  56848. cb();
  56849. }
  56850. }
  56851. }
  56852. // only used in dev mode
  56853. function checkDuration (val, name, vnode) {
  56854. if (typeof val !== 'number') {
  56855. warn(
  56856. "<transition> explicit " + name + " duration is not a valid number - " +
  56857. "got " + (JSON.stringify(val)) + ".",
  56858. vnode.context
  56859. );
  56860. } else if (isNaN(val)) {
  56861. warn(
  56862. "<transition> explicit " + name + " duration is NaN - " +
  56863. 'the duration expression might be incorrect.',
  56864. vnode.context
  56865. );
  56866. }
  56867. }
  56868. function isValidDuration (val) {
  56869. return typeof val === 'number' && !isNaN(val)
  56870. }
  56871. /**
  56872. * Normalize a transition hook's argument length. The hook may be:
  56873. * - a merged hook (invoker) with the original in .fns
  56874. * - a wrapped component method (check ._length)
  56875. * - a plain function (.length)
  56876. */
  56877. function getHookArgumentsLength (fn) {
  56878. if (isUndef(fn)) {
  56879. return false
  56880. }
  56881. var invokerFns = fn.fns;
  56882. if (isDef(invokerFns)) {
  56883. // invoker
  56884. return getHookArgumentsLength(
  56885. Array.isArray(invokerFns)
  56886. ? invokerFns[0]
  56887. : invokerFns
  56888. )
  56889. } else {
  56890. return (fn._length || fn.length) > 1
  56891. }
  56892. }
  56893. function _enter (_, vnode) {
  56894. if (vnode.data.show !== true) {
  56895. enter(vnode);
  56896. }
  56897. }
  56898. var transition = inBrowser ? {
  56899. create: _enter,
  56900. activate: _enter,
  56901. remove: function remove$$1 (vnode, rm) {
  56902. /* istanbul ignore else */
  56903. if (vnode.data.show !== true) {
  56904. leave(vnode, rm);
  56905. } else {
  56906. rm();
  56907. }
  56908. }
  56909. } : {};
  56910. var platformModules = [
  56911. attrs,
  56912. klass,
  56913. events,
  56914. domProps,
  56915. style,
  56916. transition
  56917. ];
  56918. /* */
  56919. // the directive module should be applied last, after all
  56920. // built-in modules have been applied.
  56921. var modules = platformModules.concat(baseModules);
  56922. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56923. /**
  56924. * Not type checking this file because flow doesn't like attaching
  56925. * properties to Elements.
  56926. */
  56927. /* istanbul ignore if */
  56928. if (isIE9) {
  56929. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56930. document.addEventListener('selectionchange', function () {
  56931. var el = document.activeElement;
  56932. if (el && el.vmodel) {
  56933. trigger(el, 'input');
  56934. }
  56935. });
  56936. }
  56937. var directive = {
  56938. inserted: function inserted (el, binding, vnode, oldVnode) {
  56939. if (vnode.tag === 'select') {
  56940. // #6903
  56941. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56942. mergeVNodeHook(vnode, 'postpatch', function () {
  56943. directive.componentUpdated(el, binding, vnode);
  56944. });
  56945. } else {
  56946. setSelected(el, binding, vnode.context);
  56947. }
  56948. el._vOptions = [].map.call(el.options, getValue);
  56949. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56950. el._vModifiers = binding.modifiers;
  56951. if (!binding.modifiers.lazy) {
  56952. el.addEventListener('compositionstart', onCompositionStart);
  56953. el.addEventListener('compositionend', onCompositionEnd);
  56954. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56955. // switching focus before confirming composition choice
  56956. // this also fixes the issue where some browsers e.g. iOS Chrome
  56957. // fires "change" instead of "input" on autocomplete.
  56958. el.addEventListener('change', onCompositionEnd);
  56959. /* istanbul ignore if */
  56960. if (isIE9) {
  56961. el.vmodel = true;
  56962. }
  56963. }
  56964. }
  56965. },
  56966. componentUpdated: function componentUpdated (el, binding, vnode) {
  56967. if (vnode.tag === 'select') {
  56968. setSelected(el, binding, vnode.context);
  56969. // in case the options rendered by v-for have changed,
  56970. // it's possible that the value is out-of-sync with the rendered options.
  56971. // detect such cases and filter out values that no longer has a matching
  56972. // option in the DOM.
  56973. var prevOptions = el._vOptions;
  56974. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56975. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56976. // trigger change event if
  56977. // no matching option found for at least one value
  56978. var needReset = el.multiple
  56979. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56980. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56981. if (needReset) {
  56982. trigger(el, 'change');
  56983. }
  56984. }
  56985. }
  56986. }
  56987. };
  56988. function setSelected (el, binding, vm) {
  56989. actuallySetSelected(el, binding, vm);
  56990. /* istanbul ignore if */
  56991. if (isIE || isEdge) {
  56992. setTimeout(function () {
  56993. actuallySetSelected(el, binding, vm);
  56994. }, 0);
  56995. }
  56996. }
  56997. function actuallySetSelected (el, binding, vm) {
  56998. var value = binding.value;
  56999. var isMultiple = el.multiple;
  57000. if (isMultiple && !Array.isArray(value)) {
  57001. warn(
  57002. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  57003. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  57004. vm
  57005. );
  57006. return
  57007. }
  57008. var selected, option;
  57009. for (var i = 0, l = el.options.length; i < l; i++) {
  57010. option = el.options[i];
  57011. if (isMultiple) {
  57012. selected = looseIndexOf(value, getValue(option)) > -1;
  57013. if (option.selected !== selected) {
  57014. option.selected = selected;
  57015. }
  57016. } else {
  57017. if (looseEqual(getValue(option), value)) {
  57018. if (el.selectedIndex !== i) {
  57019. el.selectedIndex = i;
  57020. }
  57021. return
  57022. }
  57023. }
  57024. }
  57025. if (!isMultiple) {
  57026. el.selectedIndex = -1;
  57027. }
  57028. }
  57029. function hasNoMatchingOption (value, options) {
  57030. return options.every(function (o) { return !looseEqual(o, value); })
  57031. }
  57032. function getValue (option) {
  57033. return '_value' in option
  57034. ? option._value
  57035. : option.value
  57036. }
  57037. function onCompositionStart (e) {
  57038. e.target.composing = true;
  57039. }
  57040. function onCompositionEnd (e) {
  57041. // prevent triggering an input event for no reason
  57042. if (!e.target.composing) { return }
  57043. e.target.composing = false;
  57044. trigger(e.target, 'input');
  57045. }
  57046. function trigger (el, type) {
  57047. var e = document.createEvent('HTMLEvents');
  57048. e.initEvent(type, true, true);
  57049. el.dispatchEvent(e);
  57050. }
  57051. /* */
  57052. // recursively search for possible transition defined inside the component root
  57053. function locateNode (vnode) {
  57054. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57055. ? locateNode(vnode.componentInstance._vnode)
  57056. : vnode
  57057. }
  57058. var show = {
  57059. bind: function bind (el, ref, vnode) {
  57060. var value = ref.value;
  57061. vnode = locateNode(vnode);
  57062. var transition$$1 = vnode.data && vnode.data.transition;
  57063. var originalDisplay = el.__vOriginalDisplay =
  57064. el.style.display === 'none' ? '' : el.style.display;
  57065. if (value && transition$$1) {
  57066. vnode.data.show = true;
  57067. enter(vnode, function () {
  57068. el.style.display = originalDisplay;
  57069. });
  57070. } else {
  57071. el.style.display = value ? originalDisplay : 'none';
  57072. }
  57073. },
  57074. update: function update (el, ref, vnode) {
  57075. var value = ref.value;
  57076. var oldValue = ref.oldValue;
  57077. /* istanbul ignore if */
  57078. if (!value === !oldValue) { return }
  57079. vnode = locateNode(vnode);
  57080. var transition$$1 = vnode.data && vnode.data.transition;
  57081. if (transition$$1) {
  57082. vnode.data.show = true;
  57083. if (value) {
  57084. enter(vnode, function () {
  57085. el.style.display = el.__vOriginalDisplay;
  57086. });
  57087. } else {
  57088. leave(vnode, function () {
  57089. el.style.display = 'none';
  57090. });
  57091. }
  57092. } else {
  57093. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57094. }
  57095. },
  57096. unbind: function unbind (
  57097. el,
  57098. binding,
  57099. vnode,
  57100. oldVnode,
  57101. isDestroy
  57102. ) {
  57103. if (!isDestroy) {
  57104. el.style.display = el.__vOriginalDisplay;
  57105. }
  57106. }
  57107. };
  57108. var platformDirectives = {
  57109. model: directive,
  57110. show: show
  57111. };
  57112. /* */
  57113. var transitionProps = {
  57114. name: String,
  57115. appear: Boolean,
  57116. css: Boolean,
  57117. mode: String,
  57118. type: String,
  57119. enterClass: String,
  57120. leaveClass: String,
  57121. enterToClass: String,
  57122. leaveToClass: String,
  57123. enterActiveClass: String,
  57124. leaveActiveClass: String,
  57125. appearClass: String,
  57126. appearActiveClass: String,
  57127. appearToClass: String,
  57128. duration: [Number, String, Object]
  57129. };
  57130. // in case the child is also an abstract component, e.g. <keep-alive>
  57131. // we want to recursively retrieve the real component to be rendered
  57132. function getRealChild (vnode) {
  57133. var compOptions = vnode && vnode.componentOptions;
  57134. if (compOptions && compOptions.Ctor.options.abstract) {
  57135. return getRealChild(getFirstComponentChild(compOptions.children))
  57136. } else {
  57137. return vnode
  57138. }
  57139. }
  57140. function extractTransitionData (comp) {
  57141. var data = {};
  57142. var options = comp.$options;
  57143. // props
  57144. for (var key in options.propsData) {
  57145. data[key] = comp[key];
  57146. }
  57147. // events.
  57148. // extract listeners and pass them directly to the transition methods
  57149. var listeners = options._parentListeners;
  57150. for (var key$1 in listeners) {
  57151. data[camelize(key$1)] = listeners[key$1];
  57152. }
  57153. return data
  57154. }
  57155. function placeholder (h, rawChild) {
  57156. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57157. return h('keep-alive', {
  57158. props: rawChild.componentOptions.propsData
  57159. })
  57160. }
  57161. }
  57162. function hasParentTransition (vnode) {
  57163. while ((vnode = vnode.parent)) {
  57164. if (vnode.data.transition) {
  57165. return true
  57166. }
  57167. }
  57168. }
  57169. function isSameChild (child, oldChild) {
  57170. return oldChild.key === child.key && oldChild.tag === child.tag
  57171. }
  57172. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57173. var isVShowDirective = function (d) { return d.name === 'show'; };
  57174. var Transition = {
  57175. name: 'transition',
  57176. props: transitionProps,
  57177. abstract: true,
  57178. render: function render (h) {
  57179. var this$1 = this;
  57180. var children = this.$slots.default;
  57181. if (!children) {
  57182. return
  57183. }
  57184. // filter out text nodes (possible whitespaces)
  57185. children = children.filter(isNotTextNode);
  57186. /* istanbul ignore if */
  57187. if (!children.length) {
  57188. return
  57189. }
  57190. // warn multiple elements
  57191. if (children.length > 1) {
  57192. warn(
  57193. '<transition> can only be used on a single element. Use ' +
  57194. '<transition-group> for lists.',
  57195. this.$parent
  57196. );
  57197. }
  57198. var mode = this.mode;
  57199. // warn invalid mode
  57200. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57201. ) {
  57202. warn(
  57203. 'invalid <transition> mode: ' + mode,
  57204. this.$parent
  57205. );
  57206. }
  57207. var rawChild = children[0];
  57208. // if this is a component root node and the component's
  57209. // parent container node also has transition, skip.
  57210. if (hasParentTransition(this.$vnode)) {
  57211. return rawChild
  57212. }
  57213. // apply transition data to child
  57214. // use getRealChild() to ignore abstract components e.g. keep-alive
  57215. var child = getRealChild(rawChild);
  57216. /* istanbul ignore if */
  57217. if (!child) {
  57218. return rawChild
  57219. }
  57220. if (this._leaving) {
  57221. return placeholder(h, rawChild)
  57222. }
  57223. // ensure a key that is unique to the vnode type and to this transition
  57224. // component instance. This key will be used to remove pending leaving nodes
  57225. // during entering.
  57226. var id = "__transition-" + (this._uid) + "-";
  57227. child.key = child.key == null
  57228. ? child.isComment
  57229. ? id + 'comment'
  57230. : id + child.tag
  57231. : isPrimitive(child.key)
  57232. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57233. : child.key;
  57234. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57235. var oldRawChild = this._vnode;
  57236. var oldChild = getRealChild(oldRawChild);
  57237. // mark v-show
  57238. // so that the transition module can hand over the control to the directive
  57239. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57240. child.data.show = true;
  57241. }
  57242. if (
  57243. oldChild &&
  57244. oldChild.data &&
  57245. !isSameChild(child, oldChild) &&
  57246. !isAsyncPlaceholder(oldChild) &&
  57247. // #6687 component root is a comment node
  57248. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57249. ) {
  57250. // replace old child transition data with fresh one
  57251. // important for dynamic transitions!
  57252. var oldData = oldChild.data.transition = extend({}, data);
  57253. // handle transition mode
  57254. if (mode === 'out-in') {
  57255. // return placeholder node and queue update when leave finishes
  57256. this._leaving = true;
  57257. mergeVNodeHook(oldData, 'afterLeave', function () {
  57258. this$1._leaving = false;
  57259. this$1.$forceUpdate();
  57260. });
  57261. return placeholder(h, rawChild)
  57262. } else if (mode === 'in-out') {
  57263. if (isAsyncPlaceholder(child)) {
  57264. return oldRawChild
  57265. }
  57266. var delayedLeave;
  57267. var performLeave = function () { delayedLeave(); };
  57268. mergeVNodeHook(data, 'afterEnter', performLeave);
  57269. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57270. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57271. }
  57272. }
  57273. return rawChild
  57274. }
  57275. };
  57276. /* */
  57277. var props = extend({
  57278. tag: String,
  57279. moveClass: String
  57280. }, transitionProps);
  57281. delete props.mode;
  57282. var TransitionGroup = {
  57283. props: props,
  57284. beforeMount: function beforeMount () {
  57285. var this$1 = this;
  57286. var update = this._update;
  57287. this._update = function (vnode, hydrating) {
  57288. var restoreActiveInstance = setActiveInstance(this$1);
  57289. // force removing pass
  57290. this$1.__patch__(
  57291. this$1._vnode,
  57292. this$1.kept,
  57293. false, // hydrating
  57294. true // removeOnly (!important, avoids unnecessary moves)
  57295. );
  57296. this$1._vnode = this$1.kept;
  57297. restoreActiveInstance();
  57298. update.call(this$1, vnode, hydrating);
  57299. };
  57300. },
  57301. render: function render (h) {
  57302. var tag = this.tag || this.$vnode.data.tag || 'span';
  57303. var map = Object.create(null);
  57304. var prevChildren = this.prevChildren = this.children;
  57305. var rawChildren = this.$slots.default || [];
  57306. var children = this.children = [];
  57307. var transitionData = extractTransitionData(this);
  57308. for (var i = 0; i < rawChildren.length; i++) {
  57309. var c = rawChildren[i];
  57310. if (c.tag) {
  57311. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57312. children.push(c);
  57313. map[c.key] = c
  57314. ;(c.data || (c.data = {})).transition = transitionData;
  57315. } else {
  57316. var opts = c.componentOptions;
  57317. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57318. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57319. }
  57320. }
  57321. }
  57322. if (prevChildren) {
  57323. var kept = [];
  57324. var removed = [];
  57325. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57326. var c$1 = prevChildren[i$1];
  57327. c$1.data.transition = transitionData;
  57328. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57329. if (map[c$1.key]) {
  57330. kept.push(c$1);
  57331. } else {
  57332. removed.push(c$1);
  57333. }
  57334. }
  57335. this.kept = h(tag, null, kept);
  57336. this.removed = removed;
  57337. }
  57338. return h(tag, null, children)
  57339. },
  57340. updated: function updated () {
  57341. var children = this.prevChildren;
  57342. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57343. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57344. return
  57345. }
  57346. // we divide the work into three loops to avoid mixing DOM reads and writes
  57347. // in each iteration - which helps prevent layout thrashing.
  57348. children.forEach(callPendingCbs);
  57349. children.forEach(recordPosition);
  57350. children.forEach(applyTranslation);
  57351. // force reflow to put everything in position
  57352. // assign to this to avoid being removed in tree-shaking
  57353. // $flow-disable-line
  57354. this._reflow = document.body.offsetHeight;
  57355. children.forEach(function (c) {
  57356. if (c.data.moved) {
  57357. var el = c.elm;
  57358. var s = el.style;
  57359. addTransitionClass(el, moveClass);
  57360. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57361. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57362. if (e && e.target !== el) {
  57363. return
  57364. }
  57365. if (!e || /transform$/.test(e.propertyName)) {
  57366. el.removeEventListener(transitionEndEvent, cb);
  57367. el._moveCb = null;
  57368. removeTransitionClass(el, moveClass);
  57369. }
  57370. });
  57371. }
  57372. });
  57373. },
  57374. methods: {
  57375. hasMove: function hasMove (el, moveClass) {
  57376. /* istanbul ignore if */
  57377. if (!hasTransition) {
  57378. return false
  57379. }
  57380. /* istanbul ignore if */
  57381. if (this._hasMove) {
  57382. return this._hasMove
  57383. }
  57384. // Detect whether an element with the move class applied has
  57385. // CSS transitions. Since the element may be inside an entering
  57386. // transition at this very moment, we make a clone of it and remove
  57387. // all other transition classes applied to ensure only the move class
  57388. // is applied.
  57389. var clone = el.cloneNode();
  57390. if (el._transitionClasses) {
  57391. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57392. }
  57393. addClass(clone, moveClass);
  57394. clone.style.display = 'none';
  57395. this.$el.appendChild(clone);
  57396. var info = getTransitionInfo(clone);
  57397. this.$el.removeChild(clone);
  57398. return (this._hasMove = info.hasTransform)
  57399. }
  57400. }
  57401. };
  57402. function callPendingCbs (c) {
  57403. /* istanbul ignore if */
  57404. if (c.elm._moveCb) {
  57405. c.elm._moveCb();
  57406. }
  57407. /* istanbul ignore if */
  57408. if (c.elm._enterCb) {
  57409. c.elm._enterCb();
  57410. }
  57411. }
  57412. function recordPosition (c) {
  57413. c.data.newPos = c.elm.getBoundingClientRect();
  57414. }
  57415. function applyTranslation (c) {
  57416. var oldPos = c.data.pos;
  57417. var newPos = c.data.newPos;
  57418. var dx = oldPos.left - newPos.left;
  57419. var dy = oldPos.top - newPos.top;
  57420. if (dx || dy) {
  57421. c.data.moved = true;
  57422. var s = c.elm.style;
  57423. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57424. s.transitionDuration = '0s';
  57425. }
  57426. }
  57427. var platformComponents = {
  57428. Transition: Transition,
  57429. TransitionGroup: TransitionGroup
  57430. };
  57431. /* */
  57432. // install platform specific utils
  57433. Vue.config.mustUseProp = mustUseProp;
  57434. Vue.config.isReservedTag = isReservedTag;
  57435. Vue.config.isReservedAttr = isReservedAttr;
  57436. Vue.config.getTagNamespace = getTagNamespace;
  57437. Vue.config.isUnknownElement = isUnknownElement;
  57438. // install platform runtime directives & components
  57439. extend(Vue.options.directives, platformDirectives);
  57440. extend(Vue.options.components, platformComponents);
  57441. // install platform patch function
  57442. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57443. // public mount method
  57444. Vue.prototype.$mount = function (
  57445. el,
  57446. hydrating
  57447. ) {
  57448. el = el && inBrowser ? query(el) : undefined;
  57449. return mountComponent(this, el, hydrating)
  57450. };
  57451. // devtools global hook
  57452. /* istanbul ignore next */
  57453. if (inBrowser) {
  57454. setTimeout(function () {
  57455. if (config.devtools) {
  57456. if (devtools) {
  57457. devtools.emit('init', Vue);
  57458. } else {
  57459. console[console.info ? 'info' : 'log'](
  57460. 'Download the Vue Devtools extension for a better development experience:\n' +
  57461. 'https://github.com/vuejs/vue-devtools'
  57462. );
  57463. }
  57464. }
  57465. if (config.productionTip !== false &&
  57466. typeof console !== 'undefined'
  57467. ) {
  57468. console[console.info ? 'info' : 'log'](
  57469. "You are running Vue in development mode.\n" +
  57470. "Make sure to turn on production mode when deploying for production.\n" +
  57471. "See more tips at https://vuejs.org/guide/deployment.html"
  57472. );
  57473. }
  57474. }, 0);
  57475. }
  57476. /* */
  57477. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57478. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57479. var buildRegex = cached(function (delimiters) {
  57480. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57481. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57482. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57483. });
  57484. function parseText (
  57485. text,
  57486. delimiters
  57487. ) {
  57488. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57489. if (!tagRE.test(text)) {
  57490. return
  57491. }
  57492. var tokens = [];
  57493. var rawTokens = [];
  57494. var lastIndex = tagRE.lastIndex = 0;
  57495. var match, index, tokenValue;
  57496. while ((match = tagRE.exec(text))) {
  57497. index = match.index;
  57498. // push text token
  57499. if (index > lastIndex) {
  57500. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57501. tokens.push(JSON.stringify(tokenValue));
  57502. }
  57503. // tag token
  57504. var exp = parseFilters(match[1].trim());
  57505. tokens.push(("_s(" + exp + ")"));
  57506. rawTokens.push({ '@binding': exp });
  57507. lastIndex = index + match[0].length;
  57508. }
  57509. if (lastIndex < text.length) {
  57510. rawTokens.push(tokenValue = text.slice(lastIndex));
  57511. tokens.push(JSON.stringify(tokenValue));
  57512. }
  57513. return {
  57514. expression: tokens.join('+'),
  57515. tokens: rawTokens
  57516. }
  57517. }
  57518. /* */
  57519. function transformNode (el, options) {
  57520. var warn = options.warn || baseWarn;
  57521. var staticClass = getAndRemoveAttr(el, 'class');
  57522. if (staticClass) {
  57523. var res = parseText(staticClass, options.delimiters);
  57524. if (res) {
  57525. warn(
  57526. "class=\"" + staticClass + "\": " +
  57527. 'Interpolation inside attributes has been removed. ' +
  57528. 'Use v-bind or the colon shorthand instead. For example, ' +
  57529. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57530. el.rawAttrsMap['class']
  57531. );
  57532. }
  57533. }
  57534. if (staticClass) {
  57535. el.staticClass = JSON.stringify(staticClass);
  57536. }
  57537. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57538. if (classBinding) {
  57539. el.classBinding = classBinding;
  57540. }
  57541. }
  57542. function genData (el) {
  57543. var data = '';
  57544. if (el.staticClass) {
  57545. data += "staticClass:" + (el.staticClass) + ",";
  57546. }
  57547. if (el.classBinding) {
  57548. data += "class:" + (el.classBinding) + ",";
  57549. }
  57550. return data
  57551. }
  57552. var klass$1 = {
  57553. staticKeys: ['staticClass'],
  57554. transformNode: transformNode,
  57555. genData: genData
  57556. };
  57557. /* */
  57558. function transformNode$1 (el, options) {
  57559. var warn = options.warn || baseWarn;
  57560. var staticStyle = getAndRemoveAttr(el, 'style');
  57561. if (staticStyle) {
  57562. /* istanbul ignore if */
  57563. {
  57564. var res = parseText(staticStyle, options.delimiters);
  57565. if (res) {
  57566. warn(
  57567. "style=\"" + staticStyle + "\": " +
  57568. 'Interpolation inside attributes has been removed. ' +
  57569. 'Use v-bind or the colon shorthand instead. For example, ' +
  57570. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57571. el.rawAttrsMap['style']
  57572. );
  57573. }
  57574. }
  57575. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57576. }
  57577. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57578. if (styleBinding) {
  57579. el.styleBinding = styleBinding;
  57580. }
  57581. }
  57582. function genData$1 (el) {
  57583. var data = '';
  57584. if (el.staticStyle) {
  57585. data += "staticStyle:" + (el.staticStyle) + ",";
  57586. }
  57587. if (el.styleBinding) {
  57588. data += "style:(" + (el.styleBinding) + "),";
  57589. }
  57590. return data
  57591. }
  57592. var style$1 = {
  57593. staticKeys: ['staticStyle'],
  57594. transformNode: transformNode$1,
  57595. genData: genData$1
  57596. };
  57597. /* */
  57598. var decoder;
  57599. var he = {
  57600. decode: function decode (html) {
  57601. decoder = decoder || document.createElement('div');
  57602. decoder.innerHTML = html;
  57603. return decoder.textContent
  57604. }
  57605. };
  57606. /* */
  57607. var isUnaryTag = makeMap(
  57608. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57609. 'link,meta,param,source,track,wbr'
  57610. );
  57611. // Elements that you can, intentionally, leave open
  57612. // (and which close themselves)
  57613. var canBeLeftOpenTag = makeMap(
  57614. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57615. );
  57616. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57617. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57618. var isNonPhrasingTag = makeMap(
  57619. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57620. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57621. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57622. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57623. 'title,tr,track'
  57624. );
  57625. /**
  57626. * Not type-checking this file because it's mostly vendor code.
  57627. */
  57628. // Regular Expressions for parsing tags and attributes
  57629. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57630. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57631. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57632. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57633. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57634. var startTagClose = /^\s*(\/?)>/;
  57635. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57636. var doctype = /^<!DOCTYPE [^>]+>/i;
  57637. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57638. var comment = /^<!\--/;
  57639. var conditionalComment = /^<!\[/;
  57640. // Special Elements (can contain anything)
  57641. var isPlainTextElement = makeMap('script,style,textarea', true);
  57642. var reCache = {};
  57643. var decodingMap = {
  57644. '&lt;': '<',
  57645. '&gt;': '>',
  57646. '&quot;': '"',
  57647. '&amp;': '&',
  57648. '&#10;': '\n',
  57649. '&#9;': '\t',
  57650. '&#39;': "'"
  57651. };
  57652. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57653. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57654. // #5992
  57655. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57656. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57657. function decodeAttr (value, shouldDecodeNewlines) {
  57658. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57659. return value.replace(re, function (match) { return decodingMap[match]; })
  57660. }
  57661. function parseHTML (html, options) {
  57662. var stack = [];
  57663. var expectHTML = options.expectHTML;
  57664. var isUnaryTag$$1 = options.isUnaryTag || no;
  57665. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57666. var index = 0;
  57667. var last, lastTag;
  57668. while (html) {
  57669. last = html;
  57670. // Make sure we're not in a plaintext content element like script/style
  57671. if (!lastTag || !isPlainTextElement(lastTag)) {
  57672. var textEnd = html.indexOf('<');
  57673. if (textEnd === 0) {
  57674. // Comment:
  57675. if (comment.test(html)) {
  57676. var commentEnd = html.indexOf('-->');
  57677. if (commentEnd >= 0) {
  57678. if (options.shouldKeepComment) {
  57679. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57680. }
  57681. advance(commentEnd + 3);
  57682. continue
  57683. }
  57684. }
  57685. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57686. if (conditionalComment.test(html)) {
  57687. var conditionalEnd = html.indexOf(']>');
  57688. if (conditionalEnd >= 0) {
  57689. advance(conditionalEnd + 2);
  57690. continue
  57691. }
  57692. }
  57693. // Doctype:
  57694. var doctypeMatch = html.match(doctype);
  57695. if (doctypeMatch) {
  57696. advance(doctypeMatch[0].length);
  57697. continue
  57698. }
  57699. // End tag:
  57700. var endTagMatch = html.match(endTag);
  57701. if (endTagMatch) {
  57702. var curIndex = index;
  57703. advance(endTagMatch[0].length);
  57704. parseEndTag(endTagMatch[1], curIndex, index);
  57705. continue
  57706. }
  57707. // Start tag:
  57708. var startTagMatch = parseStartTag();
  57709. if (startTagMatch) {
  57710. handleStartTag(startTagMatch);
  57711. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57712. advance(1);
  57713. }
  57714. continue
  57715. }
  57716. }
  57717. var text = (void 0), rest = (void 0), next = (void 0);
  57718. if (textEnd >= 0) {
  57719. rest = html.slice(textEnd);
  57720. while (
  57721. !endTag.test(rest) &&
  57722. !startTagOpen.test(rest) &&
  57723. !comment.test(rest) &&
  57724. !conditionalComment.test(rest)
  57725. ) {
  57726. // < in plain text, be forgiving and treat it as text
  57727. next = rest.indexOf('<', 1);
  57728. if (next < 0) { break }
  57729. textEnd += next;
  57730. rest = html.slice(textEnd);
  57731. }
  57732. text = html.substring(0, textEnd);
  57733. }
  57734. if (textEnd < 0) {
  57735. text = html;
  57736. }
  57737. if (text) {
  57738. advance(text.length);
  57739. }
  57740. if (options.chars && text) {
  57741. options.chars(text, index - text.length, index);
  57742. }
  57743. } else {
  57744. var endTagLength = 0;
  57745. var stackedTag = lastTag.toLowerCase();
  57746. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57747. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57748. endTagLength = endTag.length;
  57749. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57750. text = text
  57751. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57752. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57753. }
  57754. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57755. text = text.slice(1);
  57756. }
  57757. if (options.chars) {
  57758. options.chars(text);
  57759. }
  57760. return ''
  57761. });
  57762. index += html.length - rest$1.length;
  57763. html = rest$1;
  57764. parseEndTag(stackedTag, index - endTagLength, index);
  57765. }
  57766. if (html === last) {
  57767. options.chars && options.chars(html);
  57768. if (!stack.length && options.warn) {
  57769. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57770. }
  57771. break
  57772. }
  57773. }
  57774. // Clean up any remaining tags
  57775. parseEndTag();
  57776. function advance (n) {
  57777. index += n;
  57778. html = html.substring(n);
  57779. }
  57780. function parseStartTag () {
  57781. var start = html.match(startTagOpen);
  57782. if (start) {
  57783. var match = {
  57784. tagName: start[1],
  57785. attrs: [],
  57786. start: index
  57787. };
  57788. advance(start[0].length);
  57789. var end, attr;
  57790. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57791. attr.start = index;
  57792. advance(attr[0].length);
  57793. attr.end = index;
  57794. match.attrs.push(attr);
  57795. }
  57796. if (end) {
  57797. match.unarySlash = end[1];
  57798. advance(end[0].length);
  57799. match.end = index;
  57800. return match
  57801. }
  57802. }
  57803. }
  57804. function handleStartTag (match) {
  57805. var tagName = match.tagName;
  57806. var unarySlash = match.unarySlash;
  57807. if (expectHTML) {
  57808. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57809. parseEndTag(lastTag);
  57810. }
  57811. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57812. parseEndTag(tagName);
  57813. }
  57814. }
  57815. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57816. var l = match.attrs.length;
  57817. var attrs = new Array(l);
  57818. for (var i = 0; i < l; i++) {
  57819. var args = match.attrs[i];
  57820. var value = args[3] || args[4] || args[5] || '';
  57821. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57822. ? options.shouldDecodeNewlinesForHref
  57823. : options.shouldDecodeNewlines;
  57824. attrs[i] = {
  57825. name: args[1],
  57826. value: decodeAttr(value, shouldDecodeNewlines)
  57827. };
  57828. if (options.outputSourceRange) {
  57829. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57830. attrs[i].end = args.end;
  57831. }
  57832. }
  57833. if (!unary) {
  57834. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57835. lastTag = tagName;
  57836. }
  57837. if (options.start) {
  57838. options.start(tagName, attrs, unary, match.start, match.end);
  57839. }
  57840. }
  57841. function parseEndTag (tagName, start, end) {
  57842. var pos, lowerCasedTagName;
  57843. if (start == null) { start = index; }
  57844. if (end == null) { end = index; }
  57845. // Find the closest opened tag of the same type
  57846. if (tagName) {
  57847. lowerCasedTagName = tagName.toLowerCase();
  57848. for (pos = stack.length - 1; pos >= 0; pos--) {
  57849. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57850. break
  57851. }
  57852. }
  57853. } else {
  57854. // If no tag name is provided, clean shop
  57855. pos = 0;
  57856. }
  57857. if (pos >= 0) {
  57858. // Close all the open elements, up the stack
  57859. for (var i = stack.length - 1; i >= pos; i--) {
  57860. if (i > pos || !tagName &&
  57861. options.warn
  57862. ) {
  57863. options.warn(
  57864. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57865. { start: stack[i].start, end: stack[i].end }
  57866. );
  57867. }
  57868. if (options.end) {
  57869. options.end(stack[i].tag, start, end);
  57870. }
  57871. }
  57872. // Remove the open elements from the stack
  57873. stack.length = pos;
  57874. lastTag = pos && stack[pos - 1].tag;
  57875. } else if (lowerCasedTagName === 'br') {
  57876. if (options.start) {
  57877. options.start(tagName, [], true, start, end);
  57878. }
  57879. } else if (lowerCasedTagName === 'p') {
  57880. if (options.start) {
  57881. options.start(tagName, [], false, start, end);
  57882. }
  57883. if (options.end) {
  57884. options.end(tagName, start, end);
  57885. }
  57886. }
  57887. }
  57888. }
  57889. /* */
  57890. var onRE = /^@|^v-on:/;
  57891. var dirRE = /^v-|^@|^:|^#/;
  57892. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57893. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57894. var stripParensRE = /^\(|\)$/g;
  57895. var dynamicArgRE = /^\[.*\]$/;
  57896. var argRE = /:(.*)$/;
  57897. var bindRE = /^:|^\.|^v-bind:/;
  57898. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57899. var slotRE = /^v-slot(:|$)|^#/;
  57900. var lineBreakRE = /[\r\n]/;
  57901. var whitespaceRE$1 = /\s+/g;
  57902. var invalidAttributeRE = /[\s"'<>\/=]/;
  57903. var decodeHTMLCached = cached(he.decode);
  57904. var emptySlotScopeToken = "_empty_";
  57905. // configurable state
  57906. var warn$2;
  57907. var delimiters;
  57908. var transforms;
  57909. var preTransforms;
  57910. var postTransforms;
  57911. var platformIsPreTag;
  57912. var platformMustUseProp;
  57913. var platformGetTagNamespace;
  57914. var maybeComponent;
  57915. function createASTElement (
  57916. tag,
  57917. attrs,
  57918. parent
  57919. ) {
  57920. return {
  57921. type: 1,
  57922. tag: tag,
  57923. attrsList: attrs,
  57924. attrsMap: makeAttrsMap(attrs),
  57925. rawAttrsMap: {},
  57926. parent: parent,
  57927. children: []
  57928. }
  57929. }
  57930. /**
  57931. * Convert HTML string to AST.
  57932. */
  57933. function parse (
  57934. template,
  57935. options
  57936. ) {
  57937. warn$2 = options.warn || baseWarn;
  57938. platformIsPreTag = options.isPreTag || no;
  57939. platformMustUseProp = options.mustUseProp || no;
  57940. platformGetTagNamespace = options.getTagNamespace || no;
  57941. var isReservedTag = options.isReservedTag || no;
  57942. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57943. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57944. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57945. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57946. delimiters = options.delimiters;
  57947. var stack = [];
  57948. var preserveWhitespace = options.preserveWhitespace !== false;
  57949. var whitespaceOption = options.whitespace;
  57950. var root;
  57951. var currentParent;
  57952. var inVPre = false;
  57953. var inPre = false;
  57954. var warned = false;
  57955. function warnOnce (msg, range) {
  57956. if (!warned) {
  57957. warned = true;
  57958. warn$2(msg, range);
  57959. }
  57960. }
  57961. function closeElement (element) {
  57962. trimEndingWhitespace(element);
  57963. if (!inVPre && !element.processed) {
  57964. element = processElement(element, options);
  57965. }
  57966. // tree management
  57967. if (!stack.length && element !== root) {
  57968. // allow root elements with v-if, v-else-if and v-else
  57969. if (root.if && (element.elseif || element.else)) {
  57970. {
  57971. checkRootConstraints(element);
  57972. }
  57973. addIfCondition(root, {
  57974. exp: element.elseif,
  57975. block: element
  57976. });
  57977. } else {
  57978. warnOnce(
  57979. "Component template should contain exactly one root element. " +
  57980. "If you are using v-if on multiple elements, " +
  57981. "use v-else-if to chain them instead.",
  57982. { start: element.start }
  57983. );
  57984. }
  57985. }
  57986. if (currentParent && !element.forbidden) {
  57987. if (element.elseif || element.else) {
  57988. processIfConditions(element, currentParent);
  57989. } else {
  57990. if (element.slotScope) {
  57991. // scoped slot
  57992. // keep it in the children list so that v-else(-if) conditions can
  57993. // find it as the prev node.
  57994. var name = element.slotTarget || '"default"'
  57995. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  57996. }
  57997. currentParent.children.push(element);
  57998. element.parent = currentParent;
  57999. }
  58000. }
  58001. // final children cleanup
  58002. // filter out scoped slots
  58003. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  58004. // remove trailing whitespace node again
  58005. trimEndingWhitespace(element);
  58006. // check pre state
  58007. if (element.pre) {
  58008. inVPre = false;
  58009. }
  58010. if (platformIsPreTag(element.tag)) {
  58011. inPre = false;
  58012. }
  58013. // apply post-transforms
  58014. for (var i = 0; i < postTransforms.length; i++) {
  58015. postTransforms[i](element, options);
  58016. }
  58017. }
  58018. function trimEndingWhitespace (el) {
  58019. // remove trailing whitespace node
  58020. if (!inPre) {
  58021. var lastNode;
  58022. while (
  58023. (lastNode = el.children[el.children.length - 1]) &&
  58024. lastNode.type === 3 &&
  58025. lastNode.text === ' '
  58026. ) {
  58027. el.children.pop();
  58028. }
  58029. }
  58030. }
  58031. function checkRootConstraints (el) {
  58032. if (el.tag === 'slot' || el.tag === 'template') {
  58033. warnOnce(
  58034. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58035. 'contain multiple nodes.',
  58036. { start: el.start }
  58037. );
  58038. }
  58039. if (el.attrsMap.hasOwnProperty('v-for')) {
  58040. warnOnce(
  58041. 'Cannot use v-for on stateful component root element because ' +
  58042. 'it renders multiple elements.',
  58043. el.rawAttrsMap['v-for']
  58044. );
  58045. }
  58046. }
  58047. parseHTML(template, {
  58048. warn: warn$2,
  58049. expectHTML: options.expectHTML,
  58050. isUnaryTag: options.isUnaryTag,
  58051. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58052. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58053. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58054. shouldKeepComment: options.comments,
  58055. outputSourceRange: options.outputSourceRange,
  58056. start: function start (tag, attrs, unary, start$1, end) {
  58057. // check namespace.
  58058. // inherit parent ns if there is one
  58059. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58060. // handle IE svg bug
  58061. /* istanbul ignore if */
  58062. if (isIE && ns === 'svg') {
  58063. attrs = guardIESVGBug(attrs);
  58064. }
  58065. var element = createASTElement(tag, attrs, currentParent);
  58066. if (ns) {
  58067. element.ns = ns;
  58068. }
  58069. {
  58070. if (options.outputSourceRange) {
  58071. element.start = start$1;
  58072. element.end = end;
  58073. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58074. cumulated[attr.name] = attr;
  58075. return cumulated
  58076. }, {});
  58077. }
  58078. attrs.forEach(function (attr) {
  58079. if (invalidAttributeRE.test(attr.name)) {
  58080. warn$2(
  58081. "Invalid dynamic argument expression: attribute names cannot contain " +
  58082. "spaces, quotes, <, >, / or =.",
  58083. {
  58084. start: attr.start + attr.name.indexOf("["),
  58085. end: attr.start + attr.name.length
  58086. }
  58087. );
  58088. }
  58089. });
  58090. }
  58091. if (isForbiddenTag(element) && !isServerRendering()) {
  58092. element.forbidden = true;
  58093. warn$2(
  58094. 'Templates should only be responsible for mapping the state to the ' +
  58095. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58096. "<" + tag + ">" + ', as they will not be parsed.',
  58097. { start: element.start }
  58098. );
  58099. }
  58100. // apply pre-transforms
  58101. for (var i = 0; i < preTransforms.length; i++) {
  58102. element = preTransforms[i](element, options) || element;
  58103. }
  58104. if (!inVPre) {
  58105. processPre(element);
  58106. if (element.pre) {
  58107. inVPre = true;
  58108. }
  58109. }
  58110. if (platformIsPreTag(element.tag)) {
  58111. inPre = true;
  58112. }
  58113. if (inVPre) {
  58114. processRawAttrs(element);
  58115. } else if (!element.processed) {
  58116. // structural directives
  58117. processFor(element);
  58118. processIf(element);
  58119. processOnce(element);
  58120. }
  58121. if (!root) {
  58122. root = element;
  58123. {
  58124. checkRootConstraints(root);
  58125. }
  58126. }
  58127. if (!unary) {
  58128. currentParent = element;
  58129. stack.push(element);
  58130. } else {
  58131. closeElement(element);
  58132. }
  58133. },
  58134. end: function end (tag, start, end$1) {
  58135. var element = stack[stack.length - 1];
  58136. // pop stack
  58137. stack.length -= 1;
  58138. currentParent = stack[stack.length - 1];
  58139. if (options.outputSourceRange) {
  58140. element.end = end$1;
  58141. }
  58142. closeElement(element);
  58143. },
  58144. chars: function chars (text, start, end) {
  58145. if (!currentParent) {
  58146. {
  58147. if (text === template) {
  58148. warnOnce(
  58149. 'Component template requires a root element, rather than just text.',
  58150. { start: start }
  58151. );
  58152. } else if ((text = text.trim())) {
  58153. warnOnce(
  58154. ("text \"" + text + "\" outside root element will be ignored."),
  58155. { start: start }
  58156. );
  58157. }
  58158. }
  58159. return
  58160. }
  58161. // IE textarea placeholder bug
  58162. /* istanbul ignore if */
  58163. if (isIE &&
  58164. currentParent.tag === 'textarea' &&
  58165. currentParent.attrsMap.placeholder === text
  58166. ) {
  58167. return
  58168. }
  58169. var children = currentParent.children;
  58170. if (inPre || text.trim()) {
  58171. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58172. } else if (!children.length) {
  58173. // remove the whitespace-only node right after an opening tag
  58174. text = '';
  58175. } else if (whitespaceOption) {
  58176. if (whitespaceOption === 'condense') {
  58177. // in condense mode, remove the whitespace node if it contains
  58178. // line break, otherwise condense to a single space
  58179. text = lineBreakRE.test(text) ? '' : ' ';
  58180. } else {
  58181. text = ' ';
  58182. }
  58183. } else {
  58184. text = preserveWhitespace ? ' ' : '';
  58185. }
  58186. if (text) {
  58187. if (!inPre && whitespaceOption === 'condense') {
  58188. // condense consecutive whitespaces into single space
  58189. text = text.replace(whitespaceRE$1, ' ');
  58190. }
  58191. var res;
  58192. var child;
  58193. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58194. child = {
  58195. type: 2,
  58196. expression: res.expression,
  58197. tokens: res.tokens,
  58198. text: text
  58199. };
  58200. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58201. child = {
  58202. type: 3,
  58203. text: text
  58204. };
  58205. }
  58206. if (child) {
  58207. if (options.outputSourceRange) {
  58208. child.start = start;
  58209. child.end = end;
  58210. }
  58211. children.push(child);
  58212. }
  58213. }
  58214. },
  58215. comment: function comment (text, start, end) {
  58216. // adding anyting as a sibling to the root node is forbidden
  58217. // comments should still be allowed, but ignored
  58218. if (currentParent) {
  58219. var child = {
  58220. type: 3,
  58221. text: text,
  58222. isComment: true
  58223. };
  58224. if (options.outputSourceRange) {
  58225. child.start = start;
  58226. child.end = end;
  58227. }
  58228. currentParent.children.push(child);
  58229. }
  58230. }
  58231. });
  58232. return root
  58233. }
  58234. function processPre (el) {
  58235. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58236. el.pre = true;
  58237. }
  58238. }
  58239. function processRawAttrs (el) {
  58240. var list = el.attrsList;
  58241. var len = list.length;
  58242. if (len) {
  58243. var attrs = el.attrs = new Array(len);
  58244. for (var i = 0; i < len; i++) {
  58245. attrs[i] = {
  58246. name: list[i].name,
  58247. value: JSON.stringify(list[i].value)
  58248. };
  58249. if (list[i].start != null) {
  58250. attrs[i].start = list[i].start;
  58251. attrs[i].end = list[i].end;
  58252. }
  58253. }
  58254. } else if (!el.pre) {
  58255. // non root node in pre blocks with no attributes
  58256. el.plain = true;
  58257. }
  58258. }
  58259. function processElement (
  58260. element,
  58261. options
  58262. ) {
  58263. processKey(element);
  58264. // determine whether this is a plain element after
  58265. // removing structural attributes
  58266. element.plain = (
  58267. !element.key &&
  58268. !element.scopedSlots &&
  58269. !element.attrsList.length
  58270. );
  58271. processRef(element);
  58272. processSlotContent(element);
  58273. processSlotOutlet(element);
  58274. processComponent(element);
  58275. for (var i = 0; i < transforms.length; i++) {
  58276. element = transforms[i](element, options) || element;
  58277. }
  58278. processAttrs(element);
  58279. return element
  58280. }
  58281. function processKey (el) {
  58282. var exp = getBindingAttr(el, 'key');
  58283. if (exp) {
  58284. {
  58285. if (el.tag === 'template') {
  58286. warn$2(
  58287. "<template> cannot be keyed. Place the key on real elements instead.",
  58288. getRawBindingAttr(el, 'key')
  58289. );
  58290. }
  58291. if (el.for) {
  58292. var iterator = el.iterator2 || el.iterator1;
  58293. var parent = el.parent;
  58294. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58295. warn$2(
  58296. "Do not use v-for index as key on <transition-group> children, " +
  58297. "this is the same as not using keys.",
  58298. getRawBindingAttr(el, 'key'),
  58299. true /* tip */
  58300. );
  58301. }
  58302. }
  58303. }
  58304. el.key = exp;
  58305. }
  58306. }
  58307. function processRef (el) {
  58308. var ref = getBindingAttr(el, 'ref');
  58309. if (ref) {
  58310. el.ref = ref;
  58311. el.refInFor = checkInFor(el);
  58312. }
  58313. }
  58314. function processFor (el) {
  58315. var exp;
  58316. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58317. var res = parseFor(exp);
  58318. if (res) {
  58319. extend(el, res);
  58320. } else {
  58321. warn$2(
  58322. ("Invalid v-for expression: " + exp),
  58323. el.rawAttrsMap['v-for']
  58324. );
  58325. }
  58326. }
  58327. }
  58328. function parseFor (exp) {
  58329. var inMatch = exp.match(forAliasRE);
  58330. if (!inMatch) { return }
  58331. var res = {};
  58332. res.for = inMatch[2].trim();
  58333. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58334. var iteratorMatch = alias.match(forIteratorRE);
  58335. if (iteratorMatch) {
  58336. res.alias = alias.replace(forIteratorRE, '').trim();
  58337. res.iterator1 = iteratorMatch[1].trim();
  58338. if (iteratorMatch[2]) {
  58339. res.iterator2 = iteratorMatch[2].trim();
  58340. }
  58341. } else {
  58342. res.alias = alias;
  58343. }
  58344. return res
  58345. }
  58346. function processIf (el) {
  58347. var exp = getAndRemoveAttr(el, 'v-if');
  58348. if (exp) {
  58349. el.if = exp;
  58350. addIfCondition(el, {
  58351. exp: exp,
  58352. block: el
  58353. });
  58354. } else {
  58355. if (getAndRemoveAttr(el, 'v-else') != null) {
  58356. el.else = true;
  58357. }
  58358. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58359. if (elseif) {
  58360. el.elseif = elseif;
  58361. }
  58362. }
  58363. }
  58364. function processIfConditions (el, parent) {
  58365. var prev = findPrevElement(parent.children);
  58366. if (prev && prev.if) {
  58367. addIfCondition(prev, {
  58368. exp: el.elseif,
  58369. block: el
  58370. });
  58371. } else {
  58372. warn$2(
  58373. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58374. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58375. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58376. );
  58377. }
  58378. }
  58379. function findPrevElement (children) {
  58380. var i = children.length;
  58381. while (i--) {
  58382. if (children[i].type === 1) {
  58383. return children[i]
  58384. } else {
  58385. if (children[i].text !== ' ') {
  58386. warn$2(
  58387. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58388. "will be ignored.",
  58389. children[i]
  58390. );
  58391. }
  58392. children.pop();
  58393. }
  58394. }
  58395. }
  58396. function addIfCondition (el, condition) {
  58397. if (!el.ifConditions) {
  58398. el.ifConditions = [];
  58399. }
  58400. el.ifConditions.push(condition);
  58401. }
  58402. function processOnce (el) {
  58403. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58404. if (once$$1 != null) {
  58405. el.once = true;
  58406. }
  58407. }
  58408. // handle content being passed to a component as slot,
  58409. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58410. function processSlotContent (el) {
  58411. var slotScope;
  58412. if (el.tag === 'template') {
  58413. slotScope = getAndRemoveAttr(el, 'scope');
  58414. /* istanbul ignore if */
  58415. if (slotScope) {
  58416. warn$2(
  58417. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58418. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58419. "can also be used on plain elements in addition to <template> to " +
  58420. "denote scoped slots.",
  58421. el.rawAttrsMap['scope'],
  58422. true
  58423. );
  58424. }
  58425. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58426. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58427. /* istanbul ignore if */
  58428. if (el.attrsMap['v-for']) {
  58429. warn$2(
  58430. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58431. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58432. "scoped slot to make it clearer.",
  58433. el.rawAttrsMap['slot-scope'],
  58434. true
  58435. );
  58436. }
  58437. el.slotScope = slotScope;
  58438. }
  58439. // slot="xxx"
  58440. var slotTarget = getBindingAttr(el, 'slot');
  58441. if (slotTarget) {
  58442. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58443. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58444. // preserve slot as an attribute for native shadow DOM compat
  58445. // only for non-scoped slots.
  58446. if (el.tag !== 'template' && !el.slotScope) {
  58447. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58448. }
  58449. }
  58450. // 2.6 v-slot syntax
  58451. {
  58452. if (el.tag === 'template') {
  58453. // v-slot on <template>
  58454. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58455. if (slotBinding) {
  58456. {
  58457. if (el.slotTarget || el.slotScope) {
  58458. warn$2(
  58459. "Unexpected mixed usage of different slot syntaxes.",
  58460. el
  58461. );
  58462. }
  58463. if (el.parent && !maybeComponent(el.parent)) {
  58464. warn$2(
  58465. "<template v-slot> can only appear at the root level inside " +
  58466. "the receiving component",
  58467. el
  58468. );
  58469. }
  58470. }
  58471. var ref = getSlotName(slotBinding);
  58472. var name = ref.name;
  58473. var dynamic = ref.dynamic;
  58474. el.slotTarget = name;
  58475. el.slotTargetDynamic = dynamic;
  58476. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58477. }
  58478. } else {
  58479. // v-slot on component, denotes default slot
  58480. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58481. if (slotBinding$1) {
  58482. {
  58483. if (!maybeComponent(el)) {
  58484. warn$2(
  58485. "v-slot can only be used on components or <template>.",
  58486. slotBinding$1
  58487. );
  58488. }
  58489. if (el.slotScope || el.slotTarget) {
  58490. warn$2(
  58491. "Unexpected mixed usage of different slot syntaxes.",
  58492. el
  58493. );
  58494. }
  58495. if (el.scopedSlots) {
  58496. warn$2(
  58497. "To avoid scope ambiguity, the default slot should also use " +
  58498. "<template> syntax when there are other named slots.",
  58499. slotBinding$1
  58500. );
  58501. }
  58502. }
  58503. // add the component's children to its default slot
  58504. var slots = el.scopedSlots || (el.scopedSlots = {});
  58505. var ref$1 = getSlotName(slotBinding$1);
  58506. var name$1 = ref$1.name;
  58507. var dynamic$1 = ref$1.dynamic;
  58508. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58509. slotContainer.slotTarget = name$1;
  58510. slotContainer.slotTargetDynamic = dynamic$1;
  58511. slotContainer.children = el.children.filter(function (c) {
  58512. if (!c.slotScope) {
  58513. c.parent = slotContainer;
  58514. return true
  58515. }
  58516. });
  58517. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58518. // remove children as they are returned from scopedSlots now
  58519. el.children = [];
  58520. // mark el non-plain so data gets generated
  58521. el.plain = false;
  58522. }
  58523. }
  58524. }
  58525. }
  58526. function getSlotName (binding) {
  58527. var name = binding.name.replace(slotRE, '');
  58528. if (!name) {
  58529. if (binding.name[0] !== '#') {
  58530. name = 'default';
  58531. } else {
  58532. warn$2(
  58533. "v-slot shorthand syntax requires a slot name.",
  58534. binding
  58535. );
  58536. }
  58537. }
  58538. return dynamicArgRE.test(name)
  58539. // dynamic [name]
  58540. ? { name: name.slice(1, -1), dynamic: true }
  58541. // static name
  58542. : { name: ("\"" + name + "\""), dynamic: false }
  58543. }
  58544. // handle <slot/> outlets
  58545. function processSlotOutlet (el) {
  58546. if (el.tag === 'slot') {
  58547. el.slotName = getBindingAttr(el, 'name');
  58548. if (el.key) {
  58549. warn$2(
  58550. "`key` does not work on <slot> because slots are abstract outlets " +
  58551. "and can possibly expand into multiple elements. " +
  58552. "Use the key on a wrapping element instead.",
  58553. getRawBindingAttr(el, 'key')
  58554. );
  58555. }
  58556. }
  58557. }
  58558. function processComponent (el) {
  58559. var binding;
  58560. if ((binding = getBindingAttr(el, 'is'))) {
  58561. el.component = binding;
  58562. }
  58563. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58564. el.inlineTemplate = true;
  58565. }
  58566. }
  58567. function processAttrs (el) {
  58568. var list = el.attrsList;
  58569. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58570. for (i = 0, l = list.length; i < l; i++) {
  58571. name = rawName = list[i].name;
  58572. value = list[i].value;
  58573. if (dirRE.test(name)) {
  58574. // mark element as dynamic
  58575. el.hasBindings = true;
  58576. // modifiers
  58577. modifiers = parseModifiers(name.replace(dirRE, ''));
  58578. // support .foo shorthand syntax for the .prop modifier
  58579. if (modifiers) {
  58580. name = name.replace(modifierRE, '');
  58581. }
  58582. if (bindRE.test(name)) { // v-bind
  58583. name = name.replace(bindRE, '');
  58584. value = parseFilters(value);
  58585. isDynamic = dynamicArgRE.test(name);
  58586. if (isDynamic) {
  58587. name = name.slice(1, -1);
  58588. }
  58589. if (
  58590. value.trim().length === 0
  58591. ) {
  58592. warn$2(
  58593. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58594. );
  58595. }
  58596. if (modifiers) {
  58597. if (modifiers.prop && !isDynamic) {
  58598. name = camelize(name);
  58599. if (name === 'innerHtml') { name = 'innerHTML'; }
  58600. }
  58601. if (modifiers.camel && !isDynamic) {
  58602. name = camelize(name);
  58603. }
  58604. if (modifiers.sync) {
  58605. syncGen = genAssignmentCode(value, "$event");
  58606. if (!isDynamic) {
  58607. addHandler(
  58608. el,
  58609. ("update:" + (camelize(name))),
  58610. syncGen,
  58611. null,
  58612. false,
  58613. warn$2,
  58614. list[i]
  58615. );
  58616. if (hyphenate(name) !== camelize(name)) {
  58617. addHandler(
  58618. el,
  58619. ("update:" + (hyphenate(name))),
  58620. syncGen,
  58621. null,
  58622. false,
  58623. warn$2,
  58624. list[i]
  58625. );
  58626. }
  58627. } else {
  58628. // handler w/ dynamic event name
  58629. addHandler(
  58630. el,
  58631. ("\"update:\"+(" + name + ")"),
  58632. syncGen,
  58633. null,
  58634. false,
  58635. warn$2,
  58636. list[i],
  58637. true // dynamic
  58638. );
  58639. }
  58640. }
  58641. }
  58642. if ((modifiers && modifiers.prop) || (
  58643. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58644. )) {
  58645. addProp(el, name, value, list[i], isDynamic);
  58646. } else {
  58647. addAttr(el, name, value, list[i], isDynamic);
  58648. }
  58649. } else if (onRE.test(name)) { // v-on
  58650. name = name.replace(onRE, '');
  58651. isDynamic = dynamicArgRE.test(name);
  58652. if (isDynamic) {
  58653. name = name.slice(1, -1);
  58654. }
  58655. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58656. } else { // normal directives
  58657. name = name.replace(dirRE, '');
  58658. // parse arg
  58659. var argMatch = name.match(argRE);
  58660. var arg = argMatch && argMatch[1];
  58661. isDynamic = false;
  58662. if (arg) {
  58663. name = name.slice(0, -(arg.length + 1));
  58664. if (dynamicArgRE.test(arg)) {
  58665. arg = arg.slice(1, -1);
  58666. isDynamic = true;
  58667. }
  58668. }
  58669. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58670. if (name === 'model') {
  58671. checkForAliasModel(el, value);
  58672. }
  58673. }
  58674. } else {
  58675. // literal attribute
  58676. {
  58677. var res = parseText(value, delimiters);
  58678. if (res) {
  58679. warn$2(
  58680. name + "=\"" + value + "\": " +
  58681. 'Interpolation inside attributes has been removed. ' +
  58682. 'Use v-bind or the colon shorthand instead. For example, ' +
  58683. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58684. list[i]
  58685. );
  58686. }
  58687. }
  58688. addAttr(el, name, JSON.stringify(value), list[i]);
  58689. // #6887 firefox doesn't update muted state if set via attribute
  58690. // even immediately after element creation
  58691. if (!el.component &&
  58692. name === 'muted' &&
  58693. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58694. addProp(el, name, 'true', list[i]);
  58695. }
  58696. }
  58697. }
  58698. }
  58699. function checkInFor (el) {
  58700. var parent = el;
  58701. while (parent) {
  58702. if (parent.for !== undefined) {
  58703. return true
  58704. }
  58705. parent = parent.parent;
  58706. }
  58707. return false
  58708. }
  58709. function parseModifiers (name) {
  58710. var match = name.match(modifierRE);
  58711. if (match) {
  58712. var ret = {};
  58713. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58714. return ret
  58715. }
  58716. }
  58717. function makeAttrsMap (attrs) {
  58718. var map = {};
  58719. for (var i = 0, l = attrs.length; i < l; i++) {
  58720. if (
  58721. map[attrs[i].name] && !isIE && !isEdge
  58722. ) {
  58723. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58724. }
  58725. map[attrs[i].name] = attrs[i].value;
  58726. }
  58727. return map
  58728. }
  58729. // for script (e.g. type="x/template") or style, do not decode content
  58730. function isTextTag (el) {
  58731. return el.tag === 'script' || el.tag === 'style'
  58732. }
  58733. function isForbiddenTag (el) {
  58734. return (
  58735. el.tag === 'style' ||
  58736. (el.tag === 'script' && (
  58737. !el.attrsMap.type ||
  58738. el.attrsMap.type === 'text/javascript'
  58739. ))
  58740. )
  58741. }
  58742. var ieNSBug = /^xmlns:NS\d+/;
  58743. var ieNSPrefix = /^NS\d+:/;
  58744. /* istanbul ignore next */
  58745. function guardIESVGBug (attrs) {
  58746. var res = [];
  58747. for (var i = 0; i < attrs.length; i++) {
  58748. var attr = attrs[i];
  58749. if (!ieNSBug.test(attr.name)) {
  58750. attr.name = attr.name.replace(ieNSPrefix, '');
  58751. res.push(attr);
  58752. }
  58753. }
  58754. return res
  58755. }
  58756. function checkForAliasModel (el, value) {
  58757. var _el = el;
  58758. while (_el) {
  58759. if (_el.for && _el.alias === value) {
  58760. warn$2(
  58761. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58762. "You are binding v-model directly to a v-for iteration alias. " +
  58763. "This will not be able to modify the v-for source array because " +
  58764. "writing to the alias is like modifying a function local variable. " +
  58765. "Consider using an array of objects and use v-model on an object property instead.",
  58766. el.rawAttrsMap['v-model']
  58767. );
  58768. }
  58769. _el = _el.parent;
  58770. }
  58771. }
  58772. /* */
  58773. function preTransformNode (el, options) {
  58774. if (el.tag === 'input') {
  58775. var map = el.attrsMap;
  58776. if (!map['v-model']) {
  58777. return
  58778. }
  58779. var typeBinding;
  58780. if (map[':type'] || map['v-bind:type']) {
  58781. typeBinding = getBindingAttr(el, 'type');
  58782. }
  58783. if (!map.type && !typeBinding && map['v-bind']) {
  58784. typeBinding = "(" + (map['v-bind']) + ").type";
  58785. }
  58786. if (typeBinding) {
  58787. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58788. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58789. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58790. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58791. // 1. checkbox
  58792. var branch0 = cloneASTElement(el);
  58793. // process for on the main node
  58794. processFor(branch0);
  58795. addRawAttr(branch0, 'type', 'checkbox');
  58796. processElement(branch0, options);
  58797. branch0.processed = true; // prevent it from double-processed
  58798. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58799. addIfCondition(branch0, {
  58800. exp: branch0.if,
  58801. block: branch0
  58802. });
  58803. // 2. add radio else-if condition
  58804. var branch1 = cloneASTElement(el);
  58805. getAndRemoveAttr(branch1, 'v-for', true);
  58806. addRawAttr(branch1, 'type', 'radio');
  58807. processElement(branch1, options);
  58808. addIfCondition(branch0, {
  58809. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58810. block: branch1
  58811. });
  58812. // 3. other
  58813. var branch2 = cloneASTElement(el);
  58814. getAndRemoveAttr(branch2, 'v-for', true);
  58815. addRawAttr(branch2, ':type', typeBinding);
  58816. processElement(branch2, options);
  58817. addIfCondition(branch0, {
  58818. exp: ifCondition,
  58819. block: branch2
  58820. });
  58821. if (hasElse) {
  58822. branch0.else = true;
  58823. } else if (elseIfCondition) {
  58824. branch0.elseif = elseIfCondition;
  58825. }
  58826. return branch0
  58827. }
  58828. }
  58829. }
  58830. function cloneASTElement (el) {
  58831. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58832. }
  58833. var model$1 = {
  58834. preTransformNode: preTransformNode
  58835. };
  58836. var modules$1 = [
  58837. klass$1,
  58838. style$1,
  58839. model$1
  58840. ];
  58841. /* */
  58842. function text (el, dir) {
  58843. if (dir.value) {
  58844. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58845. }
  58846. }
  58847. /* */
  58848. function html (el, dir) {
  58849. if (dir.value) {
  58850. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58851. }
  58852. }
  58853. var directives$1 = {
  58854. model: model,
  58855. text: text,
  58856. html: html
  58857. };
  58858. /* */
  58859. var baseOptions = {
  58860. expectHTML: true,
  58861. modules: modules$1,
  58862. directives: directives$1,
  58863. isPreTag: isPreTag,
  58864. isUnaryTag: isUnaryTag,
  58865. mustUseProp: mustUseProp,
  58866. canBeLeftOpenTag: canBeLeftOpenTag,
  58867. isReservedTag: isReservedTag,
  58868. getTagNamespace: getTagNamespace,
  58869. staticKeys: genStaticKeys(modules$1)
  58870. };
  58871. /* */
  58872. var isStaticKey;
  58873. var isPlatformReservedTag;
  58874. var genStaticKeysCached = cached(genStaticKeys$1);
  58875. /**
  58876. * Goal of the optimizer: walk the generated template AST tree
  58877. * and detect sub-trees that are purely static, i.e. parts of
  58878. * the DOM that never needs to change.
  58879. *
  58880. * Once we detect these sub-trees, we can:
  58881. *
  58882. * 1. Hoist them into constants, so that we no longer need to
  58883. * create fresh nodes for them on each re-render;
  58884. * 2. Completely skip them in the patching process.
  58885. */
  58886. function optimize (root, options) {
  58887. if (!root) { return }
  58888. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58889. isPlatformReservedTag = options.isReservedTag || no;
  58890. // first pass: mark all non-static nodes.
  58891. markStatic$1(root);
  58892. // second pass: mark static roots.
  58893. markStaticRoots(root, false);
  58894. }
  58895. function genStaticKeys$1 (keys) {
  58896. return makeMap(
  58897. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58898. (keys ? ',' + keys : '')
  58899. )
  58900. }
  58901. function markStatic$1 (node) {
  58902. node.static = isStatic(node);
  58903. if (node.type === 1) {
  58904. // do not make component slot content static. this avoids
  58905. // 1. components not able to mutate slot nodes
  58906. // 2. static slot content fails for hot-reloading
  58907. if (
  58908. !isPlatformReservedTag(node.tag) &&
  58909. node.tag !== 'slot' &&
  58910. node.attrsMap['inline-template'] == null
  58911. ) {
  58912. return
  58913. }
  58914. for (var i = 0, l = node.children.length; i < l; i++) {
  58915. var child = node.children[i];
  58916. markStatic$1(child);
  58917. if (!child.static) {
  58918. node.static = false;
  58919. }
  58920. }
  58921. if (node.ifConditions) {
  58922. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58923. var block = node.ifConditions[i$1].block;
  58924. markStatic$1(block);
  58925. if (!block.static) {
  58926. node.static = false;
  58927. }
  58928. }
  58929. }
  58930. }
  58931. }
  58932. function markStaticRoots (node, isInFor) {
  58933. if (node.type === 1) {
  58934. if (node.static || node.once) {
  58935. node.staticInFor = isInFor;
  58936. }
  58937. // For a node to qualify as a static root, it should have children that
  58938. // are not just static text. Otherwise the cost of hoisting out will
  58939. // outweigh the benefits and it's better off to just always render it fresh.
  58940. if (node.static && node.children.length && !(
  58941. node.children.length === 1 &&
  58942. node.children[0].type === 3
  58943. )) {
  58944. node.staticRoot = true;
  58945. return
  58946. } else {
  58947. node.staticRoot = false;
  58948. }
  58949. if (node.children) {
  58950. for (var i = 0, l = node.children.length; i < l; i++) {
  58951. markStaticRoots(node.children[i], isInFor || !!node.for);
  58952. }
  58953. }
  58954. if (node.ifConditions) {
  58955. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58956. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58957. }
  58958. }
  58959. }
  58960. }
  58961. function isStatic (node) {
  58962. if (node.type === 2) { // expression
  58963. return false
  58964. }
  58965. if (node.type === 3) { // text
  58966. return true
  58967. }
  58968. return !!(node.pre || (
  58969. !node.hasBindings && // no dynamic bindings
  58970. !node.if && !node.for && // not v-if or v-for or v-else
  58971. !isBuiltInTag(node.tag) && // not a built-in
  58972. isPlatformReservedTag(node.tag) && // not a component
  58973. !isDirectChildOfTemplateFor(node) &&
  58974. Object.keys(node).every(isStaticKey)
  58975. ))
  58976. }
  58977. function isDirectChildOfTemplateFor (node) {
  58978. while (node.parent) {
  58979. node = node.parent;
  58980. if (node.tag !== 'template') {
  58981. return false
  58982. }
  58983. if (node.for) {
  58984. return true
  58985. }
  58986. }
  58987. return false
  58988. }
  58989. /* */
  58990. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  58991. var fnInvokeRE = /\([^)]*?\);*$/;
  58992. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  58993. // KeyboardEvent.keyCode aliases
  58994. var keyCodes = {
  58995. esc: 27,
  58996. tab: 9,
  58997. enter: 13,
  58998. space: 32,
  58999. up: 38,
  59000. left: 37,
  59001. right: 39,
  59002. down: 40,
  59003. 'delete': [8, 46]
  59004. };
  59005. // KeyboardEvent.key aliases
  59006. var keyNames = {
  59007. // #7880: IE11 and Edge use `Esc` for Escape key name.
  59008. esc: ['Esc', 'Escape'],
  59009. tab: 'Tab',
  59010. enter: 'Enter',
  59011. // #9112: IE11 uses `Spacebar` for Space key name.
  59012. space: [' ', 'Spacebar'],
  59013. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  59014. up: ['Up', 'ArrowUp'],
  59015. left: ['Left', 'ArrowLeft'],
  59016. right: ['Right', 'ArrowRight'],
  59017. down: ['Down', 'ArrowDown'],
  59018. // #9112: IE11 uses `Del` for Delete key name.
  59019. 'delete': ['Backspace', 'Delete', 'Del']
  59020. };
  59021. // #4868: modifiers that prevent the execution of the listener
  59022. // need to explicitly return null so that we can determine whether to remove
  59023. // the listener for .once
  59024. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59025. var modifierCode = {
  59026. stop: '$event.stopPropagation();',
  59027. prevent: '$event.preventDefault();',
  59028. self: genGuard("$event.target !== $event.currentTarget"),
  59029. ctrl: genGuard("!$event.ctrlKey"),
  59030. shift: genGuard("!$event.shiftKey"),
  59031. alt: genGuard("!$event.altKey"),
  59032. meta: genGuard("!$event.metaKey"),
  59033. left: genGuard("'button' in $event && $event.button !== 0"),
  59034. middle: genGuard("'button' in $event && $event.button !== 1"),
  59035. right: genGuard("'button' in $event && $event.button !== 2")
  59036. };
  59037. function genHandlers (
  59038. events,
  59039. isNative
  59040. ) {
  59041. var prefix = isNative ? 'nativeOn:' : 'on:';
  59042. var staticHandlers = "";
  59043. var dynamicHandlers = "";
  59044. for (var name in events) {
  59045. var handlerCode = genHandler(events[name]);
  59046. if (events[name] && events[name].dynamic) {
  59047. dynamicHandlers += name + "," + handlerCode + ",";
  59048. } else {
  59049. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59050. }
  59051. }
  59052. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59053. if (dynamicHandlers) {
  59054. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59055. } else {
  59056. return prefix + staticHandlers
  59057. }
  59058. }
  59059. function genHandler (handler) {
  59060. if (!handler) {
  59061. return 'function(){}'
  59062. }
  59063. if (Array.isArray(handler)) {
  59064. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59065. }
  59066. var isMethodPath = simplePathRE.test(handler.value);
  59067. var isFunctionExpression = fnExpRE.test(handler.value);
  59068. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59069. if (!handler.modifiers) {
  59070. if (isMethodPath || isFunctionExpression) {
  59071. return handler.value
  59072. }
  59073. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59074. } else {
  59075. var code = '';
  59076. var genModifierCode = '';
  59077. var keys = [];
  59078. for (var key in handler.modifiers) {
  59079. if (modifierCode[key]) {
  59080. genModifierCode += modifierCode[key];
  59081. // left/right
  59082. if (keyCodes[key]) {
  59083. keys.push(key);
  59084. }
  59085. } else if (key === 'exact') {
  59086. var modifiers = (handler.modifiers);
  59087. genModifierCode += genGuard(
  59088. ['ctrl', 'shift', 'alt', 'meta']
  59089. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59090. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59091. .join('||')
  59092. );
  59093. } else {
  59094. keys.push(key);
  59095. }
  59096. }
  59097. if (keys.length) {
  59098. code += genKeyFilter(keys);
  59099. }
  59100. // Make sure modifiers like prevent and stop get executed after key filtering
  59101. if (genModifierCode) {
  59102. code += genModifierCode;
  59103. }
  59104. var handlerCode = isMethodPath
  59105. ? ("return " + (handler.value) + "($event)")
  59106. : isFunctionExpression
  59107. ? ("return (" + (handler.value) + ")($event)")
  59108. : isFunctionInvocation
  59109. ? ("return " + (handler.value))
  59110. : handler.value;
  59111. return ("function($event){" + code + handlerCode + "}")
  59112. }
  59113. }
  59114. function genKeyFilter (keys) {
  59115. return (
  59116. // make sure the key filters only apply to KeyboardEvents
  59117. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59118. // key events that do not have keyCode property...
  59119. "if(!$event.type.indexOf('key')&&" +
  59120. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59121. )
  59122. }
  59123. function genFilterCode (key) {
  59124. var keyVal = parseInt(key, 10);
  59125. if (keyVal) {
  59126. return ("$event.keyCode!==" + keyVal)
  59127. }
  59128. var keyCode = keyCodes[key];
  59129. var keyName = keyNames[key];
  59130. return (
  59131. "_k($event.keyCode," +
  59132. (JSON.stringify(key)) + "," +
  59133. (JSON.stringify(keyCode)) + "," +
  59134. "$event.key," +
  59135. "" + (JSON.stringify(keyName)) +
  59136. ")"
  59137. )
  59138. }
  59139. /* */
  59140. function on (el, dir) {
  59141. if (dir.modifiers) {
  59142. warn("v-on without argument does not support modifiers.");
  59143. }
  59144. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59145. }
  59146. /* */
  59147. function bind$1 (el, dir) {
  59148. el.wrapData = function (code) {
  59149. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59150. };
  59151. }
  59152. /* */
  59153. var baseDirectives = {
  59154. on: on,
  59155. bind: bind$1,
  59156. cloak: noop
  59157. };
  59158. /* */
  59159. var CodegenState = function CodegenState (options) {
  59160. this.options = options;
  59161. this.warn = options.warn || baseWarn;
  59162. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59163. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59164. this.directives = extend(extend({}, baseDirectives), options.directives);
  59165. var isReservedTag = options.isReservedTag || no;
  59166. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59167. this.onceId = 0;
  59168. this.staticRenderFns = [];
  59169. this.pre = false;
  59170. };
  59171. function generate (
  59172. ast,
  59173. options
  59174. ) {
  59175. var state = new CodegenState(options);
  59176. var code = ast ? genElement(ast, state) : '_c("div")';
  59177. return {
  59178. render: ("with(this){return " + code + "}"),
  59179. staticRenderFns: state.staticRenderFns
  59180. }
  59181. }
  59182. function genElement (el, state) {
  59183. if (el.parent) {
  59184. el.pre = el.pre || el.parent.pre;
  59185. }
  59186. if (el.staticRoot && !el.staticProcessed) {
  59187. return genStatic(el, state)
  59188. } else if (el.once && !el.onceProcessed) {
  59189. return genOnce(el, state)
  59190. } else if (el.for && !el.forProcessed) {
  59191. return genFor(el, state)
  59192. } else if (el.if && !el.ifProcessed) {
  59193. return genIf(el, state)
  59194. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59195. return genChildren(el, state) || 'void 0'
  59196. } else if (el.tag === 'slot') {
  59197. return genSlot(el, state)
  59198. } else {
  59199. // component or element
  59200. var code;
  59201. if (el.component) {
  59202. code = genComponent(el.component, el, state);
  59203. } else {
  59204. var data;
  59205. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59206. data = genData$2(el, state);
  59207. }
  59208. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59209. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59210. }
  59211. // module transforms
  59212. for (var i = 0; i < state.transforms.length; i++) {
  59213. code = state.transforms[i](el, code);
  59214. }
  59215. return code
  59216. }
  59217. }
  59218. // hoist static sub-trees out
  59219. function genStatic (el, state) {
  59220. el.staticProcessed = true;
  59221. // Some elements (templates) need to behave differently inside of a v-pre
  59222. // node. All pre nodes are static roots, so we can use this as a location to
  59223. // wrap a state change and reset it upon exiting the pre node.
  59224. var originalPreState = state.pre;
  59225. if (el.pre) {
  59226. state.pre = el.pre;
  59227. }
  59228. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59229. state.pre = originalPreState;
  59230. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59231. }
  59232. // v-once
  59233. function genOnce (el, state) {
  59234. el.onceProcessed = true;
  59235. if (el.if && !el.ifProcessed) {
  59236. return genIf(el, state)
  59237. } else if (el.staticInFor) {
  59238. var key = '';
  59239. var parent = el.parent;
  59240. while (parent) {
  59241. if (parent.for) {
  59242. key = parent.key;
  59243. break
  59244. }
  59245. parent = parent.parent;
  59246. }
  59247. if (!key) {
  59248. state.warn(
  59249. "v-once can only be used inside v-for that is keyed. ",
  59250. el.rawAttrsMap['v-once']
  59251. );
  59252. return genElement(el, state)
  59253. }
  59254. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59255. } else {
  59256. return genStatic(el, state)
  59257. }
  59258. }
  59259. function genIf (
  59260. el,
  59261. state,
  59262. altGen,
  59263. altEmpty
  59264. ) {
  59265. el.ifProcessed = true; // avoid recursion
  59266. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59267. }
  59268. function genIfConditions (
  59269. conditions,
  59270. state,
  59271. altGen,
  59272. altEmpty
  59273. ) {
  59274. if (!conditions.length) {
  59275. return altEmpty || '_e()'
  59276. }
  59277. var condition = conditions.shift();
  59278. if (condition.exp) {
  59279. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59280. } else {
  59281. return ("" + (genTernaryExp(condition.block)))
  59282. }
  59283. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59284. function genTernaryExp (el) {
  59285. return altGen
  59286. ? altGen(el, state)
  59287. : el.once
  59288. ? genOnce(el, state)
  59289. : genElement(el, state)
  59290. }
  59291. }
  59292. function genFor (
  59293. el,
  59294. state,
  59295. altGen,
  59296. altHelper
  59297. ) {
  59298. var exp = el.for;
  59299. var alias = el.alias;
  59300. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59301. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59302. if (state.maybeComponent(el) &&
  59303. el.tag !== 'slot' &&
  59304. el.tag !== 'template' &&
  59305. !el.key
  59306. ) {
  59307. state.warn(
  59308. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59309. "v-for should have explicit keys. " +
  59310. "See https://vuejs.org/guide/list.html#key for more info.",
  59311. el.rawAttrsMap['v-for'],
  59312. true /* tip */
  59313. );
  59314. }
  59315. el.forProcessed = true; // avoid recursion
  59316. return (altHelper || '_l') + "((" + exp + ")," +
  59317. "function(" + alias + iterator1 + iterator2 + "){" +
  59318. "return " + ((altGen || genElement)(el, state)) +
  59319. '})'
  59320. }
  59321. function genData$2 (el, state) {
  59322. var data = '{';
  59323. // directives first.
  59324. // directives may mutate the el's other properties before they are generated.
  59325. var dirs = genDirectives(el, state);
  59326. if (dirs) { data += dirs + ','; }
  59327. // key
  59328. if (el.key) {
  59329. data += "key:" + (el.key) + ",";
  59330. }
  59331. // ref
  59332. if (el.ref) {
  59333. data += "ref:" + (el.ref) + ",";
  59334. }
  59335. if (el.refInFor) {
  59336. data += "refInFor:true,";
  59337. }
  59338. // pre
  59339. if (el.pre) {
  59340. data += "pre:true,";
  59341. }
  59342. // record original tag name for components using "is" attribute
  59343. if (el.component) {
  59344. data += "tag:\"" + (el.tag) + "\",";
  59345. }
  59346. // module data generation functions
  59347. for (var i = 0; i < state.dataGenFns.length; i++) {
  59348. data += state.dataGenFns[i](el);
  59349. }
  59350. // attributes
  59351. if (el.attrs) {
  59352. data += "attrs:" + (genProps(el.attrs)) + ",";
  59353. }
  59354. // DOM props
  59355. if (el.props) {
  59356. data += "domProps:" + (genProps(el.props)) + ",";
  59357. }
  59358. // event handlers
  59359. if (el.events) {
  59360. data += (genHandlers(el.events, false)) + ",";
  59361. }
  59362. if (el.nativeEvents) {
  59363. data += (genHandlers(el.nativeEvents, true)) + ",";
  59364. }
  59365. // slot target
  59366. // only for non-scoped slots
  59367. if (el.slotTarget && !el.slotScope) {
  59368. data += "slot:" + (el.slotTarget) + ",";
  59369. }
  59370. // scoped slots
  59371. if (el.scopedSlots) {
  59372. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59373. }
  59374. // component v-model
  59375. if (el.model) {
  59376. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59377. }
  59378. // inline-template
  59379. if (el.inlineTemplate) {
  59380. var inlineTemplate = genInlineTemplate(el, state);
  59381. if (inlineTemplate) {
  59382. data += inlineTemplate + ",";
  59383. }
  59384. }
  59385. data = data.replace(/,$/, '') + '}';
  59386. // v-bind dynamic argument wrap
  59387. // v-bind with dynamic arguments must be applied using the same v-bind object
  59388. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59389. if (el.dynamicAttrs) {
  59390. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59391. }
  59392. // v-bind data wrap
  59393. if (el.wrapData) {
  59394. data = el.wrapData(data);
  59395. }
  59396. // v-on data wrap
  59397. if (el.wrapListeners) {
  59398. data = el.wrapListeners(data);
  59399. }
  59400. return data
  59401. }
  59402. function genDirectives (el, state) {
  59403. var dirs = el.directives;
  59404. if (!dirs) { return }
  59405. var res = 'directives:[';
  59406. var hasRuntime = false;
  59407. var i, l, dir, needRuntime;
  59408. for (i = 0, l = dirs.length; i < l; i++) {
  59409. dir = dirs[i];
  59410. needRuntime = true;
  59411. var gen = state.directives[dir.name];
  59412. if (gen) {
  59413. // compile-time directive that manipulates AST.
  59414. // returns true if it also needs a runtime counterpart.
  59415. needRuntime = !!gen(el, dir, state.warn);
  59416. }
  59417. if (needRuntime) {
  59418. hasRuntime = true;
  59419. 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))) : '') + "},";
  59420. }
  59421. }
  59422. if (hasRuntime) {
  59423. return res.slice(0, -1) + ']'
  59424. }
  59425. }
  59426. function genInlineTemplate (el, state) {
  59427. var ast = el.children[0];
  59428. if (el.children.length !== 1 || ast.type !== 1) {
  59429. state.warn(
  59430. 'Inline-template components must have exactly one child element.',
  59431. { start: el.start }
  59432. );
  59433. }
  59434. if (ast && ast.type === 1) {
  59435. var inlineRenderFns = generate(ast, state.options);
  59436. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59437. }
  59438. }
  59439. function genScopedSlots (
  59440. el,
  59441. slots,
  59442. state
  59443. ) {
  59444. // by default scoped slots are considered "stable", this allows child
  59445. // components with only scoped slots to skip forced updates from parent.
  59446. // but in some cases we have to bail-out of this optimization
  59447. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59448. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59449. var slot = slots[key];
  59450. return (
  59451. slot.slotTargetDynamic ||
  59452. slot.if ||
  59453. slot.for ||
  59454. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59455. )
  59456. });
  59457. // #9534: if a component with scoped slots is inside a conditional branch,
  59458. // it's possible for the same component to be reused but with different
  59459. // compiled slot content. To avoid that, we generate a unique key based on
  59460. // the generated code of all the slot contents.
  59461. var needsKey = !!el.if;
  59462. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59463. // disconnected due to the intermediate scope variable)
  59464. // #9438, #9506
  59465. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59466. // and skip force updating ones that do not actually use scope variables.
  59467. if (!needsForceUpdate) {
  59468. var parent = el.parent;
  59469. while (parent) {
  59470. if (
  59471. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59472. parent.for
  59473. ) {
  59474. needsForceUpdate = true;
  59475. break
  59476. }
  59477. if (parent.if) {
  59478. needsKey = true;
  59479. }
  59480. parent = parent.parent;
  59481. }
  59482. }
  59483. var generatedSlots = Object.keys(slots)
  59484. .map(function (key) { return genScopedSlot(slots[key], state); })
  59485. .join(',');
  59486. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59487. }
  59488. function hash(str) {
  59489. var hash = 5381;
  59490. var i = str.length;
  59491. while(i) {
  59492. hash = (hash * 33) ^ str.charCodeAt(--i);
  59493. }
  59494. return hash >>> 0
  59495. }
  59496. function containsSlotChild (el) {
  59497. if (el.type === 1) {
  59498. if (el.tag === 'slot') {
  59499. return true
  59500. }
  59501. return el.children.some(containsSlotChild)
  59502. }
  59503. return false
  59504. }
  59505. function genScopedSlot (
  59506. el,
  59507. state
  59508. ) {
  59509. var isLegacySyntax = el.attrsMap['slot-scope'];
  59510. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59511. return genIf(el, state, genScopedSlot, "null")
  59512. }
  59513. if (el.for && !el.forProcessed) {
  59514. return genFor(el, state, genScopedSlot)
  59515. }
  59516. var slotScope = el.slotScope === emptySlotScopeToken
  59517. ? ""
  59518. : String(el.slotScope);
  59519. var fn = "function(" + slotScope + "){" +
  59520. "return " + (el.tag === 'template'
  59521. ? el.if && isLegacySyntax
  59522. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59523. : genChildren(el, state) || 'undefined'
  59524. : genElement(el, state)) + "}";
  59525. // reverse proxy v-slot without scope on this.$slots
  59526. var reverseProxy = slotScope ? "" : ",proxy:true";
  59527. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59528. }
  59529. function genChildren (
  59530. el,
  59531. state,
  59532. checkSkip,
  59533. altGenElement,
  59534. altGenNode
  59535. ) {
  59536. var children = el.children;
  59537. if (children.length) {
  59538. var el$1 = children[0];
  59539. // optimize single v-for
  59540. if (children.length === 1 &&
  59541. el$1.for &&
  59542. el$1.tag !== 'template' &&
  59543. el$1.tag !== 'slot'
  59544. ) {
  59545. var normalizationType = checkSkip
  59546. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59547. : "";
  59548. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59549. }
  59550. var normalizationType$1 = checkSkip
  59551. ? getNormalizationType(children, state.maybeComponent)
  59552. : 0;
  59553. var gen = altGenNode || genNode;
  59554. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59555. }
  59556. }
  59557. // determine the normalization needed for the children array.
  59558. // 0: no normalization needed
  59559. // 1: simple normalization needed (possible 1-level deep nested array)
  59560. // 2: full normalization needed
  59561. function getNormalizationType (
  59562. children,
  59563. maybeComponent
  59564. ) {
  59565. var res = 0;
  59566. for (var i = 0; i < children.length; i++) {
  59567. var el = children[i];
  59568. if (el.type !== 1) {
  59569. continue
  59570. }
  59571. if (needsNormalization(el) ||
  59572. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59573. res = 2;
  59574. break
  59575. }
  59576. if (maybeComponent(el) ||
  59577. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59578. res = 1;
  59579. }
  59580. }
  59581. return res
  59582. }
  59583. function needsNormalization (el) {
  59584. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59585. }
  59586. function genNode (node, state) {
  59587. if (node.type === 1) {
  59588. return genElement(node, state)
  59589. } else if (node.type === 3 && node.isComment) {
  59590. return genComment(node)
  59591. } else {
  59592. return genText(node)
  59593. }
  59594. }
  59595. function genText (text) {
  59596. return ("_v(" + (text.type === 2
  59597. ? text.expression // no need for () because already wrapped in _s()
  59598. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59599. }
  59600. function genComment (comment) {
  59601. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59602. }
  59603. function genSlot (el, state) {
  59604. var slotName = el.slotName || '"default"';
  59605. var children = genChildren(el, state);
  59606. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59607. var attrs = el.attrs || el.dynamicAttrs
  59608. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59609. // slot props are camelized
  59610. name: camelize(attr.name),
  59611. value: attr.value,
  59612. dynamic: attr.dynamic
  59613. }); }))
  59614. : null;
  59615. var bind$$1 = el.attrsMap['v-bind'];
  59616. if ((attrs || bind$$1) && !children) {
  59617. res += ",null";
  59618. }
  59619. if (attrs) {
  59620. res += "," + attrs;
  59621. }
  59622. if (bind$$1) {
  59623. res += (attrs ? '' : ',null') + "," + bind$$1;
  59624. }
  59625. return res + ')'
  59626. }
  59627. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59628. function genComponent (
  59629. componentName,
  59630. el,
  59631. state
  59632. ) {
  59633. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59634. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59635. }
  59636. function genProps (props) {
  59637. var staticProps = "";
  59638. var dynamicProps = "";
  59639. for (var i = 0; i < props.length; i++) {
  59640. var prop = props[i];
  59641. var value = transformSpecialNewlines(prop.value);
  59642. if (prop.dynamic) {
  59643. dynamicProps += (prop.name) + "," + value + ",";
  59644. } else {
  59645. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59646. }
  59647. }
  59648. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59649. if (dynamicProps) {
  59650. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59651. } else {
  59652. return staticProps
  59653. }
  59654. }
  59655. // #3895, #4268
  59656. function transformSpecialNewlines (text) {
  59657. return text
  59658. .replace(/\u2028/g, '\\u2028')
  59659. .replace(/\u2029/g, '\\u2029')
  59660. }
  59661. /* */
  59662. // these keywords should not appear inside expressions, but operators like
  59663. // typeof, instanceof and in are allowed
  59664. var prohibitedKeywordRE = new RegExp('\\b' + (
  59665. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59666. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59667. 'extends,finally,continue,debugger,function,arguments'
  59668. ).split(',').join('\\b|\\b') + '\\b');
  59669. // these unary operators should not be used as property/method names
  59670. var unaryOperatorsRE = new RegExp('\\b' + (
  59671. 'delete,typeof,void'
  59672. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59673. // strip strings in expressions
  59674. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59675. // detect problematic expressions in a template
  59676. function detectErrors (ast, warn) {
  59677. if (ast) {
  59678. checkNode(ast, warn);
  59679. }
  59680. }
  59681. function checkNode (node, warn) {
  59682. if (node.type === 1) {
  59683. for (var name in node.attrsMap) {
  59684. if (dirRE.test(name)) {
  59685. var value = node.attrsMap[name];
  59686. if (value) {
  59687. var range = node.rawAttrsMap[name];
  59688. if (name === 'v-for') {
  59689. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59690. } else if (name === 'v-slot' || name[0] === '#') {
  59691. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59692. } else if (onRE.test(name)) {
  59693. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59694. } else {
  59695. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59696. }
  59697. }
  59698. }
  59699. }
  59700. if (node.children) {
  59701. for (var i = 0; i < node.children.length; i++) {
  59702. checkNode(node.children[i], warn);
  59703. }
  59704. }
  59705. } else if (node.type === 2) {
  59706. checkExpression(node.expression, node.text, warn, node);
  59707. }
  59708. }
  59709. function checkEvent (exp, text, warn, range) {
  59710. var stripped = exp.replace(stripStringRE, '');
  59711. var keywordMatch = stripped.match(unaryOperatorsRE);
  59712. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59713. warn(
  59714. "avoid using JavaScript unary operator as property name: " +
  59715. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59716. range
  59717. );
  59718. }
  59719. checkExpression(exp, text, warn, range);
  59720. }
  59721. function checkFor (node, text, warn, range) {
  59722. checkExpression(node.for || '', text, warn, range);
  59723. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59724. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59725. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59726. }
  59727. function checkIdentifier (
  59728. ident,
  59729. type,
  59730. text,
  59731. warn,
  59732. range
  59733. ) {
  59734. if (typeof ident === 'string') {
  59735. try {
  59736. new Function(("var " + ident + "=_"));
  59737. } catch (e) {
  59738. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59739. }
  59740. }
  59741. }
  59742. function checkExpression (exp, text, warn, range) {
  59743. try {
  59744. new Function(("return " + exp));
  59745. } catch (e) {
  59746. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59747. if (keywordMatch) {
  59748. warn(
  59749. "avoid using JavaScript keyword as property name: " +
  59750. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59751. range
  59752. );
  59753. } else {
  59754. warn(
  59755. "invalid expression: " + (e.message) + " in\n\n" +
  59756. " " + exp + "\n\n" +
  59757. " Raw expression: " + (text.trim()) + "\n",
  59758. range
  59759. );
  59760. }
  59761. }
  59762. }
  59763. function checkFunctionParameterExpression (exp, text, warn, range) {
  59764. try {
  59765. new Function(exp, '');
  59766. } catch (e) {
  59767. warn(
  59768. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59769. " " + exp + "\n\n" +
  59770. " Raw expression: " + (text.trim()) + "\n",
  59771. range
  59772. );
  59773. }
  59774. }
  59775. /* */
  59776. var range = 2;
  59777. function generateCodeFrame (
  59778. source,
  59779. start,
  59780. end
  59781. ) {
  59782. if ( start === void 0 ) start = 0;
  59783. if ( end === void 0 ) end = source.length;
  59784. var lines = source.split(/\r?\n/);
  59785. var count = 0;
  59786. var res = [];
  59787. for (var i = 0; i < lines.length; i++) {
  59788. count += lines[i].length + 1;
  59789. if (count >= start) {
  59790. for (var j = i - range; j <= i + range || end > count; j++) {
  59791. if (j < 0 || j >= lines.length) { continue }
  59792. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59793. var lineLength = lines[j].length;
  59794. if (j === i) {
  59795. // push underline
  59796. var pad = start - (count - lineLength) + 1;
  59797. var length = end > count ? lineLength - pad : end - start;
  59798. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59799. } else if (j > i) {
  59800. if (end > count) {
  59801. var length$1 = Math.min(end - count, lineLength);
  59802. res.push(" | " + repeat$1("^", length$1));
  59803. }
  59804. count += lineLength + 1;
  59805. }
  59806. }
  59807. break
  59808. }
  59809. }
  59810. return res.join('\n')
  59811. }
  59812. function repeat$1 (str, n) {
  59813. var result = '';
  59814. if (n > 0) {
  59815. while (true) { // eslint-disable-line
  59816. if (n & 1) { result += str; }
  59817. n >>>= 1;
  59818. if (n <= 0) { break }
  59819. str += str;
  59820. }
  59821. }
  59822. return result
  59823. }
  59824. /* */
  59825. function createFunction (code, errors) {
  59826. try {
  59827. return new Function(code)
  59828. } catch (err) {
  59829. errors.push({ err: err, code: code });
  59830. return noop
  59831. }
  59832. }
  59833. function createCompileToFunctionFn (compile) {
  59834. var cache = Object.create(null);
  59835. return function compileToFunctions (
  59836. template,
  59837. options,
  59838. vm
  59839. ) {
  59840. options = extend({}, options);
  59841. var warn$$1 = options.warn || warn;
  59842. delete options.warn;
  59843. /* istanbul ignore if */
  59844. {
  59845. // detect possible CSP restriction
  59846. try {
  59847. new Function('return 1');
  59848. } catch (e) {
  59849. if (e.toString().match(/unsafe-eval|CSP/)) {
  59850. warn$$1(
  59851. 'It seems you are using the standalone build of Vue.js in an ' +
  59852. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59853. 'The template compiler cannot work in this environment. Consider ' +
  59854. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59855. 'templates into render functions.'
  59856. );
  59857. }
  59858. }
  59859. }
  59860. // check cache
  59861. var key = options.delimiters
  59862. ? String(options.delimiters) + template
  59863. : template;
  59864. if (cache[key]) {
  59865. return cache[key]
  59866. }
  59867. // compile
  59868. var compiled = compile(template, options);
  59869. // check compilation errors/tips
  59870. {
  59871. if (compiled.errors && compiled.errors.length) {
  59872. if (options.outputSourceRange) {
  59873. compiled.errors.forEach(function (e) {
  59874. warn$$1(
  59875. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59876. generateCodeFrame(template, e.start, e.end),
  59877. vm
  59878. );
  59879. });
  59880. } else {
  59881. warn$$1(
  59882. "Error compiling template:\n\n" + template + "\n\n" +
  59883. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59884. vm
  59885. );
  59886. }
  59887. }
  59888. if (compiled.tips && compiled.tips.length) {
  59889. if (options.outputSourceRange) {
  59890. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59891. } else {
  59892. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59893. }
  59894. }
  59895. }
  59896. // turn code into functions
  59897. var res = {};
  59898. var fnGenErrors = [];
  59899. res.render = createFunction(compiled.render, fnGenErrors);
  59900. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59901. return createFunction(code, fnGenErrors)
  59902. });
  59903. // check function generation errors.
  59904. // this should only happen if there is a bug in the compiler itself.
  59905. // mostly for codegen development use
  59906. /* istanbul ignore if */
  59907. {
  59908. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59909. warn$$1(
  59910. "Failed to generate render function:\n\n" +
  59911. fnGenErrors.map(function (ref) {
  59912. var err = ref.err;
  59913. var code = ref.code;
  59914. return ((err.toString()) + " in\n\n" + code + "\n");
  59915. }).join('\n'),
  59916. vm
  59917. );
  59918. }
  59919. }
  59920. return (cache[key] = res)
  59921. }
  59922. }
  59923. /* */
  59924. function createCompilerCreator (baseCompile) {
  59925. return function createCompiler (baseOptions) {
  59926. function compile (
  59927. template,
  59928. options
  59929. ) {
  59930. var finalOptions = Object.create(baseOptions);
  59931. var errors = [];
  59932. var tips = [];
  59933. var warn = function (msg, range, tip) {
  59934. (tip ? tips : errors).push(msg);
  59935. };
  59936. if (options) {
  59937. if (options.outputSourceRange) {
  59938. // $flow-disable-line
  59939. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59940. warn = function (msg, range, tip) {
  59941. var data = { msg: msg };
  59942. if (range) {
  59943. if (range.start != null) {
  59944. data.start = range.start + leadingSpaceLength;
  59945. }
  59946. if (range.end != null) {
  59947. data.end = range.end + leadingSpaceLength;
  59948. }
  59949. }
  59950. (tip ? tips : errors).push(data);
  59951. };
  59952. }
  59953. // merge custom modules
  59954. if (options.modules) {
  59955. finalOptions.modules =
  59956. (baseOptions.modules || []).concat(options.modules);
  59957. }
  59958. // merge custom directives
  59959. if (options.directives) {
  59960. finalOptions.directives = extend(
  59961. Object.create(baseOptions.directives || null),
  59962. options.directives
  59963. );
  59964. }
  59965. // copy other options
  59966. for (var key in options) {
  59967. if (key !== 'modules' && key !== 'directives') {
  59968. finalOptions[key] = options[key];
  59969. }
  59970. }
  59971. }
  59972. finalOptions.warn = warn;
  59973. var compiled = baseCompile(template.trim(), finalOptions);
  59974. {
  59975. detectErrors(compiled.ast, warn);
  59976. }
  59977. compiled.errors = errors;
  59978. compiled.tips = tips;
  59979. return compiled
  59980. }
  59981. return {
  59982. compile: compile,
  59983. compileToFunctions: createCompileToFunctionFn(compile)
  59984. }
  59985. }
  59986. }
  59987. /* */
  59988. // `createCompilerCreator` allows creating compilers that use alternative
  59989. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  59990. // Here we just export a default compiler using the default parts.
  59991. var createCompiler = createCompilerCreator(function baseCompile (
  59992. template,
  59993. options
  59994. ) {
  59995. var ast = parse(template.trim(), options);
  59996. if (options.optimize !== false) {
  59997. optimize(ast, options);
  59998. }
  59999. var code = generate(ast, options);
  60000. return {
  60001. ast: ast,
  60002. render: code.render,
  60003. staticRenderFns: code.staticRenderFns
  60004. }
  60005. });
  60006. /* */
  60007. var ref$1 = createCompiler(baseOptions);
  60008. var compile = ref$1.compile;
  60009. var compileToFunctions = ref$1.compileToFunctions;
  60010. /* */
  60011. // check whether current browser encodes a char inside attribute values
  60012. var div;
  60013. function getShouldDecode (href) {
  60014. div = div || document.createElement('div');
  60015. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  60016. return div.innerHTML.indexOf('&#10;') > 0
  60017. }
  60018. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60019. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60020. // #6828: chrome encodes content in a[href]
  60021. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60022. /* */
  60023. var idToTemplate = cached(function (id) {
  60024. var el = query(id);
  60025. return el && el.innerHTML
  60026. });
  60027. var mount = Vue.prototype.$mount;
  60028. Vue.prototype.$mount = function (
  60029. el,
  60030. hydrating
  60031. ) {
  60032. el = el && query(el);
  60033. /* istanbul ignore if */
  60034. if (el === document.body || el === document.documentElement) {
  60035. warn(
  60036. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60037. );
  60038. return this
  60039. }
  60040. var options = this.$options;
  60041. // resolve template/el and convert to render function
  60042. if (!options.render) {
  60043. var template = options.template;
  60044. if (template) {
  60045. if (typeof template === 'string') {
  60046. if (template.charAt(0) === '#') {
  60047. template = idToTemplate(template);
  60048. /* istanbul ignore if */
  60049. if (!template) {
  60050. warn(
  60051. ("Template element not found or is empty: " + (options.template)),
  60052. this
  60053. );
  60054. }
  60055. }
  60056. } else if (template.nodeType) {
  60057. template = template.innerHTML;
  60058. } else {
  60059. {
  60060. warn('invalid template option:' + template, this);
  60061. }
  60062. return this
  60063. }
  60064. } else if (el) {
  60065. template = getOuterHTML(el);
  60066. }
  60067. if (template) {
  60068. /* istanbul ignore if */
  60069. if (config.performance && mark) {
  60070. mark('compile');
  60071. }
  60072. var ref = compileToFunctions(template, {
  60073. outputSourceRange: "development" !== 'production',
  60074. shouldDecodeNewlines: shouldDecodeNewlines,
  60075. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60076. delimiters: options.delimiters,
  60077. comments: options.comments
  60078. }, this);
  60079. var render = ref.render;
  60080. var staticRenderFns = ref.staticRenderFns;
  60081. options.render = render;
  60082. options.staticRenderFns = staticRenderFns;
  60083. /* istanbul ignore if */
  60084. if (config.performance && mark) {
  60085. mark('compile end');
  60086. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60087. }
  60088. }
  60089. }
  60090. return mount.call(this, el, hydrating)
  60091. };
  60092. /**
  60093. * Get outerHTML of elements, taking care
  60094. * of SVG elements in IE as well.
  60095. */
  60096. function getOuterHTML (el) {
  60097. if (el.outerHTML) {
  60098. return el.outerHTML
  60099. } else {
  60100. var container = document.createElement('div');
  60101. container.appendChild(el.cloneNode(true));
  60102. return container.innerHTML
  60103. }
  60104. }
  60105. Vue.compile = compileToFunctions;
  60106. module.exports = Vue;
  60107. /* 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))
  60108. /***/ }),
  60109. /***/ "./node_modules/vue/dist/vue.common.js":
  60110. /*!*********************************************!*\
  60111. !*** ./node_modules/vue/dist/vue.common.js ***!
  60112. \*********************************************/
  60113. /*! no static exports found */
  60114. /***/ (function(module, exports, __webpack_require__) {
  60115. if (false) {} else {
  60116. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60117. }
  60118. /***/ }),
  60119. /***/ "./node_modules/webpack/buildin/global.js":
  60120. /*!***********************************!*\
  60121. !*** (webpack)/buildin/global.js ***!
  60122. \***********************************/
  60123. /*! no static exports found */
  60124. /***/ (function(module, exports) {
  60125. var g;
  60126. // This works in non-strict mode
  60127. g = (function() {
  60128. return this;
  60129. })();
  60130. try {
  60131. // This works if eval is allowed (see CSP)
  60132. g = g || new Function("return this")();
  60133. } catch (e) {
  60134. // This works if the window reference is available
  60135. if (typeof window === "object") g = window;
  60136. }
  60137. // g can still be undefined, but nothing to do about it...
  60138. // We return undefined, instead of nothing here, so it's
  60139. // easier to handle this case. if(!global) { ...}
  60140. module.exports = g;
  60141. /***/ }),
  60142. /***/ "./node_modules/webpack/buildin/module.js":
  60143. /*!***********************************!*\
  60144. !*** (webpack)/buildin/module.js ***!
  60145. \***********************************/
  60146. /*! no static exports found */
  60147. /***/ (function(module, exports) {
  60148. module.exports = function(module) {
  60149. if (!module.webpackPolyfill) {
  60150. module.deprecate = function() {};
  60151. module.paths = [];
  60152. // module.parent = undefined by default
  60153. if (!module.children) module.children = [];
  60154. Object.defineProperty(module, "loaded", {
  60155. enumerable: true,
  60156. get: function() {
  60157. return module.l;
  60158. }
  60159. });
  60160. Object.defineProperty(module, "id", {
  60161. enumerable: true,
  60162. get: function() {
  60163. return module.i;
  60164. }
  60165. });
  60166. module.webpackPolyfill = 1;
  60167. }
  60168. return module;
  60169. };
  60170. /***/ }),
  60171. /***/ "./resources/js/app.js":
  60172. /*!*****************************!*\
  60173. !*** ./resources/js/app.js ***!
  60174. \*****************************/
  60175. /*! no exports provided */
  60176. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60177. "use strict";
  60178. __webpack_require__.r(__webpack_exports__);
  60179. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60180. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60181. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60182. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60183. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60184. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60185. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60186. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60187. /**
  60188. * First we will load all of this project's JavaScript dependencies which
  60189. * includes Vue and other libraries. It is a great starting point when
  60190. * building robust, powerful web applications using Vue and Laravel.
  60191. */
  60192. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60193. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60194. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60195. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60196. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60197. mode: 'history',
  60198. routes: [{
  60199. path: '/',
  60200. name: 'home',
  60201. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60202. }, {
  60203. path: '/login',
  60204. name: 'login',
  60205. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60206. }, {
  60207. path: '/dashboard',
  60208. name: 'dashboard',
  60209. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60210. }, {
  60211. path: '/workorders/:id',
  60212. name: 'workorders',
  60213. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60214. props: true
  60215. }]
  60216. });
  60217. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60218. el: '#app',
  60219. components: {
  60220. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60221. },
  60222. router: router
  60223. });
  60224. $(function () {
  60225. $('[data-toggle="tooltip"]').tooltip();
  60226. });
  60227. var clipboard = new Clipboard('.btn-clip');
  60228. clipboard.on('success', function (e) {
  60229. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60230. position: "right",
  60231. className: 'success'
  60232. });
  60233. e.clearSelection();
  60234. });
  60235. /***/ }),
  60236. /***/ "./resources/js/bootstrap.js":
  60237. /*!***********************************!*\
  60238. !*** ./resources/js/bootstrap.js ***!
  60239. \***********************************/
  60240. /*! no exports provided */
  60241. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60242. "use strict";
  60243. __webpack_require__.r(__webpack_exports__);
  60244. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60245. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60246. /**
  60247. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60248. * for JavaScript based Bootstrap features such as modals and tabs. This
  60249. * code may be modified to fit the specific needs of your application.
  60250. */
  60251. try {
  60252. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60253. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60254. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60255. } catch (e) {}
  60256. /**
  60257. * We'll load the axios HTTP library which allows us to easily issue requests
  60258. * to our Laravel back-end. This library automatically handles sending the
  60259. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60260. */
  60261. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60262. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60263. /**
  60264. * Echo exposes an expressive API for subscribing to channels and listening
  60265. * for events that are broadcast by Laravel. Echo and event broadcasting
  60266. * allows your team to easily build robust real-time web applications.
  60267. */
  60268. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60269. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60270. broadcaster: 'pusher',
  60271. key: "upccrt",
  60272. wsHost: window.location.hostname,
  60273. wsPort: 6001,
  60274. disableStats: true
  60275. });
  60276. /***/ }),
  60277. /***/ "./resources/js/components/AssetInfo.vue":
  60278. /*!***********************************************!*\
  60279. !*** ./resources/js/components/AssetInfo.vue ***!
  60280. \***********************************************/
  60281. /*! exports provided: default */
  60282. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60283. "use strict";
  60284. __webpack_require__.r(__webpack_exports__);
  60285. /* 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&");
  60286. /* 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&");
  60287. /* 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");
  60288. /* normalize component */
  60289. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60290. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60291. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60292. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60293. false,
  60294. null,
  60295. null,
  60296. null
  60297. )
  60298. /* hot reload */
  60299. if (false) { var api; }
  60300. component.options.__file = "resources/js/components/AssetInfo.vue"
  60301. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60302. /***/ }),
  60303. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60304. /*!************************************************************************!*\
  60305. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60306. \************************************************************************/
  60307. /*! exports provided: default */
  60308. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60309. "use strict";
  60310. __webpack_require__.r(__webpack_exports__);
  60311. /* 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&");
  60312. /* 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"]);
  60313. /***/ }),
  60314. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60315. /*!******************************************************************************!*\
  60316. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60317. \******************************************************************************/
  60318. /*! exports provided: render, staticRenderFns */
  60319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60320. "use strict";
  60321. __webpack_require__.r(__webpack_exports__);
  60322. /* 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&");
  60323. /* 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"]; });
  60324. /* 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"]; });
  60325. /***/ }),
  60326. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60327. /*!********************************************************!*\
  60328. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60329. \********************************************************/
  60330. /*! exports provided: default */
  60331. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60332. "use strict";
  60333. __webpack_require__.r(__webpack_exports__);
  60334. /* 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&");
  60335. /* 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&");
  60336. /* 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");
  60337. /* normalize component */
  60338. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60339. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60340. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60341. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60342. false,
  60343. null,
  60344. null,
  60345. null
  60346. )
  60347. /* hot reload */
  60348. if (false) { var api; }
  60349. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60350. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60351. /***/ }),
  60352. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60353. /*!*********************************************************************************!*\
  60354. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60355. \*********************************************************************************/
  60356. /*! exports provided: default */
  60357. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60358. "use strict";
  60359. __webpack_require__.r(__webpack_exports__);
  60360. /* 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&");
  60361. /* 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"]);
  60362. /***/ }),
  60363. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60364. /*!***************************************************************************************!*\
  60365. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60366. \***************************************************************************************/
  60367. /*! exports provided: render, staticRenderFns */
  60368. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60369. "use strict";
  60370. __webpack_require__.r(__webpack_exports__);
  60371. /* 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&");
  60372. /* 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"]; });
  60373. /* 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"]; });
  60374. /***/ }),
  60375. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60376. /*!****************************************************************!*\
  60377. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60378. \****************************************************************/
  60379. /*! exports provided: default */
  60380. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60381. "use strict";
  60382. __webpack_require__.r(__webpack_exports__);
  60383. /* 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&");
  60384. /* 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&");
  60385. /* 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");
  60386. /* normalize component */
  60387. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60388. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60389. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60390. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60391. false,
  60392. null,
  60393. null,
  60394. null
  60395. )
  60396. /* hot reload */
  60397. if (false) { var api; }
  60398. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60399. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60400. /***/ }),
  60401. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60402. /*!*****************************************************************************************!*\
  60403. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  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 _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&");
  60410. /* 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"]);
  60411. /***/ }),
  60412. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60413. /*!***********************************************************************************************!*\
  60414. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60415. \***********************************************************************************************/
  60416. /*! exports provided: render, staticRenderFns */
  60417. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60418. "use strict";
  60419. __webpack_require__.r(__webpack_exports__);
  60420. /* 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&");
  60421. /* 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"]; });
  60422. /* 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"]; });
  60423. /***/ }),
  60424. /***/ "./resources/js/components/CircleSpinner.vue":
  60425. /*!***************************************************!*\
  60426. !*** ./resources/js/components/CircleSpinner.vue ***!
  60427. \***************************************************/
  60428. /*! exports provided: default */
  60429. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60430. "use strict";
  60431. __webpack_require__.r(__webpack_exports__);
  60432. /* 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&");
  60433. /* 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&");
  60434. /* empty/unused harmony star reexport *//* harmony import */ var _CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  60435. /* 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");
  60436. /* normalize component */
  60437. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60438. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60439. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60440. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60441. false,
  60442. null,
  60443. "9a543b64",
  60444. null
  60445. )
  60446. /* hot reload */
  60447. if (false) { var api; }
  60448. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60449. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60450. /***/ }),
  60451. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60452. /*!****************************************************************************!*\
  60453. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60454. \****************************************************************************/
  60455. /*! exports provided: default */
  60456. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60457. "use strict";
  60458. __webpack_require__.r(__webpack_exports__);
  60459. /* 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&");
  60460. /* 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"]);
  60461. /***/ }),
  60462. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60463. /*!************************************************************************************************************!*\
  60464. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60465. \************************************************************************************************************/
  60466. /*! no static exports found */
  60467. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60468. "use strict";
  60469. __webpack_require__.r(__webpack_exports__);
  60470. /* 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&");
  60471. /* 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__);
  60472. /* 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__));
  60473. /* 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);
  60474. /***/ }),
  60475. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60476. /*!**********************************************************************************************!*\
  60477. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60478. \**********************************************************************************************/
  60479. /*! exports provided: render, staticRenderFns */
  60480. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60481. "use strict";
  60482. __webpack_require__.r(__webpack_exports__);
  60483. /* 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&");
  60484. /* 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"]; });
  60485. /* 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"]; });
  60486. /***/ }),
  60487. /***/ "./resources/js/components/Credential.vue":
  60488. /*!************************************************!*\
  60489. !*** ./resources/js/components/Credential.vue ***!
  60490. \************************************************/
  60491. /*! exports provided: default */
  60492. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60493. "use strict";
  60494. __webpack_require__.r(__webpack_exports__);
  60495. /* 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&");
  60496. /* 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&");
  60497. /* 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");
  60498. /* normalize component */
  60499. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60500. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60501. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60502. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60503. false,
  60504. null,
  60505. null,
  60506. null
  60507. )
  60508. /* hot reload */
  60509. if (false) { var api; }
  60510. component.options.__file = "resources/js/components/Credential.vue"
  60511. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60512. /***/ }),
  60513. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60514. /*!*************************************************************************!*\
  60515. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60516. \*************************************************************************/
  60517. /*! exports provided: default */
  60518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60519. "use strict";
  60520. __webpack_require__.r(__webpack_exports__);
  60521. /* 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&");
  60522. /* 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"]);
  60523. /***/ }),
  60524. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60525. /*!*******************************************************************************!*\
  60526. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60527. \*******************************************************************************/
  60528. /*! exports provided: render, staticRenderFns */
  60529. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60530. "use strict";
  60531. __webpack_require__.r(__webpack_exports__);
  60532. /* 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&");
  60533. /* 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"]; });
  60534. /* 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"]; });
  60535. /***/ }),
  60536. /***/ "./resources/js/components/CredentialFormModal.vue":
  60537. /*!*********************************************************!*\
  60538. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60539. \*********************************************************/
  60540. /*! exports provided: default */
  60541. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60542. "use strict";
  60543. __webpack_require__.r(__webpack_exports__);
  60544. /* 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&");
  60545. /* 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&");
  60546. /* 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");
  60547. /* normalize component */
  60548. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60549. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60550. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60551. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60552. false,
  60553. null,
  60554. null,
  60555. null
  60556. )
  60557. /* hot reload */
  60558. if (false) { var api; }
  60559. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60560. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60561. /***/ }),
  60562. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60563. /*!**********************************************************************************!*\
  60564. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60565. \**********************************************************************************/
  60566. /*! exports provided: default */
  60567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60568. "use strict";
  60569. __webpack_require__.r(__webpack_exports__);
  60570. /* 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&");
  60571. /* 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"]);
  60572. /***/ }),
  60573. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60574. /*!****************************************************************************************!*\
  60575. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60576. \****************************************************************************************/
  60577. /*! exports provided: render, staticRenderFns */
  60578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60579. "use strict";
  60580. __webpack_require__.r(__webpack_exports__);
  60581. /* 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&");
  60582. /* 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"]; });
  60583. /* 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"]; });
  60584. /***/ }),
  60585. /***/ "./resources/js/components/CredentialList.vue":
  60586. /*!****************************************************!*\
  60587. !*** ./resources/js/components/CredentialList.vue ***!
  60588. \****************************************************/
  60589. /*! exports provided: default */
  60590. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60591. "use strict";
  60592. __webpack_require__.r(__webpack_exports__);
  60593. /* 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&");
  60594. /* 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&");
  60595. /* 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");
  60596. /* normalize component */
  60597. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60598. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60599. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60600. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60601. false,
  60602. null,
  60603. null,
  60604. null
  60605. )
  60606. /* hot reload */
  60607. if (false) { var api; }
  60608. component.options.__file = "resources/js/components/CredentialList.vue"
  60609. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60610. /***/ }),
  60611. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60612. /*!*****************************************************************************!*\
  60613. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60614. \*****************************************************************************/
  60615. /*! exports provided: default */
  60616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60617. "use strict";
  60618. __webpack_require__.r(__webpack_exports__);
  60619. /* 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&");
  60620. /* 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"]);
  60621. /***/ }),
  60622. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60623. /*!***********************************************************************************!*\
  60624. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60625. \***********************************************************************************/
  60626. /*! exports provided: render, staticRenderFns */
  60627. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60628. "use strict";
  60629. __webpack_require__.r(__webpack_exports__);
  60630. /* 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&");
  60631. /* 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"]; });
  60632. /* 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"]; });
  60633. /***/ }),
  60634. /***/ "./resources/js/components/ErrorList.vue":
  60635. /*!***********************************************!*\
  60636. !*** ./resources/js/components/ErrorList.vue ***!
  60637. \***********************************************/
  60638. /*! exports provided: default */
  60639. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60640. "use strict";
  60641. __webpack_require__.r(__webpack_exports__);
  60642. /* harmony import */ var _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ErrorList.vue?vue&type=template&id=48c089eb& */ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60643. /* harmony import */ var _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ErrorList.vue?vue&type=script&lang=js& */ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&");
  60644. /* 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");
  60645. /* normalize component */
  60646. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60647. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60648. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60649. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60650. false,
  60651. null,
  60652. null,
  60653. null
  60654. )
  60655. /* hot reload */
  60656. if (false) { var api; }
  60657. component.options.__file = "resources/js/components/ErrorList.vue"
  60658. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60659. /***/ }),
  60660. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60661. /*!************************************************************************!*\
  60662. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60663. \************************************************************************/
  60664. /*! exports provided: default */
  60665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60666. "use strict";
  60667. __webpack_require__.r(__webpack_exports__);
  60668. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ErrorList.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&");
  60669. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60670. /***/ }),
  60671. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60672. /*!******************************************************************************!*\
  60673. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60674. \******************************************************************************/
  60675. /*! exports provided: render, staticRenderFns */
  60676. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60677. "use strict";
  60678. __webpack_require__.r(__webpack_exports__);
  60679. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ErrorList.vue?vue&type=template&id=48c089eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60680. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60681. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60682. /***/ }),
  60683. /***/ "./resources/js/components/Modal.vue":
  60684. /*!*******************************************!*\
  60685. !*** ./resources/js/components/Modal.vue ***!
  60686. \*******************************************/
  60687. /*! exports provided: default */
  60688. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60689. "use strict";
  60690. __webpack_require__.r(__webpack_exports__);
  60691. /* 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&");
  60692. /* 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");
  60693. var script = {}
  60694. /* normalize component */
  60695. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  60696. script,
  60697. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60698. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60699. false,
  60700. null,
  60701. null,
  60702. null
  60703. )
  60704. /* hot reload */
  60705. if (false) { var api; }
  60706. component.options.__file = "resources/js/components/Modal.vue"
  60707. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60708. /***/ }),
  60709. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  60710. /*!**************************************************************************!*\
  60711. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  60712. \**************************************************************************/
  60713. /*! exports provided: render, staticRenderFns */
  60714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60715. "use strict";
  60716. __webpack_require__.r(__webpack_exports__);
  60717. /* 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&");
  60718. /* 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"]; });
  60719. /* 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"]; });
  60720. /***/ }),
  60721. /***/ "./resources/js/components/NoteFormModal.vue":
  60722. /*!***************************************************!*\
  60723. !*** ./resources/js/components/NoteFormModal.vue ***!
  60724. \***************************************************/
  60725. /*! exports provided: default */
  60726. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60727. "use strict";
  60728. __webpack_require__.r(__webpack_exports__);
  60729. /* 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&");
  60730. /* 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&");
  60731. /* 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");
  60732. /* normalize component */
  60733. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60734. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60735. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60736. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60737. false,
  60738. null,
  60739. null,
  60740. null
  60741. )
  60742. /* hot reload */
  60743. if (false) { var api; }
  60744. component.options.__file = "resources/js/components/NoteFormModal.vue"
  60745. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60746. /***/ }),
  60747. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  60748. /*!****************************************************************************!*\
  60749. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  60750. \****************************************************************************/
  60751. /*! exports provided: default */
  60752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60753. "use strict";
  60754. __webpack_require__.r(__webpack_exports__);
  60755. /* 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&");
  60756. /* 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"]);
  60757. /***/ }),
  60758. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  60759. /*!**********************************************************************************!*\
  60760. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  60761. \**********************************************************************************/
  60762. /*! exports provided: render, staticRenderFns */
  60763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60764. "use strict";
  60765. __webpack_require__.r(__webpack_exports__);
  60766. /* 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&");
  60767. /* 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"]; });
  60768. /* 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"]; });
  60769. /***/ }),
  60770. /***/ "./resources/js/components/Notes.vue":
  60771. /*!*******************************************!*\
  60772. !*** ./resources/js/components/Notes.vue ***!
  60773. \*******************************************/
  60774. /*! exports provided: default */
  60775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60776. "use strict";
  60777. __webpack_require__.r(__webpack_exports__);
  60778. /* 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&");
  60779. /* 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&");
  60780. /* 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");
  60781. /* normalize component */
  60782. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60783. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60784. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60785. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60786. false,
  60787. null,
  60788. null,
  60789. null
  60790. )
  60791. /* hot reload */
  60792. if (false) { var api; }
  60793. component.options.__file = "resources/js/components/Notes.vue"
  60794. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60795. /***/ }),
  60796. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  60797. /*!********************************************************************!*\
  60798. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  60799. \********************************************************************/
  60800. /*! exports provided: default */
  60801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60802. "use strict";
  60803. __webpack_require__.r(__webpack_exports__);
  60804. /* 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&");
  60805. /* 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"]);
  60806. /***/ }),
  60807. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  60808. /*!**************************************************************************!*\
  60809. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  60810. \**************************************************************************/
  60811. /*! exports provided: render, staticRenderFns */
  60812. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60813. "use strict";
  60814. __webpack_require__.r(__webpack_exports__);
  60815. /* 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&");
  60816. /* 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"]; });
  60817. /* 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"]; });
  60818. /***/ }),
  60819. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60820. /*!*****************************************************!*\
  60821. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60822. \*****************************************************/
  60823. /*! exports provided: default */
  60824. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60825. "use strict";
  60826. __webpack_require__.r(__webpack_exports__);
  60827. /* 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&");
  60828. /* 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&");
  60829. /* 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");
  60830. /* normalize component */
  60831. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60832. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60833. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60834. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60835. false,
  60836. null,
  60837. null,
  60838. null
  60839. )
  60840. /* hot reload */
  60841. if (false) { var api; }
  60842. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60843. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60844. /***/ }),
  60845. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60846. /*!******************************************************************************!*\
  60847. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60848. \******************************************************************************/
  60849. /*! exports provided: default */
  60850. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60851. "use strict";
  60852. __webpack_require__.r(__webpack_exports__);
  60853. /* 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&");
  60854. /* 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"]);
  60855. /***/ }),
  60856. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60857. /*!************************************************************************************!*\
  60858. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60859. \************************************************************************************/
  60860. /*! exports provided: render, staticRenderFns */
  60861. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60862. "use strict";
  60863. __webpack_require__.r(__webpack_exports__);
  60864. /* 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&");
  60865. /* 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"]; });
  60866. /* 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"]; });
  60867. /***/ }),
  60868. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60869. /*!***************************************************!*\
  60870. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60871. \***************************************************/
  60872. /*! exports provided: default */
  60873. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60874. "use strict";
  60875. __webpack_require__.r(__webpack_exports__);
  60876. /* 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&");
  60877. /* 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&");
  60878. /* 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");
  60879. /* normalize component */
  60880. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60881. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60882. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60883. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60884. false,
  60885. null,
  60886. null,
  60887. null
  60888. )
  60889. /* hot reload */
  60890. if (false) { var api; }
  60891. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60892. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60893. /***/ }),
  60894. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60895. /*!****************************************************************************!*\
  60896. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60897. \****************************************************************************/
  60898. /*! exports provided: default */
  60899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60900. "use strict";
  60901. __webpack_require__.r(__webpack_exports__);
  60902. /* 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&");
  60903. /* 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"]);
  60904. /***/ }),
  60905. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60906. /*!**********************************************************************************!*\
  60907. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60908. \**********************************************************************************/
  60909. /*! exports provided: render, staticRenderFns */
  60910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60911. "use strict";
  60912. __webpack_require__.r(__webpack_exports__);
  60913. /* 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&");
  60914. /* 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"]; });
  60915. /* 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"]; });
  60916. /***/ }),
  60917. /***/ "./resources/js/mixins/dateMixin.js":
  60918. /*!******************************************!*\
  60919. !*** ./resources/js/mixins/dateMixin.js ***!
  60920. \******************************************/
  60921. /*! exports provided: default */
  60922. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60923. "use strict";
  60924. __webpack_require__.r(__webpack_exports__);
  60925. /* harmony default export */ __webpack_exports__["default"] = ({
  60926. methods: {
  60927. treatAsUTC: function treatAsUTC(date) {
  60928. var result = new Date(date);
  60929. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60930. return result;
  60931. },
  60932. daysSinceToday: function daysSinceToday(date) {
  60933. var currentDate = new Date();
  60934. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60935. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60936. },
  60937. getHRDate: function getHRDate(dateString) {
  60938. var date = new Date(dateString);
  60939. return date.toLocaleString('default', {
  60940. month: 'short',
  60941. day: 'numeric',
  60942. year: 'numeric',
  60943. hour: 'numeric',
  60944. minute: 'numeric'
  60945. });
  60946. },
  60947. isZero: function isZero(dateString) {
  60948. return dateString === '0000-00-00 00:00:00';
  60949. }
  60950. }
  60951. });
  60952. /***/ }),
  60953. /***/ "./resources/js/notify.min.js":
  60954. /*!************************************!*\
  60955. !*** ./resources/js/notify.min.js ***!
  60956. \************************************/
  60957. /*! no static exports found */
  60958. /***/ (function(module, exports, __webpack_require__) {
  60959. 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); }
  60960. (function (e) {
  60961. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60962. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60963. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60964. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60965. })(function (e) {
  60966. function A(t, n, i) {
  60967. typeof i == "string" && (i = {
  60968. className: i
  60969. }), 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);
  60970. }
  60971. var t = [].indexOf || function (e) {
  60972. for (var t = 0, n = this.length; t < n; t++) {
  60973. if (t in this && this[t] === e) return t;
  60974. }
  60975. return -1;
  60976. },
  60977. n = "notify",
  60978. r = n + "js",
  60979. i = n + "!blank",
  60980. s = {
  60981. t: "top",
  60982. m: "middle",
  60983. b: "bottom",
  60984. l: "left",
  60985. c: "center",
  60986. r: "right"
  60987. },
  60988. o = ["l", "c", "r"],
  60989. u = ["t", "m", "b"],
  60990. a = ["t", "b", "l", "r"],
  60991. f = {
  60992. t: "b",
  60993. m: null,
  60994. b: "t",
  60995. l: "r",
  60996. c: null,
  60997. r: "l"
  60998. },
  60999. l = function l(t) {
  61000. var n;
  61001. return n = [], e.each(t.split(/\W+/), function (e, t) {
  61002. var r;
  61003. r = t.toLowerCase().charAt(0);
  61004. if (s[r]) return n.push(r);
  61005. }), n;
  61006. },
  61007. c = {},
  61008. h = {
  61009. name: "core",
  61010. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  61011. 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}"
  61012. },
  61013. p = {
  61014. "border-radius": ["-webkit-", "-moz-"]
  61015. },
  61016. d = function d(e) {
  61017. return c[e];
  61018. },
  61019. v = function v(e) {
  61020. if (!e) throw "Missing Style name";
  61021. c[e] && delete c[e];
  61022. },
  61023. m = function m(t, i) {
  61024. if (!t) throw "Missing Style name";
  61025. if (!i) throw "Missing Style definition";
  61026. if (!i.html) throw "Missing Style HTML";
  61027. var s = c[t];
  61028. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61029. var o = "";
  61030. i.classes && e.each(i.classes, function (t, n) {
  61031. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61032. return p[t] && e.each(p[t], function (e, r) {
  61033. return o += " " + r + t + ": " + n + ";\n";
  61034. }), o += " " + t + ": " + n + ";\n";
  61035. }), o += "}\n";
  61036. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61037. var u = {},
  61038. a = e(i.html);
  61039. y("html", a, u), y("text", a, u), i.fields = u;
  61040. },
  61041. g = function g(t) {
  61042. var n, r, i;
  61043. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61044. try {
  61045. r.html(t);
  61046. } catch (s) {
  61047. r[0].styleSheet.cssText = t;
  61048. }
  61049. return r;
  61050. },
  61051. y = function y(t, n, r) {
  61052. var s;
  61053. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61054. var n;
  61055. n = e(this).attr(s), n || (n = i), r[n] = t;
  61056. });
  61057. },
  61058. b = function b(e, t) {
  61059. return e.is(t) ? e : e.find(t);
  61060. },
  61061. w = {
  61062. clickToHide: !0,
  61063. autoHide: !0,
  61064. autoHideDelay: 5e3,
  61065. arrowShow: !0,
  61066. arrowSize: 5,
  61067. breakNewLines: !0,
  61068. elementPosition: "bottom",
  61069. globalPosition: "top right",
  61070. style: "bootstrap",
  61071. className: "error",
  61072. showAnimation: "slideDown",
  61073. showDuration: 400,
  61074. hideAnimation: "slideUp",
  61075. hideDuration: 200,
  61076. gap: 5
  61077. },
  61078. E = function E(t, n) {
  61079. var r;
  61080. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61081. },
  61082. S = function S(t) {
  61083. return e.extend(w, t);
  61084. },
  61085. x = function x(t) {
  61086. return e("<" + t + "></" + t + ">");
  61087. },
  61088. T = {},
  61089. N = function N(t) {
  61090. var n;
  61091. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61092. return e(r).attr("name") === t.attr("name");
  61093. }), t = n.first()), t;
  61094. },
  61095. C = function C(e, t, n) {
  61096. var r, i;
  61097. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61098. if (isNaN(n)) return;
  61099. 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;
  61100. },
  61101. k = function k(e, t, n) {
  61102. if (e === "l" || e === "t") return 0;
  61103. if (e === "c" || e === "m") return n / 2 - t / 2;
  61104. if (e === "r" || e === "b") return n - t;
  61105. throw "Invalid alignment";
  61106. },
  61107. L = function L(e) {
  61108. return L.e = L.e || x("div"), L.e.text(e).html();
  61109. };
  61110. A.prototype.loadHTML = function () {
  61111. var t;
  61112. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61113. }, A.prototype.show = function (e, t) {
  61114. var n, r, i, s, o;
  61115. r = function (n) {
  61116. return function () {
  61117. !e && !n.elem && n.destroy();
  61118. if (t) return t();
  61119. };
  61120. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61121. 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 {
  61122. if (!!o || !!e) return r();
  61123. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61124. }
  61125. return n.push(r), i[s].apply(i, n);
  61126. }, A.prototype.setGlobalPosition = function () {
  61127. var t = this.getPosition(),
  61128. n = t[0],
  61129. i = t[1],
  61130. o = s[n],
  61131. u = s[i],
  61132. a = n + "|" + i,
  61133. f = T[a];
  61134. if (!f || !document.body.contains(f[0])) {
  61135. f = T[a] = x("div");
  61136. var l = {};
  61137. 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);
  61138. }
  61139. return f.prepend(this.wrapper);
  61140. }, A.prototype.setElementPosition = function () {
  61141. 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;
  61142. 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"];
  61143. for (w = 0, S = B.length; w < S; w++) {
  61144. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61145. }
  61146. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61147. if (!this.options.arrowShow) this.arrow.hide();else {
  61148. 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";
  61149. for (E = 0, x = a.length; E < x; E++) {
  61150. D = a[E], P = s[D];
  61151. if (D === L) continue;
  61152. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61153. }
  61154. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61155. }
  61156. 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);
  61157. if (r) return this.arrow.removeAttr("style").css(r);
  61158. }, A.prototype.getPosition = function () {
  61159. var e, n, r, i, s, f, c, h;
  61160. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61161. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61162. 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";
  61163. return e.length === 2 && (e[2] = e[1]), e;
  61164. }, A.prototype.getStyle = function (e) {
  61165. var t;
  61166. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61167. if (!t) throw "Missing style: " + e;
  61168. return t;
  61169. }, A.prototype.updateClasses = function () {
  61170. var t, n;
  61171. 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) {
  61172. return r + "-" + n.name + "-" + e;
  61173. }).join(" "), this.userContainer.attr("class", t);
  61174. }, A.prototype.run = function (t, n) {
  61175. var r, s, o, u, a;
  61176. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61177. if (this.container && !t) {
  61178. this.show(!1);
  61179. return;
  61180. }
  61181. if (!this.container && !t) return;
  61182. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61183. for (o in s) {
  61184. r = s[o], u = this.userFields[o];
  61185. if (!u) continue;
  61186. 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);
  61187. }
  61188. 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));
  61189. }, A.prototype.destroy = function () {
  61190. this.wrapper.data(r, null), this.wrapper.remove();
  61191. }, e[n] = function (t, r, i) {
  61192. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61193. }, e.fn[n] = function (t, n) {
  61194. return e(this).each(function () {
  61195. var i = N(e(this)).data(r);
  61196. i && i.destroy();
  61197. var s = new A(e(this), t, n);
  61198. }), this;
  61199. }, e.extend(e[n], {
  61200. defaults: S,
  61201. addStyle: m,
  61202. removeStyle: v,
  61203. pluginOptions: w,
  61204. getStyle: d,
  61205. insertCSS: g
  61206. }), m("bootstrap", {
  61207. html: "<div>\n<span data-notify-text></span>\n</div>",
  61208. classes: {
  61209. base: {
  61210. "font-weight": "bold",
  61211. padding: "8px 15px 8px 14px",
  61212. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61213. "background-color": "#fcf8e3",
  61214. border: "1px solid #fbeed5",
  61215. "border-radius": "4px",
  61216. "white-space": "nowrap",
  61217. "padding-left": "25px",
  61218. "background-repeat": "no-repeat",
  61219. "background-position": "3px 7px"
  61220. },
  61221. error: {
  61222. color: "#B94A48",
  61223. "background-color": "#F2DEDE",
  61224. "border-color": "#EED3D7",
  61225. "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=)"
  61226. },
  61227. success: {
  61228. color: "#468847",
  61229. "background-color": "#DFF0D8",
  61230. "border-color": "#D6E9C6",
  61231. "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==)"
  61232. },
  61233. info: {
  61234. color: "#3A87AD",
  61235. "background-color": "#D9EDF7",
  61236. "border-color": "#BCE8F1",
  61237. "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=)"
  61238. },
  61239. warn: {
  61240. color: "#C09853",
  61241. "background-color": "#FCF8E3",
  61242. "border-color": "#FBEED5",
  61243. "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)"
  61244. }
  61245. }
  61246. }), e(function () {
  61247. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61248. e(this).trigger("notify-hide");
  61249. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61250. var n = e(this).data(r);
  61251. n && n.show(!1);
  61252. });
  61253. });
  61254. });
  61255. /***/ }),
  61256. /***/ "./resources/js/views/App.vue":
  61257. /*!************************************!*\
  61258. !*** ./resources/js/views/App.vue ***!
  61259. \************************************/
  61260. /*! exports provided: default */
  61261. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61262. "use strict";
  61263. __webpack_require__.r(__webpack_exports__);
  61264. /* 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&");
  61265. /* 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&");
  61266. /* 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");
  61267. /* normalize component */
  61268. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61269. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61270. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61271. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61272. false,
  61273. null,
  61274. null,
  61275. null
  61276. )
  61277. /* hot reload */
  61278. if (false) { var api; }
  61279. component.options.__file = "resources/js/views/App.vue"
  61280. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61281. /***/ }),
  61282. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61283. /*!*************************************************************!*\
  61284. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61285. \*************************************************************/
  61286. /*! exports provided: default */
  61287. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61288. "use strict";
  61289. __webpack_require__.r(__webpack_exports__);
  61290. /* 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&");
  61291. /* 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"]);
  61292. /***/ }),
  61293. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61294. /*!*******************************************************************!*\
  61295. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61296. \*******************************************************************/
  61297. /*! exports provided: render, staticRenderFns */
  61298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61299. "use strict";
  61300. __webpack_require__.r(__webpack_exports__);
  61301. /* 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&");
  61302. /* 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"]; });
  61303. /* 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"]; });
  61304. /***/ }),
  61305. /***/ "./resources/js/views/Dashboard.vue":
  61306. /*!******************************************!*\
  61307. !*** ./resources/js/views/Dashboard.vue ***!
  61308. \******************************************/
  61309. /*! exports provided: default */
  61310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61311. "use strict";
  61312. __webpack_require__.r(__webpack_exports__);
  61313. /* 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&");
  61314. /* 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&");
  61315. /* 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");
  61316. /* normalize component */
  61317. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61318. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61319. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61320. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61321. false,
  61322. null,
  61323. null,
  61324. null
  61325. )
  61326. /* hot reload */
  61327. if (false) { var api; }
  61328. component.options.__file = "resources/js/views/Dashboard.vue"
  61329. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61330. /***/ }),
  61331. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61332. /*!*******************************************************************!*\
  61333. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  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 _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&");
  61340. /* 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"]);
  61341. /***/ }),
  61342. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61343. /*!*************************************************************************!*\
  61344. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61345. \*************************************************************************/
  61346. /*! exports provided: render, staticRenderFns */
  61347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61348. "use strict";
  61349. __webpack_require__.r(__webpack_exports__);
  61350. /* 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&");
  61351. /* 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"]; });
  61352. /* 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"]; });
  61353. /***/ }),
  61354. /***/ "./resources/js/views/Login.vue":
  61355. /*!**************************************!*\
  61356. !*** ./resources/js/views/Login.vue ***!
  61357. \**************************************/
  61358. /*! exports provided: default */
  61359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61360. "use strict";
  61361. __webpack_require__.r(__webpack_exports__);
  61362. /* 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&");
  61363. /* 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&");
  61364. /* 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");
  61365. /* normalize component */
  61366. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61367. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61368. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61369. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61370. false,
  61371. null,
  61372. null,
  61373. null
  61374. )
  61375. /* hot reload */
  61376. if (false) { var api; }
  61377. component.options.__file = "resources/js/views/Login.vue"
  61378. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61379. /***/ }),
  61380. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61381. /*!***************************************************************!*\
  61382. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61383. \***************************************************************/
  61384. /*! exports provided: default */
  61385. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61386. "use strict";
  61387. __webpack_require__.r(__webpack_exports__);
  61388. /* 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&");
  61389. /* 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"]);
  61390. /***/ }),
  61391. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61392. /*!*********************************************************************!*\
  61393. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61394. \*********************************************************************/
  61395. /*! exports provided: render, staticRenderFns */
  61396. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61397. "use strict";
  61398. __webpack_require__.r(__webpack_exports__);
  61399. /* 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&");
  61400. /* 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"]; });
  61401. /* 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"]; });
  61402. /***/ }),
  61403. /***/ "./resources/js/views/Welcome.vue":
  61404. /*!****************************************!*\
  61405. !*** ./resources/js/views/Welcome.vue ***!
  61406. \****************************************/
  61407. /*! exports provided: default */
  61408. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61409. "use strict";
  61410. __webpack_require__.r(__webpack_exports__);
  61411. /* 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&");
  61412. /* 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&");
  61413. /* 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&");
  61414. /* 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");
  61415. /* normalize component */
  61416. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61417. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61418. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61419. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61420. false,
  61421. null,
  61422. "1ae8ae93",
  61423. null
  61424. )
  61425. /* hot reload */
  61426. if (false) { var api; }
  61427. component.options.__file = "resources/js/views/Welcome.vue"
  61428. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61429. /***/ }),
  61430. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61431. /*!*****************************************************************!*\
  61432. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61433. \*****************************************************************/
  61434. /*! exports provided: default */
  61435. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61436. "use strict";
  61437. __webpack_require__.r(__webpack_exports__);
  61438. /* 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&");
  61439. /* 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"]);
  61440. /***/ }),
  61441. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61442. /*!*************************************************************************************************!*\
  61443. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61444. \*************************************************************************************************/
  61445. /*! no static exports found */
  61446. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61447. "use strict";
  61448. __webpack_require__.r(__webpack_exports__);
  61449. /* 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&");
  61450. /* 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__);
  61451. /* 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__));
  61452. /* 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);
  61453. /***/ }),
  61454. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61455. /*!***********************************************************************************!*\
  61456. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61457. \***********************************************************************************/
  61458. /*! exports provided: render, staticRenderFns */
  61459. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61460. "use strict";
  61461. __webpack_require__.r(__webpack_exports__);
  61462. /* 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&");
  61463. /* 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"]; });
  61464. /* 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"]; });
  61465. /***/ }),
  61466. /***/ "./resources/js/views/WorkOrder.vue":
  61467. /*!******************************************!*\
  61468. !*** ./resources/js/views/WorkOrder.vue ***!
  61469. \******************************************/
  61470. /*! exports provided: default */
  61471. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61472. "use strict";
  61473. __webpack_require__.r(__webpack_exports__);
  61474. /* 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&");
  61475. /* 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&");
  61476. /* 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");
  61477. /* normalize component */
  61478. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61479. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61480. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61481. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61482. false,
  61483. null,
  61484. null,
  61485. null
  61486. )
  61487. /* hot reload */
  61488. if (false) { var api; }
  61489. component.options.__file = "resources/js/views/WorkOrder.vue"
  61490. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61491. /***/ }),
  61492. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61493. /*!*******************************************************************!*\
  61494. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61495. \*******************************************************************/
  61496. /*! exports provided: default */
  61497. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61498. "use strict";
  61499. __webpack_require__.r(__webpack_exports__);
  61500. /* 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&");
  61501. /* 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"]);
  61502. /***/ }),
  61503. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61504. /*!*************************************************************************!*\
  61505. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61506. \*************************************************************************/
  61507. /*! exports provided: render, staticRenderFns */
  61508. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61509. "use strict";
  61510. __webpack_require__.r(__webpack_exports__);
  61511. /* 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&");
  61512. /* 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"]; });
  61513. /* 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"]; });
  61514. /***/ }),
  61515. /***/ "./resources/sass/app.scss":
  61516. /*!*********************************!*\
  61517. !*** ./resources/sass/app.scss ***!
  61518. \*********************************/
  61519. /*! no static exports found */
  61520. /***/ (function(module, exports) {
  61521. // removed by extract-text-webpack-plugin
  61522. /***/ }),
  61523. /***/ 0:
  61524. /*!*************************************************************!*\
  61525. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61526. \*************************************************************/
  61527. /*! no static exports found */
  61528. /***/ (function(module, exports, __webpack_require__) {
  61529. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61530. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61531. /***/ })
  61532. /******/ });